Heads up:
We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
Update: July 26, 2019
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.
Using wdl when output filenames depend on input filenames

Hi all,
I was wondering if there is a way to use wdl with programs that do not allow users to specify an output file.
We use a couple of bash commands to generate all the required index files for our analysis, and right now we have to manually include all index files in the .json file.
$ file=NC_011083.fasta $ dict_file=${file%fasta}dict $ picard-tools CreateSequenceDictionary R=$file O=$dict_file $ samtools faidx $file $ bwa index $file
Generated index files:
NC_011083.dict NC_011083.fasta.amb NC_011083.fasta.bwt NC_011083.fasta.pac NC_011083.fasta NC_011083.fasta.ann NC_011083.fasta.fai NC_011083.fasta.sa
NC_011083.dict
gives the problem, since it wants to replace the extension, instead of just adding to it. Replacing the extension is of course the default behavior of many programs, how can we deal with this when using WDL?
Tagged:
Answers
You can use the
sub()
function to replace extensions. I went into a bit more detail on it here. We do use this function in our pipeline to help with replacing file extensions.