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
15 changes: 12 additions & 3 deletions quantmsutils/diann/diann2msstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _parse_unified_design(exp_design_file):

# Validate required columns
required_cols = {
"Filename", "Fraction", "Sample", "Condition", "BioReplicate", "Label", "LabelType"
"Filename", "Fraction", "Sample", "Condition", "BioReplicate"
}

missing = required_cols - set(df.columns)
Expand All @@ -179,16 +179,25 @@ def _parse_unified_design(exp_design_file):
df["run"] = df["Filename"].apply(_true_stem)

# Multiplexing
if df["Label"].nunique() > 1:
if "Label" in df.columns and df["Label"].nunique() > 1:
labels_lower = df["Label"].astype(str).str.lower()

if "silac" in df["LabelType"].values:
if labels_lower.str.contains("silac").any():
silac_dict = {
"SILAC light": "L",
"SILAC medium": "M",
"SILAC heavy": "H",
}
df["Label"] = df["Label"].replace(silac_dict)

if labels_lower.str.contains("mtraq").any():
mtraq_dict = {
"MTRAQ0": "0",
"MTRAQ4": "4",
"MTRAQ8": "8",
}
df["Label"] = df["Label"].replace(mtraq_dict)

f_table = df[["Filename", "Fraction", "Sample", "run", "Label"]].copy()
else:
f_table = df[["Filename", "Fraction", "Sample", "run"]].copy()
Expand Down