commit/galaxy-central: greg: Add new tool attributes to hold information about tools installed from a Galaxy tool shed. Enhance the toolbox's <tool> tag parser to handle these new tool attributes for installed tools. Enhance the Workflow import and load functions to search these new attributes when looking for required tools in the Galaxy instance.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/fcaf6ec8e51b/ changeset: fcaf6ec8e51b user: greg date: 2011-10-18 17:41:08 summary: Add new tool attributes to hold information about tools installed from a Galaxy tool shed. Enhance the toolbox's <tool> tag parser to handle these new tool attributes for installed tools. Enhance the Workflow import and load functions to search these new attributes when looking for required tools in the Galaxy instance. affected #: 2 files (-1 bytes) --- a/lib/galaxy/tools/__init__.py Tue Oct 18 10:50:16 2011 -0400 +++ b/lib/galaxy/tools/__init__.py Tue Oct 18 11:41:08 2011 -0400 @@ -104,6 +104,14 @@ try: path = elem.get( "file" ) tool = self.load_tool( os.path.join( tool_path, path ), guid=guid ) + if guid is not None: + # Tool was installed from a Galaxy tool shed. + tool.tool_shed = elem.find( "tool_shed" ).text + tool.repository_name = elem.find( "repository_name" ).text + tool.repository_owner = elem.find( "repository_owner" ).text + tool.changeset_revision = elem.find( "changeset_revision" ).text + tool.old_id = elem.find( "id" ).text + tool.version = elem.find( "version" ).text if self.app.config.get_bool( 'enable_tool_tags', False ): tag_names = elem.get( "tags", "" ).split( "," ) for tag_name in tag_names: @@ -364,9 +372,7 @@ # legacy basic mode - provide compatible defaults self.attributes['split_size'] = 20 self.attributes['split_mode'] = 'number_of_parts' - - - + class Tool: """ Represents a computational tool that can be executed through Galaxy. @@ -387,6 +393,13 @@ # easily ensure that parameter dependencies like index files or # tool_data_table_conf.xml entries exist. self.input_params = [] + # Attributes of tools installed from Galaxy tool sheds. + self.tool_shed = None + self.repository_name = None + self.repository_owner = None + self.changeset_revision = None + self.old_id = None + self.version = None # Parse XML element containing configuration self.parse( root, guid=guid ) @@ -407,14 +420,14 @@ raise Exception, "Missing tool 'name'" # Get the UNIQUE id for the tool # TODO: can this be generated automatically? - if guid is not None: + if guid is None: + self.id = root.get( "id" ) + self.version = root.get( "version" ) + else: self.id = guid - else: - self.id = root.get( "id" ) if not self.id: - raise Exception, "Missing tool 'id'" - self.version = root.get( "version" ) - if not self.version: + raise Exception, "Missing tool 'id'" + if not self.version: # For backward compatibility, some tools may not have versions yet. self.version = "1.0.0" # Support multi-byte tools --- a/lib/galaxy/workflow/modules.py Tue Oct 18 10:50:16 2011 -0400 +++ b/lib/galaxy/workflow/modules.py Tue Oct 18 11:41:08 2011 -0400 @@ -171,15 +171,10 @@ except KeyError, e: # Handle the case where the workflow requires a tool not available in the local Galaxy instance. self.tool = None - # TODO: Instead of parsing the guid, get the tool_id and version from the shed_tool_conf.xml, - # which requires enhancements to the tool loading process. + # The id value of tools installed from a Galaxy tool shed is a guid, but + # these tool's old_id attribute should contain what we're looking for. for available_tool_id, available_tool in trans.app.toolbox.tools_by_id.items(): - if available_tool_id.find( tool_id ) >=0: - # We're attempting to match tool id against a tool guid. - # TODO: match by tool_id (and version if we attempt that, but - # workflows will break) is not good enough because - # 2 tools installed from a tool shed could both match this. We - # need to present a select list here. + if tool_id == available_tool.old_id: self.tool = available_tool break self.post_job_actions = {} @@ -211,13 +206,10 @@ tool_id = step.tool_id install_tool_id = None if tool_id not in trans.app.toolbox.tools_by_id: + # The id value of tools installed from a Galaxy tool shed is a guid, but + # these tool's old_id attribute should contain what we're looking for. for available_tool_id, available_tool in trans.app.toolbox.tools_by_id.items(): - if available_tool_id.find( tool_id ) >=0: - # We're attempting to match tool id against a tool guid. - # TODO: match by tool_id (and version if we attempt that, but - # workflows will break) is not good enough because - # 2 tools installed from a tool shed could both match this. We - # need to present a select list here. + if tool_id == available_tool.old_id: install_tool_id = available_tool_id break if tool_id in trans.app.toolbox.tools_by_id or install_tool_id: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket