Issue processing arrays in which entries have spaces.
I've uploaded a data table to my Terra workspace and some of the entries have spaces in them. Here is a json file that emulates two columns from that data.
{
"main.Geo_Level": [
"Municipality 2",
"Municipality 3",
"Municipality 4"
],
"main.Temp_Level": [
"August",
"September",
"January"
]
}
I haven't been unable to figure out how to make WDL distinguish from spaces between elements in the array and spaces WITHIN elements of the array. For example, running the following wdl
cromwell run wdl_example.json -i example.json
version 1.0
workflow main {
input {
Array[String] Geo_Level
Array[String] Temp_Level
}
call test {
input:
Geo_Level = Geo_Level,
Temp_Level = Temp_Level
}
output {
File example_f = test.example
}
}
task test {
input {
Array[String] Geo_Level
Array[String] Temp_Level
}
command <<<
Geo_Level_Array=(~{sep = ' ' Geo_Level})
for (( i = 0; i < ${#Geo_Level_Array[@]}; i++ )); do
echo "${Geo_Level_Array[i]}" >> example.csv
done
>>>
output {
File example = "example.csv"
}
}
will produce the following output:
example.csv
Municipality
2
Municipality
3
Municipality
4
But I am aiming to get:
example.csv
Municipality 2
Municipality 3
Municipality 4
so that entries can be paired with other arrays of equal length. For example:
example.csv
Municipality 2,August
Municipality 3,September
Municipality 4,January
Is there a way to generate this behavior in WDL. Unfortunately, the entries in the data table cannot be modified because they are made to match a public database in which the spaces are included.
Comments
0 comments
Please sign in to leave a comment.