From b75f793ea4c58786747da3a9571ba3bd938cd181 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 29 Aug 2017 14:11:26 -0400 Subject: [PATCH] Load tools with collection type source attributes into the workflow editor. Should allow using filter failed and merge collection tools within workflows. --- .../mvc/workflow/workflow-terminals.js | 24 ++++++++++++++++--- .../mvc/workflow/workflow-view-terminals.js | 3 ++- lib/galaxy/tools/__init__.py | 16 ------------- lib/galaxy/workflow/modules.py | 1 + 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js index 45c2cf8f629..0aa05c2f699 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js @@ -476,11 +476,29 @@ define(['mvc/workflow/workflow-globals'], function( Globals ) { initialize: function( attr ) { Terminal.prototype.initialize.call( this, attr ); this.datatypes = attr.datatypes; - this.collectionType = new CollectionTypeDescription( attr.collection_type ); - this.isCollection = true; + if( attr.collection_type ) { + this.collectionType = new CollectionTypeDescription( attr.collection_type ); + } else { + var collectionTypeSource = attr.collection_type_source; + if(! collectionTypeSource) { + console.log("Warning: No collection type or collection type source defined."); + } + this.collectionType = ANY_COLLECTION_TYPE_DESCRIPTION; + } + this.isCollection = true; }, update: function( output ) { - var newCollectionType = new CollectionTypeDescription( output.collection_type ); + var newCollectionType; + if( output.collection_type ) { + newCollectionType = new CollectionTypeDescription( output.collection_type ); + } else { + var collectionTypeSource = output.collection_type_source; + if(! collectionTypeSource) { + console.log("Warning: No collection type or collection type source defined."); + } + newCollectionType = ANY_COLLECTION_TYPE_DESCRIPTION; + } + if( newCollectionType.collectionType != this.collectionType.collectionType ) { _.each( this.connectors, function( connector ) { // TODO: consider checking if connection valid before removing... diff --git a/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js index 0e0f1398d79..67351bf117e 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js @@ -224,7 +224,8 @@ define(['mvc/workflow/workflow-globals', 'mvc/workflow/workflow-terminals', terminalMappingViewClass: TerminalMappingView, terminalForOutput: function( output ) { var collection_type = output.collection_type; - var terminal = new Terminals.OutputCollectionTerminal( { element: this.el, collection_type: collection_type, datatypes: output.extensions } ); + var collection_type_source = output.collection_type_source; + var terminal = new Terminals.OutputCollectionTerminal( { element: this.el, collection_type: collection_type, collection_type_source: collection_type_source, datatypes: output.extensions } ); return terminal; } }); diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 6241409850a..0e0be12652f 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -472,18 +472,6 @@ class Tool(object, Dictifiable): installed_changeset_revision=self.installed_changeset_revision) return None - @property - def produces_collections_of_unknown_type(self): - - def output_is_dynamic_collection(output): - if not output.collection: - return False - if output.structure.collection_type: - return False - return True - - return any(map(output_is_dynamic_collection, self.outputs.values())) - @property def produces_collections_with_unknown_structure(self): @@ -1192,10 +1180,6 @@ class Tool(object, Dictifiable): if self.tool_type.startswith('data_source'): return False - if self.produces_collections_of_unknown_type: - # Getting there... - return False - if hasattr(tool_source, "root"): root = tool_source.root if not string_as_bool(root.get("workflow_compatible", "True")): diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index aa0ff7e741a..ca41e7b133f 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -686,6 +686,7 @@ class ToolModule(WorkflowModule): if tool_output.collection: extra_kwds["collection"] = True extra_kwds["collection_type"] = tool_output.structure.collection_type + extra_kwds["collection_type_source"] = tool_output.structure.collection_type_source formats = ['input'] # TODO: fix elif tool_output.format_source is not None: formats = ['input'] # default to special name "input" which remove restrictions on connections