Parse EDAM ontology to decode names

This commit is contained in:
Helena Rasche
2020-10-30 12:37:23 +01:00
parent 5728189085
commit 1733f462dd
4 changed files with 38 additions and 2 deletions
+12
View File
@@ -3191,6 +3191,18 @@
:Type: bool
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``beta_edam_toolbox_ontology_path``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Sets the path to EDAM ontology file.
The value of this option will be resolved with respect to
<config_dir>.
:Default: ``EDAM_1.23.tsv``
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``default_workflow_export_format``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1593,6 +1593,11 @@ galaxy:
# sections in lieu of EDAM topics only.
#enable_beta_edam_toolbox: false
# Sets the path to EDAM ontology file.
# The value of this option will be resolved with respect to
# <config_dir>.
#beta_edam_toolbox_ontology_path: EDAM_1.23.tsv
# Default format for the export of workflows. Possible values are 'ga'
# or 'format2'.
#default_workflow_export_format: ga
+12 -1
View File
@@ -110,6 +110,17 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
self._filter_factory = FilterFactory(self)
self._tool_tag_manager = tool_tag_manager(app)
self._init_tools_from_configs(config_filenames)
if self.app.config.enable_beta_edam_toolbox:
with open(self.app.config.beta_edam_toolbox_ontology_path, 'r') as handle:
self.edam = {}
for idx, line in enumerate(handle.readlines()):
fields = line.split('\t')
if not fields[0].startswith('http://edamontology.org/'):
continue
term_id = fields[0][len('http://edamontology.org/'):]
self.edam[term_id] = fields[1] # preferred label
if self.app.name == 'galaxy' and self._integrated_tool_panel_config_has_contents:
# Load self._tool_panel based on the order in self._integrated_tool_panel.
if self.app.config.enable_beta_edam_toolbox:
@@ -404,7 +415,7 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin):
edam = tool.edam_operations + tool.edam_topics
if len(edam) > 0:
# TODO nicer edam names.
sec_id, sec_nm = edam[0], edam[0]
sec_id, sec_nm = edam[0], self.edam.get(edam[0], 'New term')
else:
sec_id, sec_nm = 'uncategorized', 'Uncategorized'
return sec_id, sec_nm
+9 -1
View File
@@ -486,7 +486,7 @@ mapping:
file_sources_config_file:
type: str
default: file_sources_conf.yml
default: file_sources_conf.yml
path_resolves_to: config_dir
required: false
desc: |
@@ -2331,6 +2331,14 @@ mapping:
Enable beta EDAM organised toolbox which ignores admin managed
sections in lieu of EDAM topics only.
beta_edam_toolbox_ontology_path:
type: str
default: EDAM_1.23.tsv
path_resolves_to: config_dir
required: false
desc: |
Sets the path to EDAM ontology file.
default_workflow_export_format:
type: str
default: ga