Skip to content

Instantly share code, notes, and snippets.

@dleehr
Last active June 29, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dleehr/8c93d0925cba161272017c9d75aa6617 to your computer and use it in GitHub Desktop.
Save dleehr/8c93d0925cba161272017c9d75aa6617 to your computer and use it in GitHub Desktop.
from cwlgen.import_cwl import parse_cwl
from cwlgen import File, Workflow
from cwlgen.workflow import InputParameter
# Files in https://github.com/Duke-GCB/bespin-cwl/tree/qiime2-workflow
mkdir_tool = parse_cwl('EMPSingleEndSequences-directory.cwl')
import_tool = parse_cwl('tools-import.cwl')
w = Workflow()
# Add steps
step1 = w.add('make_import_directory', mkdir_tool, {
'sequences': File(''), # File is a stub, but requires an unused 'path' parameter
'barcodes': File(''),
})
step2 = w.add('make_sequences_artifact', import_tool, {
'input_path': step1['dir'],
'type': InputParameter('sequences_artifact_type', param_type='string'),
})
step2['sequences_artifact'].store()
w.label = 'qiime2 importing data'
w.doc = 'Obtaining and importing data from https://docs.qiime2.org/2018.4/tutorials/moving-pictures/'
w.export()
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.0
doc: Obtaining and importing data from https://docs.qiime2.org/2018.4/tutorials/moving-pictures/
inputs:
barcodes: {id: barcodes, type: File}
sequences: {id: sequences, type: File}
sequences_artifact_type: {id: sequences_artifact_type, type: string}
label: qiime2 importing data
outputs:
make_sequences_artifact_sequences_artifact: {id: make_sequences_artifact_sequences_artifact,
outputSource: make_sequences_artifact/sequences_artifact, type: File}
steps:
make_import_directory:
id: make_import_directory
in: {barcodes: barcodes, sequences: sequences}
out: [dir]
run: EMPSingleEndSequences-directory.cwl
make_sequences_artifact:
id: make_sequences_artifact
in: {input_path: make_import_directory/dir, sequences_artifact_type: sequences_artifact_type}
out: [sequences_artifact]
run: tools-import.cwl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment