Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow custom placeholder for missing data in tsv_join task #227

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion pipes/WDL/tasks/tasks_reports.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ task tsv_join {
Array[File]+ input_tsvs
String id_col
String out_basename = "merged"
String placeholder_for_missing = ""
}

command <<<
Expand Down Expand Up @@ -431,7 +432,7 @@ task tsv_join {
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):
tomkinsc marked this conversation as resolved.
Show resolved Hide resolved
row_out[h] = row.get(h, '')
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
3 changes: 2 additions & 1 deletion pipes/WDL/workflows/sarscov2_nextstrain.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ workflow sarscov2_nextstrain {
input:
input_tsvs = sample_metadata_tsvs,
id_col = 'strain',
out_basename = "metadata-merged"
out_basename = "metadata-merged",
placeholder_for_missing = "?"
}
}
call nextstrain.derived_cols {
Expand Down