I would like to extract a floating point value and pass it to the next task. Below is my Command Line tool description.
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.2
baseCommand: [samtools]
requirements:
ShellCommandRequirement: {}
inputs:
bam_input:
type: File
inputBinding:
position: 2
arguments:
- valueFrom: depth
position: 1
shellQuote: False
- valueFrom: "|"
position: 3
shellQuote: False
- valueFrom: awk
position: 4
shellQuote: False
- valueFrom: "'{sum+=$3} END { print sum/NR}'"
position: 5
shellQuote: False
outputs:
output_coverage_genome:
type: float
And this is my two task pipeline
coverage_genome:
run: tasks/genome_coverage_extract.cwl
in:
bam_input: bam_input
out: [output_coverage_genome]
reads_coverage:
run: tasks/next_task.cwl
in:
coverage: coverage_genome/output_coverage_genome
out: [outputs]
However I get the following error:
[2023-09-20T09:27:53-0600] [MainThread] [I] [cwltool] [job pipeline_.cwl.coverage_genome.coverage_genome_float.cwl] /tmpdir_cwl/tmp291u2x1k$ sh
coverage_genome.sh
49.6596
[2023-09-20T09:29:35-0600] [MainThread] [I] [cwltool] [job pipeline_.cwl.coverage_genome.coverage_genome_float.cwl] Max memory used: 11MiB
[2023-09-20T09:29:35-0600] [MainThread] [E] [cwltool] [job pipeline_.cwl.coverage_genome.coverage_genome_float.cwl] Job error:
Error validating output record. the āoutput_coverage_genomeā field is not valid because
the value āNoneā is not float or double
in {
āoutput_coverage_genomeā: null
}
Most examples in CWL are about passing files from one task to the next but I havenāt seen one passing a an int/float value.
I looked at this one Using floats / decimals as integers in a workflow and vice versa - #2 by mrc
but it is more about the input than output values.
I also looked at this post How to output non-file types from a CommandLineTool? but it is for v1.0 and Iām not sure if there is a more modern way to write the same example marked as a solution.
Most hello_world style examples in the documentation (if not all) are about passing files between tasks.
Thanks for your help!