Running steps conditional on output files not existing


I have a pretty simple pipeline (GitHub - mw55309/cwl_rna_seq: A very basic CWL RNA-Seq workflow using Kallisto) which downloads a fasta file and indexes it (using Kallisto), then downloads some FASTQ data, and quantifies the FASTQ against the index

What I want is to only run the fasta or fastq download steps if the files don’t already exist, and to only create the index if the index file doesn’t exist.

I had thought to use “when:” condition with some javascript to check file.exists() but it’s currently beyond my skillset

Any help appreciated


Welcome @mw55309 !

Lets start with this phrase: if the files don’t already exist.

Unlike (snake)make, the CWL model of a workflow does not look at hypothetical files you have locally on disk. Everything must be explicit.

So you could have an optional input of “file already available”, and then your when clause would look to see if that input exists.