Skip to content

Instantly share code, notes, and snippets.

@jmchilton
Created November 19, 2014 04:25
Show Gist options
  • Save jmchilton/3b66f101c53c6734d3c5 to your computer and use it in GitHub Desktop.
Save jmchilton/3b66f101c53c6734d3c5 to your computer and use it in GitHub Desktop.
Test cases demonstrating output collections in tools and workflows and a little YAML DSL for building Galaxy workflows.
def test_workflow_run_output_collections(self):
workflow_id = self._upload_yaml_workflow("""
- label: text_input
type: input
- label: split_up
tool_id: collection_creates_pair
state:
input1:
$link: text_input
- tool_id: collection_paired_test
state:
f1:
$link: split_up#paired_output
""")
history_id = self.dataset_populator.new_history()
hda1 = self.dataset_populator.new_dataset( history_id, content="a\nb\nc\nd\n" )
inputs = {
'0': self._ds_entry(hda1),
}
self.__invoke_workflow( history_id, workflow_id, inputs )
time.sleep( 5 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
self.assertEquals("a\nc\nb\nd\n", self.dataset_populator.get_history_dataset_content( history_id, hid=0 ) )
def test_workflow_run_output_collection_mapping(self):
workflow_id = self._upload_yaml_workflow("""
- type: input_collection
- tool_id: collection_creates_pair
state:
input1:
$link: 0
- tool_id: collection_paired_test
state:
f1:
$link: 1#paired_output
- tool_id: cat_list
state:
input1:
$link: 2#out1
""")
history_id = self.dataset_populator.new_history()
hdca1 = self.dataset_collection_populator.create_list_in_history( history_id, contents=["a\nb\nc\nd\n", "e\nf\ng\nh\n"] ).json()
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
inputs = {
'0': self._ds_entry(hdca1),
}
self.__invoke_workflow( history_id, workflow_id, inputs )
time.sleep( 5 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
self.assertEquals("a\nc\nb\nd\ne\ng\nf\nh\n", self.dataset_populator.get_history_dataset_content( history_id, hid=0 ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment