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

Can I grab single outputs from a scatter block by index?

LeeTL1220LeeTL1220 Arlington, MAMember, Broadie, Dev
edited December 2017 in Ask the WDL team

I have a scatter block. I need to grab the outputs from two iterations of the scatter block and run only those in their own task. However, I cannot figure out what is the correct way to do this.

The following gives me a validation error:

workflow foo {
    Array[Int] reproducibility_indexes = [5, 10]
    ....snip...
    scatter (i in range(length(tumor_bam_files))) {
        call cnv_validation.CNVValidation as cnvValidation {
            input:
            ....snip....
        }
    } 
    # end of scatter loop
        call ReproducibilityValidation {
            input:
                called_segs_hcc1143t_1 = cnvValidation[reproducibility_indexes[0]].combined_seg_cr_calls_file,
                called_segs_hcc1143t_2 = cnvValidation[reproducibility_indexes[1]].combined_seg_cr_calls_file,
                ....snip....

}
ERROR: Unexpected symbol (line 107, col 79) when parsing 'e'.

Expected rsquare, got [.

                called_segs_hcc1143t_1 = cnvValidation[reproducibility_indexes[0]].combined_seg_cr_calls_file,
                                                                              ^

$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )

Even if I change to

                called_segs_hcc1143t_1 = cnvValidation.combined_seg_cr_calls_file[reproducibility_indexes[0]],
                called_segs_hcc1143t_2 = cnvValidation.combined_seg_cr_calls_file[reproducibility_indexes[1]],

I get a similar validation error:

ERROR: Unexpected symbol (line 107, col 106) when parsing 'e'.

Expected rsquare, got [.

                called_segs_hcc1143t_1 = cnvValidation.combined_seg_cr_calls_file[reproducibility_indexes[0]],
                                                                                                         ^

$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )

Is there a way to do this? Apologies if there is something obvious that I am missing.

Answers

  • ChrisLChrisL Cambridge, MAMember, Broadie, Dev
    edited December 2017

    Unfortunately putting expressions in an array accesser is a known bug in Cromwell's WDL parser.

    As a workaround until that issue gets fixed, you should be able to determine the index outside of the array index and then pass in the result, like:

    Int index1 = reproducibility_indexes[0]
    Int index2 = reproducibility_indexes[1]
    call ReproducibilityValidation {
      input:
        called_segs_hcc1143t_1 = cnvValidation.combined_seg_cr_calls_file[index1],
        called_segs_hcc1143t_2 = cnvValidation.combined_seg_cr_calls_file[index2]
    
  • LeeTL1220LeeTL1220 Arlington, MAMember, Broadie, Dev
Sign In or Register to comment.