From d4e627ba28598a8d2c55ef5ec463faff10440944 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:04:38 +0000 Subject: [PATCH 01/14] [DEPENDABOT]: Bump actions/setup-python from 5.1.1 to 5.2.0 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.1.1 to 5.2.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5.1.1...v5.2.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/build_package.yml | 2 +- .github/workflows/main_master_branch_protection.yml | 2 +- .github/workflows/publish_docs.yml | 2 +- .github/workflows/publish_package.yml | 2 +- .github/workflows/run_cookietemple_lint.yml | 2 +- .github/workflows/run_tests.yml | 4 ++-- .github/workflows/sync_project.yml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 8c35afe..0dd9cb6 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -16,7 +16,7 @@ jobs: name: Check out source-code repository - name: Setup Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/main_master_branch_protection.yml b/.github/workflows/main_master_branch_protection.yml index b8eb3d9..8619c3a 100644 --- a/.github/workflows/main_master_branch_protection.yml +++ b/.github/workflows/main_master_branch_protection.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: "3.9" # PRs to the repository master branch are only ok if coming from any patch or release branch diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 8d5ac9c..bf649a2 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -11,7 +11,7 @@ jobs: name: Check out source-code repository - name: Setup Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: 3.9 diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index ff86ea9..3213466 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 2 - name: Set up Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: "3.9" diff --git a/.github/workflows/run_cookietemple_lint.yml b/.github/workflows/run_cookietemple_lint.yml index 3b3ef4f..1af37d3 100644 --- a/.github/workflows/run_cookietemple_lint.yml +++ b/.github/workflows/run_cookietemple_lint.yml @@ -11,7 +11,7 @@ jobs: name: Check out source-code repository - name: Setup Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: 3.9 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d7786e8..7a3974f 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -72,7 +72,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: ${{ matrix.python-version }} @@ -137,7 +137,7 @@ jobs: uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: 3.9 diff --git a/.github/workflows/sync_project.yml b/.github/workflows/sync_project.yml index ab6b647..111650e 100644 --- a/.github/workflows/sync_project.yml +++ b/.github/workflows/sync_project.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Python - uses: actions/setup-python@v5.1.1 + uses: actions/setup-python@v5.2.0 with: python-version: 3.9 From b8b26d424364140c5412b08b70d642d84948130e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:35:08 +0000 Subject: [PATCH 02/14] [DEPENDABOT]: Bump pypa/gh-action-pypi-publish from 1.9.0 to 1.10.3 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.9.0 to 1.10.3. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.9.0...v1.10.3) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/publish_package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_package.yml b/.github/workflows/publish_package.yml index ff86ea9..a45d20d 100644 --- a/.github/workflows/publish_package.yml +++ b/.github/workflows/publish_package.yml @@ -29,7 +29,7 @@ jobs: poetry build --ansi - name: Publish package on PyPI - uses: pypa/gh-action-pypi-publish@v1.9.0 + uses: pypa/gh-action-pypi-publish@v1.10.3 with: # TODO COOKIETEMPLE: Configure your PyPI Token to enable automatic deployment to PyPi on releases # https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets From b82bc679ea450584a3d940ad0a005f6c04ca6cd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:35:49 +0000 Subject: [PATCH 03/14] [DEPENDABOT]: Bump codecov/codecov-action from 4.5.0 to 4.6.0 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.5.0 to 4.6.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4.5.0...v4.6.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 1a2ce98..8b69370 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -166,4 +166,4 @@ jobs: run: nox --force-color --session=coverage -- xml -i - name: Upload coverage report - uses: codecov/codecov-action@v4.5.0 + uses: codecov/codecov-action@v4.6.0 From d2af5b7282c563089e669b8ad156d730f4c2a3f6 Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 13:15:47 +0000 Subject: [PATCH 04/14] Add proper protein ids to percolator --- spectrum_fundamentals/metrics/percolator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index 4e54f68..374658f 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -336,9 +336,7 @@ def add_percolator_metadata_columns(self): else: spec_id_cols = ["RAW_FILE", "SCAN_NUMBER", "MODIFIED_SEQUENCE", "PRECURSOR_CHARGE"] self.metrics_val["Peptide"] = self.metadata["MODIFIED_SEQUENCE"].apply(lambda x: "_." + x + "._") - self.metrics_val["Proteins"] = self.metadata[ - "MODIFIED_SEQUENCE" - ] # we don't need the protein ID to get PSM / peptide results, fill with peptide sequence + self.metrics_val["Proteins"] = self.metadata["PROTEINS"] if "SCAN_EVENT_NUMBER" in self.metadata.columns: spec_id_cols.append("SCAN_EVENT_NUMBER") From 4e4ea3f510f74944ad9057480f8141fd163c1b9a Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 13:54:50 +0000 Subject: [PATCH 05/14] fix percolator tests --- tests/unit_tests/data/perc_input.csv | 18 +++++++++--------- tests/unit_tests/test_percolator.py | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/unit_tests/data/perc_input.csv b/tests/unit_tests/data/perc_input.csv index 6d7bfe4..2e7e566 100644 --- a/tests/unit_tests/data/perc_input.csv +++ b/tests/unit_tests/data/perc_input.csv @@ -1,9 +1,9 @@ -,RAW_FILE,SCAN_NUMBER,MODIFIED_SEQUENCE,SEQUENCE,PRECURSOR_CHARGE,MASS,CALCULATED_MASS,SCORE,REVERSE,FRAGMENTATION,MASS_ANALYZER,SCAN_EVENT_NUMBER,RETENTION_TIME,PREDICTED_IRT,COLLISION_ENERGY -0,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,7978,AAIGEATRL,AAIGEATRL,2,900.50345678,900.50288029264,60.43600000000001,False,HCD,FTMS,1,0.5000000183883155,0.5000000323590892,30.0 -1,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,12304,AAVPRAAFL,AAVPRAAFL,2,914.53379,914.53379,34.006,True,HCD,FTMS,2,1.000000038995633,1.5000000246189773,30.0 -2,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,12398,AAYFGVYDTAK,AAYFGVYDTAK,2,1204.5764,1204.5764,39.97399999999999,True,HCD,FTMS,3,1.5000000993570157,2.500000056694346,30.0 -3,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,11716,AAYYHPSYL,AAYYHPSYL,2,1083.5025,1083.5025,99.919,False,HCD,FTMS,4,2.0000000098074193,3.5000000203256407,30.0 -4,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,87.802,False,HCD,FTMS,5,2.500000083793533,4.5000000747038005,30.0 -5,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,62.802,False,HCD,FTMS,6,3.0000000338727677,5.5000000960095505,30.0 -6,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,79.802,False,HCD,FTMS,7,3.500000001673834,6.5000000134594345,30.0 -7,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,79.802,False,HCD,FTMS,8,4.000000066050141,7.500000085284446,30.0 +,RAW_FILE,SCAN_NUMBER,MODIFIED_SEQUENCE,SEQUENCE,PRECURSOR_CHARGE,MASS,CALCULATED_MASS,SCORE,REVERSE,FRAGMENTATION,MASS_ANALYZER,SCAN_EVENT_NUMBER,RETENTION_TIME,PREDICTED_IRT,COLLISION_ENERGY,PROTEINS +0,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,7978,AAIGEATRL,AAIGEATRL,2,900.5034568,900.5028803,60.436,FALSE,HCD,FTMS,1,0.500000018,0.500000032,30,sp|O23523|RGGA_ARATH +1,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,12304,AAVPRAAFL,AAVPRAAFL,2,914.53379,914.53379,34.006,TRUE,HCD,FTMS,2,1.000000039,1.500000025,30,sp|O23523|RGGA_ARATH +2,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,12398,AAYFGVYDTAK,AAYFGVYDTAK,2,1204.5764,1204.5764,39.974,TRUE,HCD,FTMS,3,1.500000099,2.500000057,30,sp|O23523|RGGA_ARATH +3,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,11716,AAYYHPSYL,AAYYHPSYL,2,1083.5025,1083.5025,99.919,FALSE,HCD,FTMS,4,2.00000001,3.50000002,30,sp|O23523|RGGA_ARATH +4,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,87.802,FALSE,HCD,FTMS,5,2.500000084,4.500000075,30,sp|O23523|RGGA_ARATH +5,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,62.802,FALSE,HCD,FTMS,6,3.000000034,5.500000096,30,sp|O23523|RGGA_ARATH +6,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,79.802,FALSE,HCD,FTMS,7,3.500000002,6.500000013,30,sp|O23523|RGGA_ARATH +7,20210122_0263_TMUCLHan_Peiru_DDA_IP_C797S_02,5174,AEDLNTRVA,AEDLNTRVA,2,987.49852,987.49852,79.802,FALSE,HCD,FTMS,8,4.000000066,7.500000085,30,sp|O23523|RGGA_ARATH diff --git a/tests/unit_tests/test_percolator.py b/tests/unit_tests/test_percolator.py index 5e736f4..3651d21 100644 --- a/tests/unit_tests/test_percolator.py +++ b/tests/unit_tests/test_percolator.py @@ -395,7 +395,7 @@ def test_calc(self): # np.testing.assert_almost_equal(percolator.metrics_val['ExpMass'][0], 900.50345678) np.testing.assert_string_equal(percolator.metrics_val["Peptide"][0], "_.AAIGEATRL._") np.testing.assert_string_equal( - percolator.metrics_val["Proteins"][0], "AAIGEATRL" + percolator.metrics_val["Proteins"][0], "sp|O23523|RGGA_ARATH" ) # we don't need the protein ID to get PSM / peptide results # features From f786831443bc3c0e4988ea7eda94799c1e9280da Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 14:02:30 +0000 Subject: [PATCH 06/14] Bump version from 0.7.4 to 0.7.5 --- .cookietemple.yml | 2 +- .github/release-drafter.yml | 4 ++-- cookietemple.cfg | 2 +- docs/conf.py | 4 ++-- pyproject.toml | 2 +- spectrum_fundamentals/__init__.py | 2 +- spectrum_fundamentals/__main__.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.cookietemple.yml b/.cookietemple.yml index 690429d..c00f97f 100644 --- a/.cookietemple.yml +++ b/.cookietemple.yml @@ -15,5 +15,5 @@ full_name: Victor Giurcoiu email: victor.giurcoiu@tum.de project_name: spectrum_fundamentals project_short_description: Fundamentals public repo -version: 0.7.4 +version: 0.7.5 license: MIT diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 9c78e48..92bced3 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "0.7.4 " # <> -tag-template: 0.7.4 # <> +name-template: "0.7.5 " # <> +tag-template: 0.7.5 # <> exclude-labels: - "skip-changelog" diff --git a/cookietemple.cfg b/cookietemple.cfg index 2c55632..afd4846 100644 --- a/cookietemple.cfg +++ b/cookietemple.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.4 +current_version = 0.7.5 [bumpversion_files_whitelisted] init_file = spectrum_fundamentals/__init__.py diff --git a/docs/conf.py b/docs/conf.py index 2833a7f..528c6b8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,9 +52,9 @@ # the built documents. # # The short X.Y version. -version = "0.7.4" +version = "0.7.5" # The full version, including alpha/beta/rc tags. -release = "0.7.4" +release = "0.7.5" # 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 2c6a528..9ef31fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spectrum_fundamentals" -version = "0.7.4" # <> +version = "0.7.5" # <> description = "Fundamental functions, annotation pipeline and constants for oktoberfest" authors = ["Wilhelmlab at Technical University of Munich"] license = "MIT" diff --git a/spectrum_fundamentals/__init__.py b/spectrum_fundamentals/__init__.py index d4fa09a..9bb0ba3 100644 --- a/spectrum_fundamentals/__init__.py +++ b/spectrum_fundamentals/__init__.py @@ -5,7 +5,7 @@ __author__ = """The Oktoberfest development team (Wilhelmlab at Technical University of Munich)""" __copyright__ = f"Copyright {datetime.now():%Y}, Wilhelmlab at Technical University of Munich" __license__ = "MIT" -__version__ = "0.7.4" +__version__ = "0.7.5" import logging import logging.handlers diff --git a/spectrum_fundamentals/__main__.py b/spectrum_fundamentals/__main__.py index f03da2d..50831d4 100644 --- a/spectrum_fundamentals/__main__.py +++ b/spectrum_fundamentals/__main__.py @@ -5,7 +5,7 @@ @click.command() -@click.version_option(version="0.7.4", message=click.style("spectrum_fundamentals Version: 0.7.4")) +@click.version_option(version="0.7.5", message=click.style("spectrum_fundamentals Version: 0.7.5")) def main() -> None: """spectrum_fundamentals.""" From 53f5464d18ccc37bd57fcac6fc79debaef8a6d00 Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 16:30:36 +0000 Subject: [PATCH 07/14] align perc features with cit pipeline --- spectrum_fundamentals/metrics/percolator.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index 374658f..a6b8075 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -444,7 +444,7 @@ def _reorder_columns_for_percolator(self): new_columns = first_columns + sorted(mid_columns) + last_columns self.metrics_val = self.metrics_val[new_columns] - def calc(self): + def calc(self): # noqa: C901 """Adds percolator metadata and feature columns to metrics_val based on PSM metadata.""" self.add_common_features() self.target_decoy_labels = self.metadata["REVERSE"].apply(Percolator.get_target_decoy_label).to_numpy() @@ -464,6 +464,11 @@ def calc(self): if self.neutral_loss_flag: self.metrics_val["ANNOTATED_NL_COUNT"] = self.metadata["ANNOTATED_NL_COUNT"] self.metrics_val["EXPECTED_NL_COUNT"] = self.metadata["EXPECTED_NL_COUNT"] + columns_to_remove = [] + for col in self.metrics_val.columns: + if "vs_predicted" in col: + columns_to_remove.append(col) + self.metrics_val.drop(columns=columns_to_remove, inplace=True) if self.drop_miss_cleavage_flag: self.metrics_val.drop(columns=["missedCleavages", "KR"], inplace=True) if self.xl: From 9651649a5de1eed3fe8d2fce5738b6838e137dd1 Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 16:31:49 +0000 Subject: [PATCH 08/14] Bump version from 0.7.5 to 0.7.6 --- .cookietemple.yml | 2 +- .github/release-drafter.yml | 4 ++-- cookietemple.cfg | 2 +- docs/conf.py | 4 ++-- pyproject.toml | 2 +- spectrum_fundamentals/__init__.py | 2 +- spectrum_fundamentals/__main__.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.cookietemple.yml b/.cookietemple.yml index c00f97f..d9b8bef 100644 --- a/.cookietemple.yml +++ b/.cookietemple.yml @@ -15,5 +15,5 @@ full_name: Victor Giurcoiu email: victor.giurcoiu@tum.de project_name: spectrum_fundamentals project_short_description: Fundamentals public repo -version: 0.7.5 +version: 0.7.6 license: MIT diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 92bced3..5cd19ed 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "0.7.5 " # <> -tag-template: 0.7.5 # <> +name-template: "0.7.6 " # <> +tag-template: 0.7.6 # <> exclude-labels: - "skip-changelog" diff --git a/cookietemple.cfg b/cookietemple.cfg index afd4846..2bc4adc 100644 --- a/cookietemple.cfg +++ b/cookietemple.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.5 +current_version = 0.7.6 [bumpversion_files_whitelisted] init_file = spectrum_fundamentals/__init__.py diff --git a/docs/conf.py b/docs/conf.py index 528c6b8..cb18bb7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,9 +52,9 @@ # the built documents. # # The short X.Y version. -version = "0.7.5" +version = "0.7.6" # The full version, including alpha/beta/rc tags. -release = "0.7.5" +release = "0.7.6" # 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 9ef31fc..7cc1dbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spectrum_fundamentals" -version = "0.7.5" # <> +version = "0.7.6" # <> description = "Fundamental functions, annotation pipeline and constants for oktoberfest" authors = ["Wilhelmlab at Technical University of Munich"] license = "MIT" diff --git a/spectrum_fundamentals/__init__.py b/spectrum_fundamentals/__init__.py index 9bb0ba3..76cdc86 100644 --- a/spectrum_fundamentals/__init__.py +++ b/spectrum_fundamentals/__init__.py @@ -5,7 +5,7 @@ __author__ = """The Oktoberfest development team (Wilhelmlab at Technical University of Munich)""" __copyright__ = f"Copyright {datetime.now():%Y}, Wilhelmlab at Technical University of Munich" __license__ = "MIT" -__version__ = "0.7.5" +__version__ = "0.7.6" import logging import logging.handlers diff --git a/spectrum_fundamentals/__main__.py b/spectrum_fundamentals/__main__.py index 50831d4..6fade5c 100644 --- a/spectrum_fundamentals/__main__.py +++ b/spectrum_fundamentals/__main__.py @@ -5,7 +5,7 @@ @click.command() -@click.version_option(version="0.7.5", message=click.style("spectrum_fundamentals Version: 0.7.5")) +@click.version_option(version="0.7.6", message=click.style("spectrum_fundamentals Version: 0.7.6")) def main() -> None: """spectrum_fundamentals.""" From 5d8efd3f16644c6c6c4ab0165292f5e4725da097 Mon Sep 17 00:00:00 2001 From: WassimG Date: Thu, 10 Oct 2024 17:14:52 +0000 Subject: [PATCH 09/14] add proteins to base_columns --- .cookietemple.yml | 2 +- .github/release-drafter.yml | 4 ++-- cookietemple.cfg | 2 +- docs/conf.py | 4 ++-- pyproject.toml | 2 +- spectrum_fundamentals/__init__.py | 2 +- spectrum_fundamentals/__main__.py | 2 +- spectrum_fundamentals/metrics/percolator.py | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.cookietemple.yml b/.cookietemple.yml index d9b8bef..7459a05 100644 --- a/.cookietemple.yml +++ b/.cookietemple.yml @@ -15,5 +15,5 @@ full_name: Victor Giurcoiu email: victor.giurcoiu@tum.de project_name: spectrum_fundamentals project_short_description: Fundamentals public repo -version: 0.7.6 +version: 0.7.7 license: MIT diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 5cd19ed..806aea3 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "0.7.6 " # <> -tag-template: 0.7.6 # <> +name-template: "0.7.7 " # <> +tag-template: 0.7.7 # <> exclude-labels: - "skip-changelog" diff --git a/cookietemple.cfg b/cookietemple.cfg index 2bc4adc..4fdf161 100644 --- a/cookietemple.cfg +++ b/cookietemple.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.6 +current_version = 0.7.7 [bumpversion_files_whitelisted] init_file = spectrum_fundamentals/__init__.py diff --git a/docs/conf.py b/docs/conf.py index cb18bb7..2b90c61 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,9 +52,9 @@ # the built documents. # # The short X.Y version. -version = "0.7.6" +version = "0.7.7" # The full version, including alpha/beta/rc tags. -release = "0.7.6" +release = "0.7.7" # 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 7cc1dbe..6c8ef0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spectrum_fundamentals" -version = "0.7.6" # <> +version = "0.7.7" # <> description = "Fundamental functions, annotation pipeline and constants for oktoberfest" authors = ["Wilhelmlab at Technical University of Munich"] license = "MIT" diff --git a/spectrum_fundamentals/__init__.py b/spectrum_fundamentals/__init__.py index 76cdc86..1b67d97 100644 --- a/spectrum_fundamentals/__init__.py +++ b/spectrum_fundamentals/__init__.py @@ -5,7 +5,7 @@ __author__ = """The Oktoberfest development team (Wilhelmlab at Technical University of Munich)""" __copyright__ = f"Copyright {datetime.now():%Y}, Wilhelmlab at Technical University of Munich" __license__ = "MIT" -__version__ = "0.7.6" +__version__ = "0.7.7" import logging import logging.handlers diff --git a/spectrum_fundamentals/__main__.py b/spectrum_fundamentals/__main__.py index 6fade5c..31fea9c 100644 --- a/spectrum_fundamentals/__main__.py +++ b/spectrum_fundamentals/__main__.py @@ -5,7 +5,7 @@ @click.command() -@click.version_option(version="0.7.6", message=click.style("spectrum_fundamentals Version: 0.7.6")) +@click.version_option(version="0.7.7", message=click.style("spectrum_fundamentals Version: 0.7.7")) def main() -> None: """spectrum_fundamentals.""" diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index a6b8075..17434d9 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -94,6 +94,7 @@ def __init__( "mass_analyzer", "mz_range", "collision_energy", + "proteins", ] super().__init__(pred_intensities, true_intensities, mz) From 414bb2a36fc1fd671f7d4e672667c2ed24b71201 Mon Sep 17 00:00:00 2001 From: Mostafa Kalhor Date: Tue, 15 Oct 2024 15:35:10 +0000 Subject: [PATCH 10/14] paper results comes from this version --- spectrum_fundamentals/metrics/percolator.py | 24 ++++++++++----------- spectrum_fundamentals/metrics/similarity.py | 8 ++++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index 1d4455d..96f88f1 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -64,9 +64,9 @@ def __init__( self.all_features_flag = all_features_flag self.regression_method = regression_method self.fdr_cutoff = fdr_cutoff - self.xl = "CROSSLINKER_TYPE" in self.metadata.columns - - super().__init__(pred_intensities, true_intensities, mz) + + super().__init__(pred_intensities, true_intensities, mz, xl="CROSSLINKER_TYPE" in self.metadata.columns) + @staticmethod def sample_balanced_over_bins(retention_time_df: pd.DataFrame, sample_size: int = 5000) -> pd.Index: @@ -278,12 +278,10 @@ def add_percolator_metadata_columns(self): """Add metadata columns needed by percolator, e.g. to identify a PSM.""" if self.xl: spec_id_cols = ["RAW_FILE", "SCAN_NUMBER", "MODIFIED_SEQUENCE_A", "MODIFIED_SEQUENCE_B", "PRECURSOR_CHARGE"] - self.metrics_val["Peptide"] = ( - self.metadata["MODIFIED_SEQUENCE_A"] + "_" + self.metadata["MODIFIED_SEQUENCE_B"] - ).apply(lambda x: "_." + x + "._") - self.metrics_val["Proteins"] = ( - self.metadata["MODIFIED_SEQUENCE_A"] + "_" + self.metadata["MODIFIED_SEQUENCE_B"] - ) + modified_sequence_a = self.metadata["MODIFIED_SEQUENCE_A"].astype(str) + modified_sequence_b = self.metadata["MODIFIED_SEQUENCE_B"].astype(str) + self.metrics_val["Peptide"] = (modified_sequence_a + "_" + modified_sequence_b).apply(lambda x: "_." + x + "._") + self.metrics_val["Proteins"] = (modified_sequence_a + "_" + modified_sequence_b) self.metrics_val["Label"] = self.target_decoy_labels else: spec_id_cols = ["RAW_FILE", "SCAN_NUMBER", "MODIFIED_SEQUENCE", "PRECURSOR_CHARGE"] @@ -466,10 +464,10 @@ def calc(self): # self.metrics_val['spectral_angle_delta_score'] = Percolator.get_delta_score(self.metrics_val[['ScanNr', # 'spectral_angle']], 'spectral_angle') pass - else: - self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( - self.metrics_val[["ScanNr", "andromeda"]], "andromeda" - ) + #else: + # self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( + # self.metrics_val[["ScanNr", "andromeda"]], "andromeda" + # ) self._reorder_columns_for_percolator() diff --git a/spectrum_fundamentals/metrics/similarity.py b/spectrum_fundamentals/metrics/similarity.py index 930df61..4f8b4cb 100644 --- a/spectrum_fundamentals/metrics/similarity.py +++ b/spectrum_fundamentals/metrics/similarity.py @@ -481,9 +481,7 @@ def _calc_additional_metrics( true_intensities, pred_intensities, "max" ) self.metrics_val[f"mse{key_suffix}"] = SimilarityMetrics.abs_diff(true_intensities, pred_intensities, "mse") - self.metrics_val[f"modified_cosine{key_suffix}"] = SimilarityMetrics.modified_cosine( - true_intensities, pred_intensities, self.mz, self.mz - ) + col_names_spectral_angle = [ f"spectral_angle_{amount}_charge{key_suffix}" for amount in ["single", "double", "triple"] @@ -539,3 +537,7 @@ def _calc_additional_metrics( self.metrics_val[col_name_spearman_corr] = SimilarityMetrics.correlation( true_intensities, pred_intensities, i + 1, "spearman" ) + + self.metrics_val[f"modified_cosine{key_suffix}"] = SimilarityMetrics.modified_cosine( + true_intensities, pred_intensities, self.mz, self.mz + ) From f6107ed2da3aef778d126e64fb43377d2e3146d5 Mon Sep 17 00:00:00 2001 From: Mostafa Kalhor Date: Sat, 26 Oct 2024 13:57:49 +0000 Subject: [PATCH 11/14] fix super call and added POSITIONS_XL constant --- spectrum_fundamentals/constants.py | 2 +- spectrum_fundamentals/metrics/percolator.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spectrum_fundamentals/constants.py b/spectrum_fundamentals/constants.py index 68f1942..f3781cb 100644 --- a/spectrum_fundamentals/constants.py +++ b/spectrum_fundamentals/constants.py @@ -510,7 +510,7 @@ class RescoreType(Enum): CHARGES = [1, 2, 3] # limited to uint8 (0-255) when array is created POSITIONS = [x for x in range(1, 30)] # fragment numbers 1-29 -- limited to uint8 (0-255) when array is created - +POSITIONS_XL = [x for x in range(1, 59)] ANNOTATION_FRAGMENT_TYPE = [] ANNOTATION_FRAGMENT_CHARGE = [] ANNOTATION_FRAGMENT_NUMBER = [] diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index df62c50..84f000e 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -62,6 +62,8 @@ def __init__( drop_miss_cleavage_flag: Optional[bool] = False, ): """Initialize a Percolator obj.""" + super().__init__(pred_intensities, true_intensities, mz, "CROSSLINKER_TYPE" in metadata.columns) + self.metadata = metadata self.input_type = input_type self.all_features_flag = all_features_flag @@ -70,7 +72,7 @@ def __init__( self.fdr_cutoff = fdr_cutoff self.neutral_loss_flag = neutral_loss_flag self.drop_miss_cleavage_flag = drop_miss_cleavage_flag - self.xl = "CROSSLINKER_TYPE" in self.metadata.columns + self.base_columns = [ "raw_file", "scan_number", @@ -97,8 +99,6 @@ def __init__( "proteins", ] - super().__init__(pred_intensities, true_intensities, mz) - @staticmethod def sample_balanced_over_bins(retention_time_df: pd.DataFrame, sample_size: int = 5000) -> pd.Index: """ From 4b8b4ff32749776916650285bec792ae622e3acc Mon Sep 17 00:00:00 2001 From: Mostafa Kalhor Date: Sat, 26 Oct 2024 14:01:19 +0000 Subject: [PATCH 12/14] Bump version from 0.7.7 to 0.7.8 --- .cookietemple.yml | 2 +- .github/release-drafter.yml | 4 ++-- cookietemple.cfg | 2 +- docs/conf.py | 4 ++-- pyproject.toml | 2 +- spectrum_fundamentals/__init__.py | 2 +- spectrum_fundamentals/__main__.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.cookietemple.yml b/.cookietemple.yml index 7459a05..a386290 100644 --- a/.cookietemple.yml +++ b/.cookietemple.yml @@ -15,5 +15,5 @@ full_name: Victor Giurcoiu email: victor.giurcoiu@tum.de project_name: spectrum_fundamentals project_short_description: Fundamentals public repo -version: 0.7.7 +version: 0.7.8 license: MIT diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 806aea3..902c9de 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "0.7.7 " # <> -tag-template: 0.7.7 # <> +name-template: "0.7.8 " # <> +tag-template: 0.7.8 # <> exclude-labels: - "skip-changelog" diff --git a/cookietemple.cfg b/cookietemple.cfg index 4fdf161..e174cfc 100644 --- a/cookietemple.cfg +++ b/cookietemple.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.7.7 +current_version = 0.7.8 [bumpversion_files_whitelisted] init_file = spectrum_fundamentals/__init__.py diff --git a/docs/conf.py b/docs/conf.py index 2b90c61..0d12982 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -52,9 +52,9 @@ # the built documents. # # The short X.Y version. -version = "0.7.7" +version = "0.7.8" # The full version, including alpha/beta/rc tags. -release = "0.7.7" +release = "0.7.8" # 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 6c8ef0a..9bebb9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spectrum_fundamentals" -version = "0.7.7" # <> +version = "0.7.8" # <> description = "Fundamental functions, annotation pipeline and constants for oktoberfest" authors = ["Wilhelmlab at Technical University of Munich"] license = "MIT" diff --git a/spectrum_fundamentals/__init__.py b/spectrum_fundamentals/__init__.py index 1b67d97..741dd90 100644 --- a/spectrum_fundamentals/__init__.py +++ b/spectrum_fundamentals/__init__.py @@ -5,7 +5,7 @@ __author__ = """The Oktoberfest development team (Wilhelmlab at Technical University of Munich)""" __copyright__ = f"Copyright {datetime.now():%Y}, Wilhelmlab at Technical University of Munich" __license__ = "MIT" -__version__ = "0.7.7" +__version__ = "0.7.8" import logging import logging.handlers diff --git a/spectrum_fundamentals/__main__.py b/spectrum_fundamentals/__main__.py index 31fea9c..e59a495 100644 --- a/spectrum_fundamentals/__main__.py +++ b/spectrum_fundamentals/__main__.py @@ -5,7 +5,7 @@ @click.command() -@click.version_option(version="0.7.7", message=click.style("spectrum_fundamentals Version: 0.7.7")) +@click.version_option(version="0.7.8", message=click.style("spectrum_fundamentals Version: 0.7.8")) def main() -> None: """spectrum_fundamentals.""" From ee2aa82e116cdac060d968ecf65da98a1080a1e7 Mon Sep 17 00:00:00 2001 From: Mostafa Kalhor Date: Sat, 26 Oct 2024 14:08:01 +0000 Subject: [PATCH 13/14] fixed pre-commit hooks --- spectrum_fundamentals/metrics/percolator.py | 16 +++++++++------- spectrum_fundamentals/metrics/similarity.py | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index 84f000e..76fd7d1 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -72,7 +72,7 @@ def __init__( self.fdr_cutoff = fdr_cutoff self.neutral_loss_flag = neutral_loss_flag self.drop_miss_cleavage_flag = drop_miss_cleavage_flag - + self.base_columns = [ "raw_file", "scan_number", @@ -329,8 +329,10 @@ def add_percolator_metadata_columns(self): spec_id_cols = ["RAW_FILE", "SCAN_NUMBER", "MODIFIED_SEQUENCE_A", "MODIFIED_SEQUENCE_B", "PRECURSOR_CHARGE"] modified_sequence_a = self.metadata["MODIFIED_SEQUENCE_A"].astype(str) modified_sequence_b = self.metadata["MODIFIED_SEQUENCE_B"].astype(str) - self.metrics_val["Peptide"] = (modified_sequence_a + "_" + modified_sequence_b).apply(lambda x: "_." + x + "._") - self.metrics_val["Proteins"] = (modified_sequence_a + "_" + modified_sequence_b) + self.metrics_val["Peptide"] = (modified_sequence_a + "_" + modified_sequence_b).apply( + lambda x: "_." + x + "._" + ) + self.metrics_val["Proteins"] = modified_sequence_a + "_" + modified_sequence_b self.metrics_val["Label"] = self.target_decoy_labels else: spec_id_cols = ["RAW_FILE", "SCAN_NUMBER", "MODIFIED_SEQUENCE", "PRECURSOR_CHARGE"] @@ -523,10 +525,10 @@ def calc(self): # noqa: C901 # self.metrics_val['spectral_angle_delta_score'] = Percolator.get_delta_score(self.metrics_val[['ScanNr', # 'spectral_angle']], 'spectral_angle') pass - #else: - # self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( - # self.metrics_val[["ScanNr", "andromeda"]], "andromeda" - # ) + # else: + # self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( + # self.metrics_val[["ScanNr", "andromeda"]], "andromeda" + # ) self._reorder_columns_for_percolator() diff --git a/spectrum_fundamentals/metrics/similarity.py b/spectrum_fundamentals/metrics/similarity.py index ab45e5a..e637ccc 100644 --- a/spectrum_fundamentals/metrics/similarity.py +++ b/spectrum_fundamentals/metrics/similarity.py @@ -481,7 +481,6 @@ def _calc_additional_metrics( true_intensities, pred_intensities, "max" ) self.metrics_val[f"mse{key_suffix}"] = SimilarityMetrics.abs_diff(true_intensities, pred_intensities, "mse") - col_names_spectral_angle = [ f"spectral_angle_{amount}_charge{key_suffix}" for amount in ["single", "double", "triple"] @@ -539,5 +538,5 @@ def _calc_additional_metrics( ) self.metrics_val[f"modified_cosine{key_suffix}"] = SimilarityMetrics.modified_cosine( - true_intensities, pred_intensities, self.mz, self.mz - ) + true_intensities, pred_intensities, self.mz, self.mz + ) From 20571847cc2bcd33596d34f8a29e92751fae93d2 Mon Sep 17 00:00:00 2001 From: Mostafa Kalhor Date: Sat, 26 Oct 2024 14:38:12 +0000 Subject: [PATCH 14/14] fix get_delta_score --- spectrum_fundamentals/metrics/percolator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spectrum_fundamentals/metrics/percolator.py b/spectrum_fundamentals/metrics/percolator.py index 76fd7d1..e10909d 100644 --- a/spectrum_fundamentals/metrics/percolator.py +++ b/spectrum_fundamentals/metrics/percolator.py @@ -525,10 +525,10 @@ def calc(self): # noqa: C901 # self.metrics_val['spectral_angle_delta_score'] = Percolator.get_delta_score(self.metrics_val[['ScanNr', # 'spectral_angle']], 'spectral_angle') pass - # else: - # self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( - # self.metrics_val[["ScanNr", "andromeda"]], "andromeda" - # ) + else: + self.metrics_val["andromeda_delta_score"] = Percolator.get_delta_score( + self.metrics_val[["ScanNr", "andromeda"]], "andromeda" + ) self._reorder_columns_for_percolator()