Heads up:
We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
Update: July 26, 2019
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.

getting keys and values from a map?

yfarjounyfarjoun Broad InstituteDev ✭✭✭

Hi I have a wdl Map[String, String] and I'd like to get the list of key and the list of values as two Arrays:

Array[String] keys=keys(map) or map.keys
Array[String] values=values(map) map.values

I don't think I can do this.

While I could write a workflow to extract the keys or the values:

workflow getMapKeys {
    Map[String, String] map

    scatter(pair in map) {
        String value = pair.left
    output {
        Array[String] keys = value

I would prefer this to be a builtin function since otherwise I need to write this workflow for every type of map that I need it for. so for example, I actually need it for a Map[String,Map[String,Array[String]]]....

Is this in the works? Is there a better way to do this?



Sign In or Register to comment.