Skip to content

Commit

Permalink
Provide element_identifier attribute in DatsetCollectionWrapper
Browse files Browse the repository at this point in the history
This allows accessing `$input1.element_identifier` for an `input1` of
collection_type `list:pair`.
  • Loading branch information
mvdbeek committed Nov 20, 2018
1 parent 72b2781 commit d35a076
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/tools/wrappers.py
Expand Up @@ -444,6 +444,10 @@ def keys(self):
def is_collection(self):
return True

@property
def element_identifier(self):
return self.name

@property
def is_input_supplied(self):
return self.__input_supplied
Expand Down
22 changes: 20 additions & 2 deletions test/functional/tools/identifier_collection.xml
@@ -1,15 +1,33 @@
<tool id="identifier_collection" name="identifier_collection">
<tool id="identifier_collection" name="identifier_collection" version="0.1">
<command>
#for $input in $input1:
echo '$input.element_identifier' >> 'output1';
#end for
</command>
<inputs>
<param type="data_collection" collection_type="list" name="input1" label="Input 1" />
<param type="data_collection" collection_type="list,list:paired" name="input1" label="Input 1" />
</inputs>
<outputs>
<data name="output1" format="tabular" from_work_dir="output1" />
</outputs>
<tests>
<!-- test getting identifier for list:pair collections -->
<test>
<param name="input1">
<collection type="list:paired">
<element name="i1">
<collection type="paired">
<element name="forward" value="simple_line.txt" />
<element name="reverse" value="simple_line_alternative.txt" />
</collection>
</element>
</collection>
</param>
<output name="output1">
<assert_contents>
<has_line line="i1" />
</assert_contents>
</output>
</test>
</tests>
</tool>

0 comments on commit d35a076

Please sign in to comment.