-1
$\begingroup$

I have a table containing different metadata information about a set of samples as an Array[Object] and I need to extract a couple of columns from this table and output those two columns into a file that will be read and used by the task. I wanted to know whether I can do this within a task rather than within a workflow, that is, without using the scatter construct which is not allowed inside a task.

If I zip two arrays I obtain an Array[Pair[String,String]] variable.

Now if I want to output to file an Array[Array[String]] I can use write_tsv(), if I want to output to file a Map[String,String] I can use write_map().

But WDL does not let me coerce Array[Pair[String,String]] to either Array[Array[String]] nor Map[String,String] (though I can coerce Map[String,String] to Array[Pair[String,String]]), so neither option is available.

Is there a solution to this that does not involve the scatter construct?

$\endgroup$
1
  • 1
    $\begingroup$ Hi @freeseek, could you please explain the biological relevance behind you informatics WDL question? Are you using BioWDL? $\endgroup$
    – M__
    Jun 16, 2020 at 2:37

1 Answer 1

0
$\begingroup$

write_json() is supposed to provide the general way to serialize any data structure for processing/manipulation in the task command script (perhaps leveraging jq). Unfortunately, last I heard, Cromwell's implementation doesn't work on some useful cases right now. (Possibly out of date; I haven't tried lately)

$\endgroup$
1
  • $\begingroup$ Just learned this yesterday: in the development version you could try to use as_map() and then write_map(). However, you have to assume that all the left element in the Array[Pair[String,String]] array are unique or as_map() will fail. $\endgroup$
    – freeseek
    Jun 17, 2020 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.