This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL: Is there a way to output an output file with one of the inputs of the tool in a Record type?

I'm looking to do something like the following:

cwlVersion: v1.0
class: CommandLineTool

requirements:
 - class: InlineJavascriptRequirement
 - $import: Types.cwl

...

inputs: 
  an_input: string

outputs:
  an_output:
    type: 'Types.cwl#SpecialType'
    outputSource:
      valueFrom: ${
        return {
          'output_file': glob('the_tools_output.file'),
          'this_should_be_associated_with_the_file_in_a_later_step': inputs.an_input
        }
    }

Is this possible? I see a possible solution here using an ExpressionTool

https://github.com/andersgs/cwl_flows/blob/master/limit_detection/seqtk_sample_PE.cwl

But I was wondering if it could be done inline in the tool output.

cwl

1 answer

That should be possible, however the syntax for the output would look like this:

outputs:
  an_output:
    type: 'Types.cwl#SpecialType'
    outputBinding:
      glob: something
      outputEval: |-
        ${
                return {
                  'output_file': self,
                  'this_should_be_associated_with_the_file_in_a_later_step': inputs.an_input
                  }
              }

In the expression for outputEval, self has the value of whatever is caught by glob pattern.

Log in to answer this question.