I have a CWL file which has bam
file as one of the inputs and takes bai
file as secondary files. The script as CommandLineTool
works and gives results when run in cwl-runner.
cat degradation.cwl
cwlVersion: v1.0
class: CommandLineTool
baseCommand: [python, degradation.py]
inputs:
annotation:
type: File
inputBinding:
position: 2
prefix: -a
bam:
type: File
inputBinding:
position: 1
prefix: -n
secondaryFiles: .bai
Now I would like to add this script as one of the steps in the workflow. How can this be done ?
cat workflow.cwl
cwlVersion: v1.0
class: Workflow
inputs:
------
------
outputs:
alignment_out:
type: File
outputSource: star/star_bam
steps:
star:
run: star.cwl
in: ---
-------
out: [star_bam]
bam_indexing:
run: index_bam.cwl
in:
bam: star/star_bam
out: [bai]
rna_degradation:
run: degradation.cwl
in:
annotation: annotation
bam: star/star_bam
bai: bam_indexing/bai
Error
expects secondaryFiles: .bai but
source 'star_bam' does not include secondaryFiles.
To fix, add secondaryFiles: .bai to definition of 'star_bam'.
The star_bam
is an output from the step star
and bai
is an output from another step bam_indexing
.
In that case, how could bai
be given as an input(secondaryFile) to the step rna_degradation
Option 1 The script used in
degradation.cwl
does not have an option to givebai
files as an input explicitly. It rather needs/searches for thebai
file within the same path where thebam
file exists. Hence givingbai
as secondary file worked.Option 2 Trial
index_bam.cwl
only returns abai
file and does not return anybam
file. So givingbam
as output would not work I guess. Anyways I tried and the results have been pasted down.index_bam.cwl (Working code)
index_bam.cwl (NOT Working code)
ERROR
Try adding an initial work dir requirement
index_bam.cwl (NOT Working code)
As another note, if you are using commonly used bioinformatics tools, it may be useful for you to try one of the prewritten CWL scripts here: https://github.com/common-workflow-language/workflows/tree/master/tools for your tools to hopefully make things run well without too much effort on your end. There is even a
samtools-index.cwl
available.Yes, makes sense to use the pre-written codes. Thank you !!
By adding
InitialWorkDirRequirement
, the scriptindex_bam.cwl
could capturebam
andbai
outputscat index_bam.cwl
But still have problems in the workflow when trying to input the
secondary
file outputs from the stepbam_indexing
to the steprun_degradation
The step
run_degradation
is still asking forbai
inputcat workflow.cwl
workflow.cwl:149:3: Step is missing required parameter 'bai'
Line 149 is the line with
in:
of the stepdegradation.cwl
in theworkflow.cwl
In your
degradation.cwl
script remove thebai
entry underinputs
Ah.... my bad. I thought I removed it, but hadn't.
With that line removed it works. Thank you...