Calling sub() on a (localized) File


I'm running a workflow on the AWS Batch back end.

There is an input File whose name and value in my input.json is something like this:

"ref_fasta": "s3://bucket-name/hackathon2018/bundle/hg38/Homo_sapiens_assembly38.fasta.gz",

Inside the workflow if I refer to ${ref_fasta} in a command {} section it expands to:


I would like to take that representation and run sub() on it, removing the .gz extension.
I tried this:

String ref_fasta_without_suffix = sub(ref_fasta, ".gz", "")

The problem is that the sub() operation appears to work on the original S3 URL form of ref_fasta, so it ends up looking like this:

echo ${ref_fasta_without_suffix}

Prints out:


When what I wanted was:


Is there a way to specify the file system representation of a File when running something like sub()?

Best Answer


  • dtenenbadtenenba Member
    Accepted Answer

    Worked around this by making the change in bash, not in wdl:

    gunzip ${ref_fasta}
    gunzipped_ref_fasta=$(echo ${ref_fasta} | sed "s/\.gz//")
    echo $gunzipped_ref_fasta
  • ChrisLChrisL Cambridge, MAMember, Broadie, Moderator, Dev admin

    @dtenenba I suspect that if you called sub within an expression placeholder (${}) inside the command block you'd get what you wanted - but I like your way better tbh since it's guaranteed to be working on the right file path for that VM

Sign In or Register to comment.