Entering edit mode
5.5 years ago
dami
▴
10
How does one uses a secondairy file as the input to a command in CWL?
I try to do :
bedtools sort -header -faidx hg38.fasta.fai
So in CWL i got to
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
label: "sort a bed file based on occurrence in fasta"
requirements:
- class: DockerRequirement
dockerPull: "biocontainers/bedtools:v2.28.0_cv2"
baseCommand: ["bedtools", "sort", "-header"]
stdout: $(inputs.output_name)
inputs:
input_bed:
type: File
inputBinding:
position: 2
prefix: -i
reference_genome:
type: File
secondaryFiles:
- .fai
inputBinding:
position: 1
prefix: -faidx
valueFrom: {$(inputs.reference_genome.basename).fai}
output_name:
type: string?
default: sorted_coverage.bed
outputs:
sorted_bed:
type: stdout
But that does not work for the ValueFrom method under reference_genome/inputbinding.
Does anyone know how to do this?
I have not yet used bedtools, so i'm not sure i understand correctly. Can you spell out the names of the files which bedtools needs to access for the line you have given in the beginning? I guess one is
g38.fasta.fai
. But what are the names of the other files?You are right, the bed file to be sorted needs to be added to the command at the top with the -i flag so that you get:
bedtools sort -header -faidx ref.fasta.fai -i some.bed
If the command that you are trying to produce is
bedtools sort -header -faidx hg38.fasta.fai
it looks like you don't needsecondaryFiles
at all. You should just be able to pass inhg38.fasta.fai
as your input file.Thanks for your response! What you are saying is true, However, if this is part of a bigger pipeline where the .fai is also needed as a fasta index file its repetitive to add it everywhere manually. So I was hoping that there was a way to access the secondary files directly.