Multiline commands in a single tool

Below is an example of a tool. Rather than use baseCommand, it uses arguments, and it invokes multiple commands (separated by newline characters).

cwlVersion: v1.1
class: CommandLineTool
  ShellCommandRequirement: {}
    type: string
    type: string
    - shellQuote: false
      valueFrom: >
        echo "Hello, $(inputs.given_name)!"

        echo "Your surname is $(inputs.surname)."
        type: stdout
    stdout: output.txt

This is an overly simple example. But in bioinformatics research, I often have a need to execute two related commands (maybe to align and then index a BAM file). Rather than structure them as two separate CWL tool definitions, it sometimes makes sense (to me) to use this approach. Here are my questions:

  • Is there some strong philosophical or technical reasoning against this approach?
  • Is there some strong reason that it would be a bad idea to leave baseCommand out of tool definitions?


1 Like

Hello @srp33,

It isn’t wrong :slight_smile:

The CWL standards do allow workflow executors to directly stream data between connected steps that use matching type: stdout / type: stdin (or other streamable: true) inputs/outputs. But as of 2020-05-26 I’m not aware of any such executors, so this is a normal workaround when streaming is needed.