This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to set exclusive parameters within a worklfow

How to set exclusive parameters within a worklfow?

Following the example for command line tools the job document looks like:

myDir:
  class: Directory
  path: /pipeline/CWL/Data/Inputs
myFile:
  class: File
  path: /pipeline/CWL/Tools/ls.tool.yaml  
exclusive_parameters:
  sortBySize: true

where sortBySize is the parameter within the workflow and bysize the exclusive parameter for the tool.
Workflow:

cwlVersion: v1.0
class: Workflow

inputs:
 myFile: File
 myDir: Directory
 sortBySize: 
   type: boolean?
   default: true

outputs:
  summary:
    type: File
    outputSource: getSummary/output

steps:
  getSummary:
    run: ../Tools/ls.tool.yaml
    in:
      myfile: myFile
      mydir: myDir
      exclusive_parameters:
        bysize: sortBySize

    out: [output,error]

Tool:

cwlVersion: v1.0
class: CommandLineTool
baseCommand: [ls , .]

stdout: ls.log
stderr: error.log

inputs:
  mydir:
    type: Directory
  myfile:
    type: File
  exclusive_parameters:
    type:
      - type: record
        name: listingByTime
        fields:
          longlisting:
            type: boolean
            inputBinding:
              prefix: -ltr
      - type: record
        name: size
        fields:
          bysize:
            type: boolean
            inputBinding:
              prefix: -S  

outputs:
  output:
    type: stdout
  error: 
    type: stderr
cwl

1 answer

Hello awilke1972,

Here is how to wrap a simple value into a record before passing it into another CWL CommandLineTool or Workflow.

cwlVersion: v1.0
class: Workflow

requirements:
 StepInputExpressionRequirement: {}
 InlineJavascriptRequirement: {}

inputs:
 myFile: File
 myDir: Directory
 sortBySize: 
   type: boolean?
   default: true

outputs:
  summary:
    type: File
    outputSource: getSummary/output

steps:
  getSummary:
    run: ls.tool.cwl
    in:
      myfile: myFile
      mydir: myDir
      exclusive_parameters:
        source: sortBySize
        valueFrom: |
          ${ return { "bysize": self }; }

    out: [output,error]

Log in to answer this question.