Two inputs combining to a single command line argument in CWL
2
1
Entering edit mode
5.9 years ago
multimeric ▴ 30

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 • 2.3k views
ADD COMMENT
0
Entering edit mode
                               .
ADD REPLY
3
Entering edit mode
5.9 years ago

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

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

ADD REPLY
0
Entering edit mode

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 REPLY
1
Entering edit mode
5.9 years ago

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 COMMENT

Login before adding your answer.

Traffic: 2442 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