To celebrate the release of GATK 4.0, we are giving away free credits for running the GATK4 Best Practices pipelines in FireCloud, our secure online analysis portal. It’s first come first serve, so sign up now to claim your free credits worth $250. Sponsored by Google Cloud. Learn more at https://software.broadinstitute.org/firecloud/documentation/freecredits

Bug: Cromwell removes empty spaces from WDL when creating exec.sh

yfarjounyfarjoun Broad InstituteDev

This doesn't sound like a bug, but it means that the following task is edited prior to submission:

workflow hello {

    call HelloWorld{}

}

task HelloWorld {
    command{
        echo "hello

        and

        goodbye." 

        cat <<EOF
        Line1

        Line2

        Line3
        End
        EOF

    }

    runtime {
      docker: "python:2.7"
      memory: "1 GB"
    }

    output {
        String out = read_string(stdout())
    }
}

The resulting exec.sh is:

#!/bin/bash
tmpDir=$(mktemp -d /cromwell_root/tmp.XXXXXX)
chmod 777 $tmpDir
export _JAVA_OPTIONS=-Djava.io.tmpdir=$tmpDir
export TMPDIR=$tmpDir

(
cd /cromwell_root
echo "hello
and
goodbye." 
cat <<EOF
Line1
Line2
Line3
End
EOF
)
echo $? > /cromwell_root/HelloWorld-rc.txt.tmp
(
cd /cromwell_root

)
sync
mv /cromwell_root/HelloWorld-rc.txt.tmp /cromwell_root/HelloWorld-rc.txt

which is missing the empty lines I wanted to have in my "echo" and "cat" commands!

My guess is was considered a feature that by removing the empty lines you can be agnostic to them during call-caching, but this insiduous: it makes it difficult to have empty lines in strings in one's methods. I consider this overly intrusive and would rather have a new-line edit invalidate call-caching than be subjected to manipulation of my carefully crafted command-block.

Removing empty lines can cause other

command<<<
echo hello \

echo goodbye
>>>

will either result in
"hello echo goodbye"
or in
"hello
goodbye"

Depending on that empty space....(you might argue that the author should have removed the training '\' and I would argue back that my coding style is none of your business....)

Tagged:

Best Answer

Answers

Sign In or Register to comment.