From a711aff65659688e5c3831456c4cd744b41ed806 Mon Sep 17 00:00:00 2001 From: mschwoerer <82171591+mschwoer@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:51:23 +0100 Subject: [PATCH] add again what was lost by the failed merge commit 97613f1336eca33fd74309d2bdbdd60f8b6e926d --- .bumpversion.cfg | 2 +- alphabase/__init__.py | 2 +- alphabase/psm_reader/maxquant_reader.py | 18 ++++++++++++++++++ docs/conf.py | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b55048b4..37587c45 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.4.0 +current_version = 1.4.1 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)(?P\d+))? diff --git a/alphabase/__init__.py b/alphabase/__init__.py index 006941da..86008ce9 100644 --- a/alphabase/__init__.py +++ b/alphabase/__init__.py @@ -2,7 +2,7 @@ __project__ = "alphabase" -__version__ = "1.4.0" +__version__ = "1.4.1" __license__ = "Apache" __description__ = "An infrastructure Python package of the AlphaX ecosystem" __author__ = "Mann Labs" diff --git a/alphabase/psm_reader/maxquant_reader.py b/alphabase/psm_reader/maxquant_reader.py index 1a62c392..87da6bda 100644 --- a/alphabase/psm_reader/maxquant_reader.py +++ b/alphabase/psm_reader/maxquant_reader.py @@ -1,4 +1,5 @@ import copy +import warnings from typing import Optional import numba @@ -13,6 +14,9 @@ psm_reader_yaml, ) +# make sure all warnings are shown +warnings.filterwarnings("always") + mod_to_unimod_dict = {} for mod_name, unimod_id in MOD_DF[["mod_name", "unimod_id"]].values: unimod_id = int(unimod_id) @@ -249,6 +253,20 @@ def _load_file(self, filename): self._find_mod_seq_column(df) df = df[~pd.isna(df["Retention time"])] df.fillna("", inplace=True) + + # remove MBR PSMs as they are currently not supported and will crash import + mapped_columns = self._find_mapped_columns(df) + if "scan_num" in mapped_columns: + scan_num_col = mapped_columns["scan_num"] + no_ms2_mask = df[scan_num_col] == "" + if (num_no_ms2_mask := np.sum(no_ms2_mask)) > 0: + warnings.warn( + f"Maxquant psm file contains {num_no_ms2_mask} MBR PSMs without MS2 scan. This is not yet supported and rows containing MBR PSMs will be removed." + ) + df = df[~no_ms2_mask] + df.reset_index(drop=True, inplace=True) + df[scan_num_col] = df[scan_num_col].astype(int) + # if 'K0' in df.columns: # df['Mobility'] = df['K0'] # Bug in MaxQuant? It should be 1/K0 # min_rt = df['Retention time'].min() diff --git a/docs/conf.py b/docs/conf.py index 8cd3bdfa..687c35f7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ copyright = "2022, Mann Labs, MPIB" author = "Mann Labs, MPIB" -release = "1.4.0" +release = "1.4.1" # -- General configuration ---------------------------------------------------