From 58769b587671bd8024782abe414394a8c2438ebb Mon Sep 17 00:00:00 2001 From: ArthurDeclercq Date: Mon, 30 Oct 2023 17:08:20 +0100 Subject: [PATCH 1/3] minor modification fixes and logging --- ms2rescore/parse_psms.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ms2rescore/parse_psms.py b/ms2rescore/parse_psms.py index e116c32f..ce0c968d 100644 --- a/ms2rescore/parse_psms.py +++ b/ms2rescore/parse_psms.py @@ -41,13 +41,29 @@ def parse_psms(config: Dict, psm_list: Union[PSMList, None]) -> PSMList: ) logger.debug("Parsing modifications...") + modifications_found = set( + [ + re.search(r"\[([^\[\]]*)\]", x.proforma).group(1) + for x in psm_list["peptidoform"] + if "[" in x.proforma + ] + ) + logger.debug(f"Found modifications: {modifications_found}") + non_mapped_modifications = modifications_found - set(config["modification_mapping"].keys()) + if non_mapped_modifications: + logger.warning( + f"Non-mapped modifications found: {non_mapped_modifications}\nThis can be ignored if Unimod modification label" + ) psm_list.rename_modifications(config["modification_mapping"]) psm_list.add_fixed_modifications(config["fixed_modifications"]) psm_list.apply_fixed_modifications() - logger.debug("Applying `psm_id_pattern`...") if config["psm_id_pattern"]: pattern = re.compile(config["psm_id_pattern"]) + logger.debug(f"Applying `psm_id_pattern`...") + logger.debug( + f"Parsing `{psm_list['spectrum_id'][0]}` to `{_match_psm_ids(psm_list['spectrum_id'][0], pattern)}`" + ) new_ids = [_match_psm_ids(old_id, pattern) for old_id in psm_list["spectrum_id"]] psm_list["spectrum_id"] = new_ids @@ -125,6 +141,6 @@ def _match_psm_ids(old_id, regex_pattern): return match[1] except (TypeError, IndexError): raise MS2RescoreConfigurationError( - "`psm_id_pattern` could not be matched to all PSM spectrum IDs." + f"`psm_id_pattern` could not be extracted from PSM spectrum IDs (i.e. {old_id})." " Ensure that the regex contains a capturing group?" ) From 30661c063e2a228d4b9a1655a6c9454db92ac54b Mon Sep 17 00:00:00 2001 From: ArthurDeclercq Date: Mon, 30 Oct 2023 17:08:28 +0100 Subject: [PATCH 2/3] dockerfile addition --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2fde54a8..f3fe2778 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,10 @@ ADD README.md /ms2rescore/README.md ADD MANIFEST.in /ms2rescore/MANIFEST.in ADD ms2rescore /ms2rescore/ms2rescore -RUN apt-get update && apt-get install python3-pip procps -y \ +RUN apt-get update +RUN apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6 + +RUN apt-get install python3-pip procps -y \ && rm -rf /var/lib/apt/lists/* \ && pip3 install ms2rescore/ From 8dda81f438ab2dac6502a0362b5cd459336298f7 Mon Sep 17 00:00:00 2001 From: RalfG Date: Mon, 30 Oct 2023 18:15:44 -0400 Subject: [PATCH 3/3] Merge dockerfile commands --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3fe2778..59fc4000 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,8 @@ ADD README.md /ms2rescore/README.md ADD MANIFEST.in /ms2rescore/MANIFEST.in ADD ms2rescore /ms2rescore/ms2rescore -RUN apt-get update -RUN apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6 - -RUN apt-get install python3-pip procps -y \ +RUN apt-get update \ + && apt-get install -y python3-pip procps libglib2.0-0 libsm6 libxrender1 libxext6 \ && rm -rf /var/lib/apt/lists/* \ && pip3 install ms2rescore/