From 6ebda00705f786ea3289fe0a51d62c2cc36b6a30 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 09:43:50 +0100 Subject: [PATCH 01/11] more tests added. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 99d5cdb..8d2b3fb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Python application](https://github.com/bigbio/pyquantms/actions/workflows/python-app.yml/badge.svg)](https://github.com/bigbio/pyquantms/actions/workflows/python-app.yml) [![Python package](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml/badge.svg)](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml) [![PyPI version](https://badge.fury.io/py/pyquantms.svg)](https://badge.fury.io/py/pyquantms) -[![Documentation Status](https://readthedocs.org/projects/pyquantms/badge/?version=latest)](https://pyquantms.readthedocs.io/en/latest/?badge=latest) + Python package with scripts and functions for the [quantms workflow](https://github.com/bigbio/quantms) for the analysis of quantitative proteomics data. @@ -37,7 +37,6 @@ The following functionalities are available in the package: - `psmconvert` - The convert_psm function converts peptide spectrum matches (PSMs) from an idXML file to a CSV file, optionally filtering out decoy matches. It extracts and processes data from both the idXML and an associated spectra file, handling multiple search engines and scoring systems. - `mzmlstats` - The `mzmlstats` processes mass spectrometry data files in either `.mzML` or `Bruker .d` formats to extract and compile statistics about the spectra. It supports generating detailed or ID-only CSV files based on the spectra data. - ### Contributions and issues Contributions and issues are welcome. Please, open an issue in the [GitHub repository](https://github.com/bigbio/quantms) or PR in the [GitHub repository](https://github.com/bigbio/pyquantms). From af629112d7b5846271f2134b5b69f89ca5d96211 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 09:49:20 +0100 Subject: [PATCH 02/11] more tests added. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8d2b3fb..8fdf987 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # pyquantms [![Python application](https://github.com/bigbio/pyquantms/actions/workflows/python-app.yml/badge.svg)](https://github.com/bigbio/pyquantms/actions/workflows/python-app.yml) [![Python package](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml/badge.svg)](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea6903630b3a4d15b674a16b8ce594a7)](https://app.codacy.com/gh/bigbio/pyquantms/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![PyPI version](https://badge.fury.io/py/pyquantms.svg)](https://badge.fury.io/py/pyquantms) From 5d9afcfd45dc5591274dcc2e60688baa9e079e8e Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 09:59:43 +0100 Subject: [PATCH 03/11] more tests added. --- README.md | 4 +++- pyquantms/sdrf/check_samplesheet.py | 8 ++++---- tests/test_commands.py | 18 +++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8fdf987..3bb610f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ The package is available on PyPI: [pyquantms](https://pypi.org/project/pyquantms pip install pyquantms ``` +## Available Scripts + The following functionalities are available in the package: ### Diann scripts @@ -38,6 +40,6 @@ The following functionalities are available in the package: - `psmconvert` - The convert_psm function converts peptide spectrum matches (PSMs) from an idXML file to a CSV file, optionally filtering out decoy matches. It extracts and processes data from both the idXML and an associated spectra file, handling multiple search engines and scoring systems. - `mzmlstats` - The `mzmlstats` processes mass spectrometry data files in either `.mzML` or `Bruker .d` formats to extract and compile statistics about the spectra. It supports generating detailed or ID-only CSV files based on the spectra data. -### Contributions and issues +## Contributions and issues Contributions and issues are welcome. Please, open an issue in the [GitHub repository](https://github.com/bigbio/quantms) or PR in the [GitHub repository](https://github.com/bigbio/pyquantms). diff --git a/pyquantms/sdrf/check_samplesheet.py b/pyquantms/sdrf/check_samplesheet.py index 0260233..6d607ed 100644 --- a/pyquantms/sdrf/check_samplesheet.py +++ b/pyquantms/sdrf/check_samplesheet.py @@ -117,17 +117,17 @@ def check_expdesign_logic(f_table, s_table): default=False, ) @click.option( - "--input", + "-in", "--input_file", type=click.Path(exists=True), required=True, help="Input SDRF or Expdesign file", ) @click.pass_context -def check_samplesheet(ctx, is_sdrf: bool, check_ms: bool, input: str) -> None: +def check_samplesheet(ctx, is_sdrf: bool, check_ms: bool, input_file: str) -> None: """ Check the samplesheet for errors. """ if is_sdrf: - check_sdrf(check_ms, input) + check_sdrf(check_ms, input_file) else: - check_expdesign(input) + check_expdesign(input_file) diff --git a/tests/test_commands.py b/tests/test_commands.py index f960376..f8a0200 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -7,7 +7,7 @@ def test_future_test(): # test for the create_diann_cfg command in cli -def test_create_diann_cfg(): +def test_create_diann_cfg_help(): runner = CliRunner() result = runner.invoke(cli, ["dianncfg", "--help"]) @@ -15,7 +15,7 @@ def test_create_diann_cfg(): # test for the add_sage_feature command in cli -def test_add_sage_feature(): +def test_add_sage_feature_help(): runner = CliRunner() result = runner.invoke(cli, ["sage2feature", "--help"]) @@ -23,7 +23,7 @@ def test_add_sage_feature(): # test for the mzml_statistics command in cli -def test_mzml_statistics(): +def test_mzml_statistics_help(): runner = CliRunner() result = runner.invoke(cli, ["mzmlstats", "--help"]) @@ -31,7 +31,7 @@ def test_mzml_statistics(): # test for the diann_convert command in cli -def test_diann_convert(): +def test_diann_convert_help(): runner = CliRunner() result = runner.invoke(cli, ["diann2mztab", "--help"]) @@ -39,7 +39,7 @@ def test_diann_convert(): # test for the extract_sample_from_expdesign command in cli -def test_extract_sample_from_expdesign(): +def test_extract_sample_from_expdesign_help(): runner = CliRunner() result = runner.invoke(cli, ["openms2sample", "--help"]) @@ -47,7 +47,7 @@ def test_extract_sample_from_expdesign(): # test for the rescoring command in cli -def test_ms2rescore(): +def test_ms2rescore_help(): runner = CliRunner() result = runner.invoke(cli, ["ms2rescore", "--help"]) @@ -55,7 +55,7 @@ def test_ms2rescore(): # test for the convert_psm command in cli -def test_convert_psm(): +def test_convert_psm_help(): runner = CliRunner() result = runner.invoke(cli, ["psmconvert", "--help"]) @@ -63,7 +63,7 @@ def test_convert_psm(): # test for the check_samplesheet command in cli -def test_check_samplesheet(): +def test_check_samplesheet_help(): runner = CliRunner() result = runner.invoke(cli, ["checksamplesheet", "--help"]) @@ -79,7 +79,7 @@ def test_check_samplesheet_sdrf(): "checksamplesheet", "--is_sdrf", "--check_ms", - "--input", + "--input_file", "tests/test_data/PXD000001.sdrf.tsv", ], ) From 285e34a8d51a3c6b8f5342ebf68a8feb340c2dfc Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 10:09:06 +0100 Subject: [PATCH 04/11] more tests added. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 63f58c8..e538f95 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ "pydantic", "pandas", ] -PYTHON_REQUIRES = ">=3.7,<4" +PYTHON_REQUIRES = ">=3.8,<4" with open("README.md", "r") as fh: LONG_DESCRIPTION = fh.read() From 552bcac973ab3d8cb9c3f8823745a2effbde00d6 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 10:19:04 +0100 Subject: [PATCH 05/11] more tests added. --- README.md | 2 +- pyquantms/sdrf/check_samplesheet.py | 3 ++- tests/test_commands.py | 5 ----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3bb610f..a305ecb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Python package](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml/badge.svg)](https://github.com/bigbio/pyquantms/actions/workflows/python-package.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea6903630b3a4d15b674a16b8ce594a7)](https://app.codacy.com/gh/bigbio/pyquantms/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![PyPI version](https://badge.fury.io/py/pyquantms.svg)](https://badge.fury.io/py/pyquantms) - +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) Python package with scripts and functions for the [quantms workflow](https://github.com/bigbio/quantms) for the analysis of quantitative proteomics data. diff --git a/pyquantms/sdrf/check_samplesheet.py b/pyquantms/sdrf/check_samplesheet.py index 6d607ed..f1c50e5 100644 --- a/pyquantms/sdrf/check_samplesheet.py +++ b/pyquantms/sdrf/check_samplesheet.py @@ -117,7 +117,8 @@ def check_expdesign_logic(f_table, s_table): default=False, ) @click.option( - "-in", "--input_file", + "-in", + "--input_file", type=click.Path(exists=True), required=True, help="Input SDRF or Expdesign file", diff --git a/tests/test_commands.py b/tests/test_commands.py index f8a0200..7095ce1 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1,11 +1,6 @@ from click.testing import CliRunner from pyquantms.pyquantmsc import cli - -def test_future_test(): - assert 1 == 1 - - # test for the create_diann_cfg command in cli def test_create_diann_cfg_help(): runner = CliRunner() From def41a0525961969ab24f28f2b73ae6c2ff40f27 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 10:27:50 +0100 Subject: [PATCH 06/11] more tests added. --- .codacy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .codacy.yml diff --git a/.codacy.yml b/.codacy.yml new file mode 100644 index 0000000..2fab84e --- /dev/null +++ b/.codacy.yml @@ -0,0 +1,8 @@ +engines: + eslint: + enabled: true + pylint: + enabled: true + +ignore_patterns: + - "tests/*" From 4fcbab453948e0fb696ab57964e5fbbf1245cc94 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 10:39:47 +0100 Subject: [PATCH 07/11] more tests added. --- pyquantms/psm/psm_conversion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyquantms/psm/psm_conversion.py b/pyquantms/psm/psm_conversion.py index 4a3c5c4..86e650a 100644 --- a/pyquantms/psm/psm_conversion.py +++ b/pyquantms/psm/psm_conversion.py @@ -39,7 +39,7 @@ def mods_position(peptide): for j in range(1, len(position)): position[j] -= j - for k in range(0, len(original_mods)): + for k, mod in enumerate(original_mods): original_mods[k] = str(position[k]) + "-" + original_mods[k] original_mods = ( From 6ac597b4675a99b8cb0a068cdc6b92d5554ded62 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 11:45:32 +0100 Subject: [PATCH 08/11] more tests added. --- pyquantms/diann/diann2mztab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyquantms/diann/diann2mztab.py b/pyquantms/diann/diann2mztab.py index 1d6faf8..e2dbfd6 100644 --- a/pyquantms/diann/diann2mztab.py +++ b/pyquantms/diann/diann2mztab.py @@ -1386,7 +1386,7 @@ def find_modification(peptide): for j in range(1, len(position)): position[j] -= j - for k in range(0, len(original_mods)): + for k, mod in enumerate(original_mods): original_mods[k] = str(position[k]) + "-" + original_mods[k].upper() original_mods = ( From 455dcbfa701189a8d3106d9113b77d64201f1192 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 11:53:04 +0100 Subject: [PATCH 09/11] more tests added. --- pyquantms/diann/diann2mztab.py | 2 +- pyquantms/psm/psm_conversion.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyquantms/diann/diann2mztab.py b/pyquantms/diann/diann2mztab.py index e2dbfd6..9935b4c 100644 --- a/pyquantms/diann/diann2mztab.py +++ b/pyquantms/diann/diann2mztab.py @@ -1387,7 +1387,7 @@ def find_modification(peptide): position[j] -= j for k, mod in enumerate(original_mods): - original_mods[k] = str(position[k]) + "-" + original_mods[k].upper() + original_mods[k] = str(position[k]) + "-" + mod.upper() original_mods = ( ",".join(str(i) for i in original_mods) if len(original_mods) > 0 else "null" diff --git a/pyquantms/psm/psm_conversion.py b/pyquantms/psm/psm_conversion.py index 86e650a..02d8eba 100644 --- a/pyquantms/psm/psm_conversion.py +++ b/pyquantms/psm/psm_conversion.py @@ -40,7 +40,7 @@ def mods_position(peptide): position[j] -= j for k, mod in enumerate(original_mods): - original_mods[k] = str(position[k]) + "-" + original_mods[k] + original_mods[k] = str(position[k]) + "-" + mod original_mods = ( [str(i) for i in original_mods] if len(original_mods) > 0 else np.nan From ac3812a0223f0e6e7a6a3577351dcb9044188d4d Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 11:56:54 +0100 Subject: [PATCH 10/11] more tests added. --- pyquantms/diann/diann2mztab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyquantms/diann/diann2mztab.py b/pyquantms/diann/diann2mztab.py index 9935b4c..14a5fa9 100644 --- a/pyquantms/diann/diann2mztab.py +++ b/pyquantms/diann/diann2mztab.py @@ -1104,7 +1104,7 @@ def __find_info(directory, n): "exp_mass_to_charge", ] # Standardize spectrum identifier format for bruker data - if type(target.loc[0, "opt_global_spectrum_reference"]) != str: + if not isinstance(target.loc[0, "opt_global_spectrum_reference"], str): target.loc[:, "opt_global_spectrum_reference"] = "scan=" + target.loc[ :, "opt_global_spectrum_reference" ].astype(str) From f591b9feb62721d1880b43797b4d70c4dae61cd5 Mon Sep 17 00:00:00 2001 From: Yasset Perez-Riverol Date: Sun, 26 May 2024 12:01:44 +0100 Subject: [PATCH 11/11] more tests added. --- .codacy.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.codacy.yml b/.codacy.yml index 2fab84e..91d20e1 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -6,3 +6,12 @@ engines: ignore_patterns: - "tests/*" + +eslint: + enabled: true + config_file: .eslintrc.json + exclude_paths: + - 'tests/**' + +exclude_paths: + - 'tests/**' \ No newline at end of file