CWL draft-2 extensions

Estimated reading time: 3 minutes

SevenBridges has extended CWL draft-2 with some optional features. Rabix understands these extensions and will run CWL tools and workflows in the same manner as they are run on the SevenBridges platform and CGC.

Resource hints

The hints property of CommandLineTools can contain sbg:CpuRequirement and sbg:MemoryRequirement objects. These objects have the value property set to the minimum number of cores and megabytes of RAM, respectively. The value must be a non-negative integer, and setting the minimum cores to 0 implies that the tool will parallelize on any amount of assigned cores.


class: CommandLineTool
  - class: sbg:CpuRequirement
    value: 1     # Single core
  - class: sbg:MemoryRequirement
    value: 1024  # 1GB

Expression context

Most SB tools may use a custom draft-2 expression engine (usually #cwl-js-engine). For this engine, in all expressions at runtime, $job variable is bound to an object with inputs property which holds the inputs for the run of the tool, as a map of port_id->value (without leading “#” on port ID).

Additionally, the $job object has the allocatedResources property which is an object with cpu and mem fields. These hold the allocated number of cores and megabytes of RAM.

Example $job:

  in_file: {"class": "File", "path": "/path/to/input.txt", "size": 42}
  in_str: "some input string"
  cpu: 1
  mem: 1024

Staging inputs

Inputs with non-null sbg:stageInput property imply that they should be staged to the working directory before evaluating expressions or running the command line. Valid values for this property are “link” or “copy”. The “copy” option should only be used if the tool modifies the file in-place.

For inputs with this property set, all files on that input will be linked or copied to the root of working directory, with the same original name. If there are any name conflicts, the job will fail. Also, the path property of these objects in the $job will be updated to refer to staged files.

File metadata

File objects may contain an additional property metadata, which is a Map<string, string>. If any tools make use of this property, they should have the class: sbg:MetadataRequirement listed in the requirements array.

To set the metadata map on output files, use the sbg:metadata property on the output binding. This should be a map, but you may also use expressions for values (the $self variable will refer to individual files captured by glob).

To inherit metadata from files on an input port, use the sbg:inheritMetadata property on output bindings. The value should be the input ID with leading “#”. In case of multiple input files on same port, the inherited metadata will only have the values common for all input files on that port.


  - id: out_file
      glob: *.ext
      sbg:inheritMetadata: "#in_file"
        fileFormat: tsv
        sampleName: {class: Expression, script: $self.path.split('/').pop().split('.').slice(-1)}