Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pipes/WDL/tasks/tasks_utils.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ task tsv_join {
Array[File]+ input_tsvs
String id_col
String out_basename = "merged"
String placeholder_for_missing = ""
}

command <<<
Expand Down Expand Up @@ -210,8 +211,8 @@ task tsv_join {
row_out = out_row_by_id.get(row_id, {})
for h in header:
# prefer non-empty values from earlier files in in_tsvs, populate from subsequent files only if missing
if not row_out.get(h):
row_out[h] = row.get(h, '')
if row_out.get(h, '~{placeholder_for_missing}') == '~{placeholder_for_missing}':
row_out[h] = row.get(h, '~{placeholder_for_missing}')
out_row_by_id[row_id] = row_out
out_ids.append(row_id)
out_ids = list(collections.OrderedDict(((i,0) for i in out_ids)).keys())
Expand Down
7 changes: 4 additions & 3 deletions pipes/WDL/workflows/sarscov2_nextstrain.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ workflow sarscov2_nextstrain {
if(length(sample_metadata_tsvs)>1) {
call utils.tsv_join {
input:
input_tsvs = sample_metadata_tsvs,
id_col = 'strain',
out_basename = "metadata-merged"
input_tsvs = sample_metadata_tsvs,
id_col = 'strain',
out_basename = "metadata-merged"
placeholder_for_missing = "?"
}
}
call nextstrain.derived_cols {
Expand Down