task places output in cromwell inputs dir, how to access it and define it as task output

As part of the workflow, I want to create a samtools .fai file for my reference genome and use the resulting .fai file in subsequent tasks. I create .fai with samtools:

samtools faidx /path/to/my/genome.fa

There is however no way to specify an output (no option to specify output file name or write to stdout). Samtools wil create the .fai file in the directory where the myGenome.fa is located, so it will create /path/to/my/genome.fa.fai. When I run my widdle workflow (local backend, run mode), cromwell will copy /path/to/my/genome.fa to an inputs-directory, and samtools will therefore write the .fai file to the inputs-directory directory as well. How can I define the .fai file (pointing to the samtools faidx output) as output of my task? My task currently looks something like:

task createSamIndex {
  File inputFasta
  command {
    samtools faidx ${inputFasta}
  output {
    File fasta_fai = "${inputFasta}.fai" #<-- this will point to /path/to/my/genome.fa.fai, which does not exist!

But the output in varialbe fasta_fai, will point to /path/to/my/genome.fa.fai, which does not exist, because the .fai file was placed in the cromwell inputs-dir for the createSamIndex task

Best Answer


  • Irsan_KooiIrsan_Kooi Member

    Thanks, that is indeed the solution. What does ./ mean in ./${fastaName}? Forcing it to point to the execution directory of the current task?

  • ChrisLChrisL Cambridge, MAMember, Broadie, Moderator, Dev

    I guess that ./ is probably not necessary since yes, it just refers to the current working directory

Sign In or Register to comment.