This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL: Is there a way to only pass certain fields from a `record` type to a step?

Is there a way to only pass certain fields from a record type to a step? As opposed to the whole record object?

This is my best guess, but I was wondering if there was a cleaner way:

inputs:
  samples:
    type:
      type: array
      items:
        type: record
        fields:
          fastq1: File
          fastq2: File
          SM: string

steps:
  step_1: 
    in:
      samples: samples
    out: [bams]

  step_2:
    in:
      bams: step_1/bams
      SM: 
        valueFrom: ${ return inputs.samples.map(function(x) { return x.SM }) }
    out: [changed_bams]
cwl

Yes exactly, for the purpose of not having to list all the fields from the record type at each subworkflow layer of inputs

1 answer

You almost have it:

steps:
  step_2:
    in:
      SM:
        source: samples
        valueFrom: ${ return self.map(function(x) { return x.SM })

Log in to answer this question.