This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Two inputs combining to a single command line argument in CWL

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 answers

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 ]

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

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: []

Log in to answer this question.