Skip to content

Commit

Permalink
fix private_id column bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sage-wright committed Sep 19, 2023
1 parent deb67ef commit 712bb89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tasks/utilities/task_czgenepi_wrangling.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ task czgenepi_wrangling {
table = table.fillna("")
# extract metadata to new table
print("DEBUG: copying required metadata columns")
print("DEBUG: copying require metadata columns")
metadata = table[REQUIRED_COLUMNS].copy()
print("DEBUG: copying optional metadata columns")
for column in OPTIONAL_COLUMNS:
if column in table.columns:
metadata[column] = table[column]
else:
if column == "sample_is_private":
# by default, all samples will be set as private
Expand All @@ -79,6 +80,8 @@ task czgenepi_wrangling {
print("DEBUG: checking if private_id column was set")
if "~{private_id_column_name}" == "~{terra_table_name}_id":
print("DEBUG: removing duplicated column")
metadata = metadata.loc[:, ~metadata.columns.duplicated()].copy()
metadata["Private ID"] = metadata.loc[:, "~{private_id_column_name}"]
else:
metadata.rename(columns={"~{private_id_column_name}": "Private ID"}, inplace=True)
Expand Down

0 comments on commit 712bb89

Please sign in to comment.