Skip to content
Merged
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
7 changes: 6 additions & 1 deletion scallops/cli/pooled_if_sbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def _rename_unique(columns, unique_values, prefix):
replace_chars = " |-"
for value in columns:
new_value = value
new_value = re.sub(replace_chars, "_", new_value)
if value in unique_values:
new_value = f"{value}_{prefix}"
if new_value in unique_values:
Expand All @@ -489,7 +490,7 @@ def _rename_unique(columns, unique_values, prefix):
while new_value in unique_values:
counter += 1
new_value = f"{value}_{prefix}_{counter}"
new_value = re.sub(replace_chars, "_", new_value)

if value != new_value:
rename[value] = new_value

Expand Down Expand Up @@ -614,6 +615,10 @@ def merge_sbs_phenotype_pipeline(
df_phenotype = pd.concat(df_phenotypes, axis=1, join=join_phenotype)
elif len(df_phenotypes) == 1:
df_phenotype = df_phenotypes[0]
if df_phenotype is not None:
assert not df_phenotype.columns.has_duplicates, (
f"Duplicate columns: {', '.join(df_phenotype.columns[df_phenotype.columns.duplicated()].to_list())}"
)
if df_labels is not None and df_phenotype is not None and df_barcode is not None:
merged_df = merge_sbs_phenotype(
df_labels=df_labels,
Expand Down