Preliminary fix for mapping tools with paired

collection input over list:paired collections.
This commit is contained in:
mvdbeek
2016-11-22 18:41:50 +01:00
parent 097300ea62
commit 6fd77db920
4 changed files with 61 additions and 2 deletions
+7 -1
View File
@@ -126,7 +126,13 @@ class DatasetCollectionManager( object ):
if collection_type_description.has_subcollections( ):
# Nested collection - recursively create collections and update identifiers.
self.__recursively_create_collections( trans, element_identifiers )
elements = self.__load_elements( trans, element_identifiers )
new_collection = False
for element_identifier in element_identifiers:
if element_identifier.get("src") == "new_collection" and element_identifier.get('collection_type') == '':
new_collection = True
elements = self.__load_elements(trans, element_identifier['element_identifiers'])
if not new_collection:
elements = self.__load_elements( trans, element_identifiers )
# else if elements is set, it better be an ordered dict!
if elements is not self.ELEMENTS_UNINITIALIZED:
+9 -1
View File
@@ -770,7 +770,15 @@ def determine_output_format(output, parameter_context, input_datasets, input_dat
if collection_name in input_dataset_collections:
try:
input_collection = input_dataset_collections[collection_name][0][0]
input_dataset = input_collection.collection[element_index].element_object
input_collection_collection = input_collection.collection
try:
input_element = input_collection_collection[element_index]
except KeyError:
for element in input_collection_collection.dataset_elements:
if element.element_identifier == element_index:
input_element = element
break
input_dataset = input_element.element_object
input_extension = input_dataset.ext
ext = input_extension
except Exception as e:
@@ -0,0 +1,44 @@
<tool id="paired_collection_map_over_structured_like" name="paired_collection_map_over_strcutured_like" version="0.1.0">
<!-- You usually wouldn't want to do this - just write the operation for
a single dataset and allow the user to map that tool over the whole
collection. -->
<command>
cat '${input1.forward}' > '${list_output.forward}';
cat '${input1.reverse}' > '${list_output.reverse}'
</command>
<inputs>
<param name="input1" type="data_collection" collection_type="paired" label="Input" help="Input collection..." format="txt" />
</inputs>
<outputs>
<collection name="list_output" structured_like="input1" type="paired" label="Duplicate List">
<!-- inherit_format can be used in conjunction with structured_like
to perserve format. -->
</collection>
</outputs>
<tests>
<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_collection name="list_output" type="paired">
<element name="forward">
<assert_contents>
<has_text_matching expression="^identifier is i1:forward\n$" />
</assert_contents>
</element>
<element name="reverse">
<assert_contents>
<has_text_matching expression="^identifier is i1:reverse\n$" />
</assert_contents>
</element>
</output_collection>
</test>
</tests>
</tool>
@@ -78,6 +78,7 @@
<tool file="tool_directory.xml" />
<tool file="output_action_change_format.xml" />
<tool file="collection_paired_test.xml" />
<tool file="paired_collection_map_over_structured_like.xml" />
<tool file="collection_nested_test.xml" />
<tool file="collection_mixed_param.xml" />
<tool file="collection_two_paired.xml" />