diff --git a/pyproject.toml b/pyproject.toml index 8ea8d5b..f047cde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,10 @@ keywords = [ "proteomics", "mass-spectrometry", "data-analysis", - "big data" + "big data", + "sdrf", + "sample-metadata", + "proteomics-pipeline" ] classifiers = [ "Intended Audience :: Science/Research", @@ -34,10 +37,11 @@ dependencies = [ ] [project.urls] +Homepage = "https://quantms.org" +Documentation = "https://docs.quantms.org" GitHub = "https://github.com/bigbio/quantms-utils" -PyPi = "https://pypi.org/project/quantms-utils/" -Quantms = "https://quantms.org" -LICENSE = "https://github.com/bigbio/quantms-utils/blob/main/LICENSE" +"Bug Tracker" = "https://github.com/bigbio/quantms-utils/issues" +PyPI = "https://pypi.org/project/quantms-utils/" [project.scripts] quantmsutilsc = "quantmsutils.quantmsutilsc:main" diff --git a/quantmsutils/diann/diann2msstats.py b/quantmsutils/diann/diann2msstats.py index d2903b0..0d238ea 100644 --- a/quantmsutils/diann/diann2msstats.py +++ b/quantmsutils/diann/diann2msstats.py @@ -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) @@ -179,9 +179,10 @@ 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", @@ -189,6 +190,14 @@ def _parse_unified_design(exp_design_file): } 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() diff --git a/tests/test_commands.py b/tests/test_commands.py index 021d5a1..79a1e89 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -378,9 +378,9 @@ def test_unified_format_validates_sample_consistency(self): with tempfile.TemporaryDirectory() as tmpdir: bad_file = os.path.join(tmpdir, "inconsistent_design.tsv") with open(bad_file, "w") as f: - f.write("Filename\tSample\tFraction\tCondition\tBioReplicate\n") - f.write("file1.raw\t1\t1\tCondA\t1\n") - f.write("file2.raw\t1\t1\tCondB\t2\n") # Same Sample, different Condition + f.write("Filename\tSample\tFraction\tCondition\tBioReplicate\tLabel\tLabelType\n") + f.write("file1.raw\t1\t1\tCondA\t1\tlabel free sample\tlabel free\n") + f.write("file2.raw\t1\t1\tCondB\t2\tlabel free sample\tlabel free\n") # Same Sample, different Condition with pytest.raises(ValueError, match="Inconsistent"): get_exp_design_dfs(bad_file)