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

String? type in output section

My task defines an input String? sample_id which is then used in interpolating output filepaths
File metrics = "${sample_id}.metrics.tsv"

If I assign a value to that argument, say "Foo", the result filepath is
/.../"Foo".metrics.tsv (which does not exist)

However, if I change the type to required (String sample_id) the filepath becomes
/.../Foo.metrics.tsv (which is what I expected to get even when the parameter was optional)

Answers

  • RuchiRuchi Member, Broadie, Dev

    Hey @agraubert , can you share how you are interpolating String? sample_id inside your command block?

  • ChrisLChrisL Cambridge, MAMember, Broadie, Dev

    I was able to reproduce this issue with the following full WDL:

    workflow foo {
      call bar { input: output_prefix = "test" }
    }
    
    task bar {
      String? output_prefix
      command {
        echo foo > output_prefix_out
      }
      output {
        File out = "${output_prefix}_out"
      }
    }
    
    

    It looks like a problem that only manifests when the interpolation is outside the command block. I'll get this fixed for the next Cromwell version.

    In the meantime you should be able to make this work with the following workaround that makes a string out of the optional in the same way that string interpolation would do:

    workflow foo {
      call bar #{ input: output_prefix = "test" }
    }
    
    task bar {
      String? output_prefix
      String real_output_prefix =  select_first([output_prefix, ""])
      command {
        echo foo > ${real_output_prefix}_out
      }
      output {
        File out = "${real_output_prefix}_out"
      }
    }
    
    
  • ChrisLChrisL Cambridge, MAMember, Broadie, Dev

    A fix for this is coming in via https://github.com/broadinstitute/cromwell/pull/2689

    I suggest you stick to the workaround above until you see Cromwell 30 released in about a month though. Our develop branch is currently undergoing some major refactoring so might not be very stable right now!

    Thanks for the bug report!

Sign In or Register to comment.