Skip to content

Commit

Permalink
Merge pull request #4389 from jmchilton/output_collect_refactor
Browse files Browse the repository at this point in the history
Refactor ToolOutputCollectionStructure...
  • Loading branch information
nsoranzo committed Aug 8, 2017
2 parents d2394aa + e811221 commit d53a542
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/galaxy/tools/parser/output_objects.py
Expand Up @@ -118,11 +118,7 @@ def known_outputs( self, inputs, type_registry ):
if len( self.outputs ) > 1:
output_parts = [ToolOutputCollectionPart(self, k, v) for k, v in self.outputs.items()]
else:
# either must have specified structured_like or something worse
if self.structure.structured_like:
collection_prototype = inputs[ self.structure.structured_like ].collection
else:
collection_prototype = type_registry.prototype( self.structure.collection_type )
collection_prototype = self.structure.collection_prototype( inputs, type_registry )

def prototype_dataset_element_to_output( element, parent_ids=[] ):
name = element.element_identifier
Expand Down Expand Up @@ -178,9 +174,9 @@ class ToolOutputCollectionStructure( object ):
def __init__(
self,
collection_type,
collection_type_source,
structured_like,
dataset_collector_descriptions,
collection_type_source=None,
structured_like=None,
dataset_collector_descriptions=None,
):
self.collection_type = collection_type
self.collection_type_source = collection_type_source
Expand All @@ -194,6 +190,14 @@ def __init__(
raise ValueError( "Cannot specify dynamic structure (discovered_datasets) and structured_like attribute." )
self.dynamic = dataset_collector_descriptions is not None

def collection_prototype( self, inputs, type_registry ):
# either must have specified structured_like or something worse
if self.structured_like:
collection_prototype = inputs[ self.structured_like ].collection
else:
collection_prototype = type_registry.prototype( self.collection_type )
return collection_prototype


class ToolOutputCollectionPart( object ):

Expand Down

0 comments on commit d53a542

Please sign in to comment.