Question: Two inputs combining to a single command line argument in CWL
1
gravatar for ttmigueltt
2.7 years ago by
ttmigueltt20
ttmigueltt20 wrote:

The invocation of VarDictJava in paired variant calling mode is

VarDict -b "/path/to/tumor.bam|/path/to/normal.bam"

Now obviously in my CWL I would like the tumour and normal BAM to be separate inputs. However, I'm not sure how to combine these into a single command line argument in the actual CommandLineBinding

cwl • 1.2k views
ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by ttmigueltt20
                               .
ADD REPLYlink modified 2.7 years ago • written 2.7 years ago by ttmigueltt20
3
gravatar for Michael R. Crusoe
2.7 years ago by
Common Workflow Language project
Michael R. Crusoe1.8k wrote:

Hello @ttmigueltt,

Here's an alternative solution if you will always have both samples; no InlineJavascriptRequirement needed:

cwlVersion: v1.0
class: CommandLineTool

inputs:
  normal:
    type: File
    format: edam:format_2572
  tumor
    type: File
    format: edam:format_2572

baseCommand: echo

arguments:
  - $(inputs.bam_input.path)|$(inputs.bam_input.path)

outputs: []

$namespaces: { edam: http://edamontology.org/ }
$schemas: [ http://edamontology.org/EDAM_1.20.owl ]
ADD COMMENTlink written 2.7 years ago by Michael R. Crusoe1.8k

Is this not using JavaScript here? If not, is there documentation on this string interpolation?

ADD REPLYlink written 2.7 years ago by ttmigueltt20
1

Those are parameter references, yep:

http://www.commonwl.org/user_guide/06-params/

https://www.commonwl.org/v1.0/CommandLineTool.html#Parameter_references

ADD REPLYlink written 2.7 years ago by Michael R. Crusoe1.8k

The format fields and accompany $namespace and $schemas directives are optional, but nice to have; see http://www.commonwl.org/user_guide/rec-practices/

ADD REPLYlink written 2.7 years ago by Michael R. Crusoe1.8k
1
gravatar for thomas.hickman42
2.7 years ago by
thomas.hickman4210 wrote:

You could use an inline javascript expression to evaluate the argument from the inputs e.g.:

cwlVersion: v1.0
class: CommandLineTool
requirements:
  - class: InlineJavascriptRequirement
baseCommand: "echo"

arguments:
  - ${
      if(inputs.tumor === null){
        return inputs.bam_input;
      }
      else{
        return inputs.tumor.path + "|" + inputs.bam_input.path;
      }
    }

inputs:
  - id: bam_input
    type: File
  - id: tumor
    type: File?

outputs: []
ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by thomas.hickman4210
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: 1986 users visited in the last hour
_