We've moved!
For WDL questions, see the WDL specification and WDL docs.
For Cromwell questions, see the Cromwell docs and please post any issues on Github.

Use complex bash inside cromwell?

I'm trying to use bash arrays inside a command block, but I think this confuses womtool because the validation failes. Did I make some mistake I'm overlooking or is this a known limitation of wdl?

(As background: I'm trying to make an htmlOverview task that uses iframes to put multiple html files inside a single page to make it easier to view html results)

$ womtool validate shared.wdl 
Unrecognized token on line 80, column 23:

        for ((i=0;i<${#files[@]};++i)); do
                      ^
task htmlOverview {
    Array[File] htmlFiles
    Array[String] samplenames
    String name

    String image

    command {
        set -e
        overview="${name}_overview.html"

        files=( ${sep=" " htmlFiles} )
        names=( ${sep=" " samplenames} )
        # Print the iframes
        for ((i=0;i<${#files[@]};++i)); do
            local=`basename "${files[i]}"`
            filename="${name}_$local"
            cp "$i" "$filename"
            echo "<h2>${names[i]}</h2>"
            echo "<iframe id="myFrame" src=\"$filename\" style=width:100%;height:100%></iframe>"
        done > "${name}_overview.html"
    }

    runtime {
        docker: "${image}"
    }

    output {
        File overview = "${name}_overview.html"
        Array[File] subplots = glob("*.html")
    }
}
Tagged:
Sign In or Register to comment.