CWL: How to refer to input or scattered value of a step
2
0
Entering edit mode
7.2 years ago
mkher ▴ 50

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 • 4.1k views
ADD COMMENT
1
Entering edit mode
7.1 years ago

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: $(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: $(inputs.inputBam.nameroot).$(inputs.interval_string).vcf

I hope you find this helpful.

[edited 2020-10-01 to clean up syntax]

ADD COMMENT
0
Entering edit mode
5.3 years ago
jshelton • 0

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 COMMENT
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1852 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6