Question: CWL: How to refer to input or scattered value of a step
0
gravatar for mkher
3.4 years ago by
mkher50
mkher50 wrote:

I have a workflow that scatters a step over an array input called intervals. I want to use the value interval[i] to construct another parameter to the step.

cwlVersion: v1.0
class: Workflow
requirements:
   - class: ScatterFeatureRequirement
   - class: StepInputExpressionRequirement
   - class: InlineJavascriptRequirement
inputs:
   bam: File
   intervals: string[]
outputs:
  hc_vcf:
  type: File[]
  outputSource: step_hc/output_HaplotypeCaller
steps:
  step_hc:
    run: dummy_HC.cwl
    scatter: [interval_string]
    in:
      inputBam: bam
      interval_string: intervals
      outputVcf:
      # This is where I would like the output to be named something like 
      # $(inputs.bam.nameroot).$(interval_string).vcf

I can refer to the inputs to workflow, but I have not figured out how to refer to the input to a particular step.

Thank you Manisha

cwl • 2.5k views
ADD COMMENTlink modified 18 months ago by jshelton0 • written 3.4 years ago by mkher50
1
gravatar for Michael R. Crusoe
3.4 years ago by
Common Workflow Language project
Michael R. Crusoe1.8k wrote:

Hello Manisha,

Thank you for your question; my apologies for the delay in getting a response.

You have at least two options:

A. Use valueFrom ( http://www.commonwl.org/v1.0/Workflow.html#WorkflowStepInput)

steps:
  step_hc:
    run: dummy_HC.cwl
    scatter: [interval_string]
    in:
      inputBam: bam
      interval_string: intervals
      outputVcf:
        valueFrom: ${ return inputs.inputBam.nameroot + "." + inputs.interval_string + ".vcf";}

Here a full expression is need instead of a parameter reference due to combining multiple inputs.

B. Adjust dummy_HC.cwl to compute the the outputVCF filename itself, so that other CWL workflows don't have to repeat Option A

arguments:
 - position: 0 # adjust or remove as necessary
   prefix: --output_file # just an example, adjust or remove as necessary
   valueFrom: ${ return inputs.inputBam.nameroot + "." + inputs.interval_string + ".vcf";}

I hope you find this helpful.

ADD COMMENTlink written 3.4 years ago by Michael R. Crusoe1.8k
2

Hello again Manisha,

I have an update on my answers, there is a simpler syntax available as documented here

A:

steps:
  step_hc:
    run: dummy_HC.cwl
    scatter: [interval_string]
    in:
      inputBam: bam
      interval_string: intervals
      outputVcf:
        valueFrom: $(inputs.inputBam.nameroot).$(inputs.interval_string).vcf

B:

arguments:
 - position: 0 # adjust or remove as necessary
   prefix: --output_file # just an example, adjust or remove as necessary
   valueFrom: $(inputs.inputBam.nameroot).$(inputs.interval_string).vcf
ADD REPLYlink written 3.3 years ago by Michael R. Crusoe1.8k
0
gravatar for jshelton
18 months ago by
jshelton0
jshelton0 wrote:

I would like to know how to use an interval_string to define the path of an input file. For example, if the command above required an input bed file:

--bed passing_regions.$(inputs.interval_string).bed

How can I update the path for the input file for each "interval_string"?

ADD COMMENTlink written 18 months ago by jshelton0

Hello jshelton; thank you for your question,

(I think it should maybe be a new question on its own and not a "answer" to the original question above?)

Can you share a link to which bedtools CWL description you are using?

ADD REPLYlink written 18 months ago by Michael R. Crusoe1.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 807 users visited in the last hour