From 5ddc77868fd10e1bcd7e47936729341ab17a02d0 Mon Sep 17 00:00:00 2001 From: Ludwig Lautenbacher Date: Fri, 15 Dec 2023 18:26:59 +0100 Subject: [PATCH 1/4] Read instrument_type from mzml --- spectrum_io/raw/msraw.py | 2 ++ spectrum_io/spectral_library/spectronaut.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spectrum_io/raw/msraw.py b/spectrum_io/raw/msraw.py index 578aca0..9e977eb 100644 --- a/spectrum_io/raw/msraw.py +++ b/spectrum_io/raw/msraw.py @@ -217,6 +217,7 @@ def _read_mzml_pyteomics(file_list: List[Path], *args, **kwargs) -> pd.DataFrame logger.info(f"Reading mzML file: {file_path}") data_iter = mzml.read(source=str(file_path), *args, **kwargs) file_name = file_path.stem + instrument_name = list(data_iter.get_by_id("commonInstrumentParams").keys())[1] for spec in data_iter: if spec["ms level"] != 2: continue # filter out ms1 spectra if there are any @@ -250,6 +251,7 @@ def _read_mzml_pyteomics(file_list: List[Path], *args, **kwargs) -> pd.DataFrame mass_analyzer.get(instrument_configuration_ref, "unknown"), fragmentation, collision_energy, + instrument_name ] data_iter.close() data = pd.DataFrame.from_dict(data_dict, orient="index", columns=MZML_DATA_COLUMNS) diff --git a/spectrum_io/spectral_library/spectronaut.py b/spectrum_io/spectral_library/spectronaut.py index 6d725c8..ff69396 100644 --- a/spectrum_io/spectral_library/spectronaut.py +++ b/spectrum_io/spectral_library/spectronaut.py @@ -111,7 +111,8 @@ def prepare_spectrum(self): inter_df["iRT"] = irt.tolist() if len(list(self.grpc_output)) > 2: inter_df["proteotypicity"] = proteotypicity.tolist() - inter_df["intensities"], inter_df["fragment_mz"] = intensities.tolist(), fragment_mz.tolist() + inter_df["intensities"] = intensities.tolist() + inter_df["fragment_mz"] = fragment_mz.tolist() inter_df["fragment_types"] = fragment_types.tolist() inter_df["fragment_numbers"] = fragment_numbers.tolist() inter_df["fragment_charges"] = fragment_charges.tolist() From 44ccf6a4aa601d4073127784d5af82ef7be85c5e Mon Sep 17 00:00:00 2001 From: Mario Picciani Date: Mon, 18 Dec 2023 18:01:18 +0100 Subject: [PATCH 2/4] Bump version from 0.3.4 to 0.4.0 --- .cookietemple.yml | 2 +- .github/release-drafter.yml | 4 ++-- cookietemple.cfg | 2 +- docs/conf.py | 4 ++-- pyproject.toml | 4 ++-- spectrum_io/__init__.py | 2 +- spectrum_io/__main__.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.cookietemple.yml b/.cookietemple.yml index c761a22..020a02e 100644 --- a/.cookietemple.yml +++ b/.cookietemple.yml @@ -15,5 +15,5 @@ full_name: Mario Picciani email: mario.picciani@tum.de project_name: spectrum_io project_short_description: IO related functionalities for oktoberfest. -version: 0.3.4 +version: 0.4.0 license: MIT diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6a52a46..df0356f 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "0.3.4 🌈" # <> -tag-template: 0.3.4 # <> +name-template: "0.4.0 🌈" # <> +tag-template: 0.4.0 # <> exclude-labels: - "skip-changelog" diff --git a/cookietemple.cfg b/cookietemple.cfg index 40d709c..717e459 100644 --- a/cookietemple.cfg +++ b/cookietemple.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.3.4 +current_version = 0.4.0 [bumpversion_files_whitelisted] init_file = spectrum_io/__init__.py diff --git a/docs/conf.py b/docs/conf.py index 155a5f4..d62108a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,9 +53,9 @@ # the built documents. # # The short X.Y version. -version = "0.3.4" +version = "0.4.0" # The full version, including alpha/beta/rc tags. -release = "0.3.4" +release = "0.4.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pyproject.toml b/pyproject.toml index 476b0c9..6c056d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spectrum_io" -version = "0.3.4" # <> +version = "0.4.0" # <> description = "IO related functionalities for oktoberfest." authors = ["Mario Picciani "] license = "MIT" @@ -30,7 +30,7 @@ pymzml = "^2.5.0" pyteomics = "^4.3.3" lxml= '^4.5.2' tables = "^3.6.1" -spectrum-fundamentals = ">=0.4.4,<0.5.0" +spectrum-fundamentals = ">=0.5.0,<0.6.0" [tool.poetry.dev-dependencies] pytest = ">=6.2.3" diff --git a/spectrum_io/__init__.py b/spectrum_io/__init__.py index 40e11bf..be1d097 100644 --- a/spectrum_io/__init__.py +++ b/spectrum_io/__init__.py @@ -2,7 +2,7 @@ __author__ = "Mario Picciani" __email__ = "mario.picciani@tum.de" -__version__ = "0.3.4" +__version__ = "0.4.0" import logging import logging.handlers diff --git a/spectrum_io/__main__.py b/spectrum_io/__main__.py index 7c5f863..9c6d5a5 100644 --- a/spectrum_io/__main__.py +++ b/spectrum_io/__main__.py @@ -5,7 +5,7 @@ @click.command() -@click.version_option(version="0.3.4", message=click.style("spectrum_io Version: 0.3.4")) +@click.version_option(version="0.4.0", message=click.style("spectrum_io Version: 0.4.0")) def main() -> None: """spectrum_io.""" From 20c3edead2bb52656b310cb6e899054c331f8230 Mon Sep 17 00:00:00 2001 From: Mario Picciani Date: Mon, 18 Dec 2023 18:05:23 +0100 Subject: [PATCH 3/4] fixed tests and added support for pymzml --- spectrum_io/raw/msraw.py | 4 +++- tests/unit_tests/data/testdf.pkl | Bin 10528 -> 10642 bytes 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spectrum_io/raw/msraw.py b/spectrum_io/raw/msraw.py index 9e977eb..17a7844 100644 --- a/spectrum_io/raw/msraw.py +++ b/spectrum_io/raw/msraw.py @@ -157,6 +157,7 @@ def _read_mzml_pymzml(file_list: List[Path], scanidx: Optional[List] = None, *ar file_name = file_path.stem mass_analyzer = get_mass_analyzer(file_path) namespace = "{http://psi.hupo.org/ms/mzml}" + instrument_name = data_iter.info["referenceable_param_group_list_element"][0][0].get("name") if scanidx is None: spectra = data_iter @@ -204,6 +205,7 @@ def _read_mzml_pymzml(file_list: List[Path], scanidx: Optional[List] = None, *ar mass_analyzer.get(instrument_configuration_ref, "unknown"), fragmentation, collision_energy, + instrument_name, ] data_iter.close() data = pd.DataFrame.from_dict(data_dict, orient="index", columns=MZML_DATA_COLUMNS) @@ -251,7 +253,7 @@ def _read_mzml_pyteomics(file_list: List[Path], *args, **kwargs) -> pd.DataFrame mass_analyzer.get(instrument_configuration_ref, "unknown"), fragmentation, collision_energy, - instrument_name + instrument_name, ] data_iter.close() data = pd.DataFrame.from_dict(data_dict, orient="index", columns=MZML_DATA_COLUMNS) diff --git a/tests/unit_tests/data/testdf.pkl b/tests/unit_tests/data/testdf.pkl index 4da3f6aa22eca5bfbbe79bdb912e39264117c099..9b0378b902374c6f11bd9c7999d05b1dc077c085 100644 GIT binary patch delta 238 zcmZ1wG%1*+fn{p@MwW6$M)u7$jB%=YJ#qz=C8_zjnaRa^iKP{pIhlz?m3qY`MWx9l zrA4X5Q+imF%YfV|lc)5E`WGc-mJ}rxD7cjtXXfWA_>|`6166SO23r{#7#Nuw8%^T=2hM+e?>y!*(keG%yqc{8Hk7^o>7L%pa4R|;iAYckm<>W+0DRxG0 zrnV^=F_ZJvBN_81pHx?4^Mk0S2>t0bV7OF((!Q29ro9C;>2&aVIbYlysD0lVJfG z2LVe0hLmVklg=ku0cVpaC?)|3lTRpv8fA2pVvGcCVQpoUPIZQqQj} Date: Mon, 18 Dec 2023 18:24:21 +0100 Subject: [PATCH 4/4] updated authors --- LICENSE | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 78da270..ad0a6b1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022, Mario Picciani +Copyright (c) 2023, Wilhelmlab at Technical University of Munich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pyproject.toml b/pyproject.toml index 6c056d0..f00606f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "spectrum_io" version = "0.4.0" # <> description = "IO related functionalities for oktoberfest." -authors = ["Mario Picciani "] +authors = ["Wilhelmlab at Technical University of Munich"] license = "MIT" readme = "README.rst" homepage = "https://github.com/wilhelm-lab/spectrum_io"