Usage of WDL objects and the read_objects function

Hi! I recently started trying out cromwell and was having trouble trying out the read_objects feature of the WDL specification. I created this example WDL (x-test.wdl) :

task hello {
    Object SampleAttrs
    String sample = SampleAttrs.sample
    String bamPath = SampleAttrs.bamPath

    command {
        /bin/echo "Sample: ${sample} | Bam: ${bamPath}"
    }

    output {
        File response = stdout()
    }
}

workflow xtest {
    Array[Object] AllSampleAttrs = read_objects("./multi-attributes.tsv")

    scatter (attrs in AllSampleAttrs) {
        call hello { input:
            SampleAttrs=attrs
        }
    }
}

with the following multi-attributes.tsv file:

sample  bamPath attr1   attr2   attr3
smpl-1  /path/to/sample1.bam    a       b       c
smpl-2  /path/to/sample2.bam    d       e       f
smpl-3  /path/to/sample3.bam    g       h       i

and ran the WDL as follows:

java -jar cromwell-0.20-e5901ff-SNAPSHOT.jar run x-test.wdl - - xtest.meta.json

and got an error like so:

Unable to load namespace from workflow: ERROR: Variable does not reference any declaration in the task (line
3, col 33):

    String sample = SampleAttrs.sample

Am I interpreting and using the WDL Object specification type and read_objects function incorrectly?

Tagged:

Best Answer

Answers

Sign In or Register to comment.