Skip to content

Commit 1fa7aed

Browse files
Merge pull request #265 from CompOmics/release/4.0
Release/4.0
2 parents d4121ca + 85906ab commit 1fa7aed

76 files changed

Lines changed: 16217 additions & 146739 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: astral-sh/setup-uv@v6
1818

1919
- name: Run Ruff
20-
run: uvx ruff check --output-format=github .
20+
run: uvx ruff check --output-format=github ./ms2rescore/
2121

2222
test-python-package:
2323
needs: check-python-package
@@ -35,8 +35,15 @@ jobs:
3535
python-version: ${{ matrix.python-version }}
3636
enable-cache: true
3737

38+
# Temporarily skip mumble on 3.14 until rustyms supports it
3839
- name: Install the project
39-
run: uv sync --all-extras --dev
40+
run: |
41+
if [ "${{ matrix.python-version }}" = "3.14" ]; then
42+
uv sync --extra idxml --dev
43+
else
44+
uv sync --all-extras --dev
45+
fi
46+
4047
4148
- name: Run tests
4249
run: uv run pytest

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22

33
build:
4-
os: ubuntu-22.04
4+
os: ubuntu-lts-latest
55
tools:
66
python: "3.11"
77
jobs:

CHANGELOG.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- `annotate_spectra()` in `parse_spectra.py`: annotates all PSM spectra once before feature
13+
generators run, eliminating redundant per-generator spectrum annotation.
14+
- Top-level configuration options `fragmentation_model`, `tolerance_value`, and `tolerance_mode`
15+
to control centralized fragment ion annotation. Defaults: `cidhcd`, `0.02 Da`.
16+
- New `rescoring` configuration option for the ristretto rescoring engine: `train_fdr` and
17+
`model` (`"svm"`, default, or `"lda"`, faster but less powerful). Accepts `{}` for defaults,
18+
or a partial dict -- missing keys fall back to ristretto's own defaults.
19+
- New top-level `report_fdr` configuration option: FDR threshold used for console-logged
20+
identification counts, the HTML report's stats/charts, and FlashLFQ output filtering.
21+
Previously hardcoded at 1% throughout.
22+
- `ms2rescore-report` CLI: new `--fdr` option to regenerate a report at a different FDR
23+
threshold without rerunning rescoring.
24+
- Automatic inference of search-engine score direction (higher-is-better vs. lower-is-better)
25+
via spectrum-competed target-decoy evaluation, replacing the user-set `lower_score_is_better`
26+
option. Grouped by run, so multi-file input sharing native spectrum/scan IDs across runs
27+
doesn't corrupt the inferred direction.
28+
- Rescoring result tables (`<prefix>.psms.tsv`, `.peptidoforms.tsv`, `.peptides.tsv`,
29+
`.proteins.tsv`, `.weights.tsv`) are now always written as plain TSV, independent of rescoring
30+
engine internals.
31+
- `ristretto-ms` dependency: a lean, dependency-light (numpy/scikit-learn/pandas)
32+
reimplementation of the Percolator/Käll semi-supervised rescoring algorithm.
33+
- GUI: rescoring model selector (svm/lda); GUI runs now also write an HTML log file
34+
(`<prefix>.log.html`), matching the CLI.
35+
36+
### Changed
37+
38+
- Spectrum annotation is now performed once in `core.py` before all feature generators run.
39+
MS²PIP and MS2 feature generators reuse `AnnotatedMS2Spectrum` objects attached to each PSM.
40+
- MS²PIP: migrated from `correlate_preloaded` back to the now-unified `correlate()` API. Spectra
41+
are passed via `psm.spectrum`.
42+
- MS2: migrated from `ms2_features_from_ms2spectra` to `score_ms2_spectra` API. Feature set
43+
expanded to cover all ion series (a, b, c, x, y, z).
44+
- Dependencies bumped: `ms2pip>=4.2.0b1`, `ms2rescore_rs>=0.5.0b1`. Added `pyarrow>=14`.
45+
- numpy 2.0 compatibility in `charts.py` (`np.trapz``np.trapezoid`).
46+
- Rescoring engine replaced: mokapot → ristretto. Rescoring can no longer be skipped -- it
47+
always runs.
48+
- Main PSM list output renamed `<prefix>.psms.tsv``<prefix>.tsv`; the crash-recovery
49+
intermediate file renamed the same way (`<prefix>.intermediate.tsv`).
50+
- HTML report generation (both in-run and standalone via `ms2rescore-report`) reconstructs
51+
before/after rescoring comparisons from the main PSM list's provenance data and current state,
52+
rather than relying on separately persisted result tables.
53+
- Report/identification-overlap comparisons key on `(run, spectrum_id)` instead of bare
54+
`spectrum_id`, so multiple input files reusing the same native spectrum IDs no longer collide.
55+
- Multi-run PSM lists are disambiguated during rescoring/competition via ristretto's `run_col`,
56+
instead of relying on `spectrum_id` alone.
57+
- `max_psm_rank_output > 1` now applies consistently across the main output, rescoring tables,
58+
and report: multiple ranked PSMs per spectrum, with q-values/PEPs computed per-row rather than
59+
through full spectrum competition. Intended for surfacing ambiguous candidates (e.g. from
60+
Mumble), not a statistically rigorous FDR-controlled count.
61+
- Protein-level rollups use ristretto's picked-protein competition (Savitski et al. 2015) when
62+
`id_decoy_pattern` is set.
63+
64+
### Removed
65+
66+
- [BREAKING] `ms2_tolerance`, `spectrum_path`, and `spectrum_id_pattern` parameters removed from
67+
`MS2PIPFeatureGenerator`. Fragment mass tolerance is set globally via `tolerance_value` /
68+
`tolerance_mode` in the top-level configuration (default: `0.02 Da`).
69+
- [BREAKING] `spectrum_path`, `spectrum_id_pattern`, `mass_mode`, and `processes` parameters
70+
removed from `MS2FeatureGenerator`. Spectra are provided via centralized `annotate_spectra()`.
71+
- [BREAKING] Mokapot rescoring engine and the `mokapot` dependency removed, along with the
72+
`ms2rescore.rescoring_engines` module.
73+
- [BREAKING] `rescoring_engine` configuration option removed (mokapot-specific: `fasta_file`,
74+
`write_weights`, `write_txt`, `protein_kwargs`), replaced by `rescoring` (see Added).
75+
- [BREAKING] `fasta_file` configuration option and FASTA-based protein inference removed.
76+
- [BREAKING] `lower_score_is_better` configuration option removed. Score direction is now always
77+
auto-inferred (see Added) with no config-level override.
78+
- [BREAKING] `write_rescoring_tables` configuration option removed -- rescoring tables are
79+
unconditionally written now.
80+
- [BREAKING] PIN (Percolator) file output removed for `log_level=debug` -- the main PSM list
81+
TSV already carries all rescoring features.
82+
- [BREAKING] Ability to skip rescoring via configuration removed. `rescoring: null` is now
83+
rejected by config validation instead of being silently ignored; rescoring always runs.
84+
- [BREAKING] `ms2rescore.utils` (public) renamed to `ms2rescore._utils` (internal) and merged
85+
with the new rescoring integration layer -- no longer part of the public API surface.
86+
87+
### Fixed
88+
89+
- MS²PIP features incorrectly computed for multi-rank PSMs (`max_psm_rank_input > 1`): all
90+
PSMs sharing a spectrum ID received the annotation of the first-seen PSM, producing a bimodal
91+
`spec_pearson_norm` distribution. Fixed in ms2pip (per-PSM annotation) and reflected in
92+
ms2rescore via centralized per-PSM `annotate_spectra()`.
93+
- DeepLC RT features incorrectly assigned across PSMs: missing `sort_index()` after q-value sort
94+
for calibration caused PSMs to receive another PSM's RT predictions.
95+
- `processes=-1` (ms2rescore default) passed to DeepLC `num_threads`, which requires a positive
96+
integer or `None`.
97+
- Q-value NaN check in `parse_psms.py` failed when `qvalue` array contained `None` values.
98+
- `BrokenExecutor` not caught in mokapot rescoring engine.
99+
- Fragment mass tolerance fallback defaults in `core.py` incorrectly set to `20.0 ppm` instead
100+
of `0.02 Da`.
101+
- GUI runs never wrote an HTML log file (`<prefix>.log.html`), unlike CLI runs -- the GUI's
102+
logging setup only ever attached a plain text-file handler.
103+
104+
## [3.3.0a1] - 2026-04-09
105+
106+
### Added
107+
108+
- New MS2 feature generator using Rust-based `ms2rescore_rs` for direct spectrum feature
109+
extraction (intensity ratios, matched ion counts/percentages, hyperscore).
110+
- Mumble integration as an optional PSM generator for exploring alternative peptide
111+
identifications with mass shift modifications (`pip install ms2rescore[mumble]`).
112+
- Intermediate file output (`.intermediate.psms.tsv`) on feature generation or rescoring errors,
113+
enabling recovery by rerunning with modified configuration.
114+
- Intelligent skipping of feature generators when all their features are already present in the
115+
PSM file (e.g., from an intermediate recovery run).
116+
- New basic features: `theoretical_mass`, `experimental_mass`, `mass_error`, `pep_len`.
117+
- Standalone report generation from PSM TSV files without requiring full config or log files.
118+
- `ParseSpectrumError` exception for spectrum parsing failures.
119+
120+
### Changed
121+
122+
- Migrated MS2 and MS2PIP feature calculations to Rust via `ms2rescore_rs`, significantly
123+
improving performance (~5x speed-up).
124+
- Spectrum files are now parsed once and stored as `MS2Spectrum` objects, replacing the previous
125+
per-feature-generator parsing approach.
126+
- DeepLC integration upgraded to v4 API: dataset-wide processing, fine-tuning enabled by
127+
default, `SplineTransformerCalibration` for retention time calibration.
128+
- IM2Deep integration upgraded to v2 API: dataset-wide processing with per-run
129+
`LinearCCSCalibration` using reference peptides.
130+
- MS2PIP integration upgraded to use preloaded spectra and Rust-based feature calculation.
131+
- Basic feature generator now uses fixed charge encoding (charges 1-6) instead of dynamic
132+
min-max range.
133+
- Report generation CLI now accepts PSM file path with optional `--output` flag.
134+
- Charge-stripping regex pattern consolidated into shared `CHARGE_PATTERN` constant.
135+
- Upgraded dependencies: `deeplc>=4.0.0a2`, `im2deep>=2.0.0a2`, `ms2pip>=4.2.0a0`,
136+
`ms2rescore_rs>=0.5.0a0`.
137+
138+
### Removed
139+
140+
- MaxQuant feature generator (functionality consolidated into MS2 feature generator).
141+
- ionmob feature generator (replaced by IM2Deep v2).
142+
- `deeplcretrainer` dependency (functionality merged into DeepLC v4).
143+
144+
### Fixed
145+
146+
- Percolator kwargs silently ignored due to parameter name shadowing local variable.
147+
- Unreachable and broken error handlers in Percolator subprocess execution.
148+
- `fdr` parameter ignored in `_log_id_psms_before` (hardcoded to 0.01).
149+
- Out-of-memory errors from multiprocessing in spectrum parsing.

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ Modular and user-friendly platform for AI-assisted rescoring of peptide identifi
1313
## About MS²Rescore
1414

1515
MS²Rescore performs ultra-sensitive peptide identification rescoring with LC-MS predictors such as
16-
[MS²PIP][ms2pip] and [DeepLC][deeplc], and with ML-driven rescoring engines
17-
[Percolator][percolator] or [Mokapot][mokapot]. This results in more confident peptide
18-
identifications, which allows you to get **more peptide IDs** at the same false discovery rate
19-
(FDR) threshold, or to set a **more stringent FDR threshold** while still retaining a similar
20-
number of peptide IDs. MS²Rescore is **ideal for challenging proteomics identification workflows**,
21-
such as proteogenomics, metaproteomics, or immunopeptidomics.
22-
23-
![MS²Rescore overview](https://raw.githubusercontent.com/compomics/ms2rescore/main/docs/source/_static/img/ms2rescore-overview.png)
16+
[MS²PIP][ms2pip] and [DeepLC][deeplc]. This results in more confident peptide identifications
17+
which allows you to get **more peptide IDs** at the same false discovery rate (FDR) threshold, or
18+
to set a **more stringent FDR threshold** while still retaining a similar number of peptide IDs.
19+
MS²Rescore is **ideal for challenging proteomics identification workflows**, such as
20+
proteogenomics, metaproteomics, or immunopeptidomics.
2421

2522
MS²Rescore can read peptide identifications in any format supported by [psm_utils][psm_utils]
2623
(see [Supported file formats][file-formats]) and has been tested with various search engines output
@@ -106,8 +103,7 @@ make a [pull request][pr]!
106103
[publication-branch]: https://github.com/compomics/ms2rescore/tree/pub
107104
[ms2pip]: https://github.com/compomics/ms2pip
108105
[deeplc]: https://github.com/compomics/deeplc
109-
[percolator]: https://github.com/percolator/percolator/
110-
[mokapot]: https://mokapot.readthedocs.io/
106+
[ristretto]: https://pypi.org/project/ristretto-ms/
111107
[psm_utils]: https://github.com/compomics/psm_utils
112108
[file-formats]: https://psm-utils.readthedocs.io/en/stable/#supported-file-formats
113109
[tims2rescore]: https://ms2rescore.readthedocs.io/en/stable/userguide/tims2Rescore
-378 KB
Binary file not shown.
-94.6 KB
Binary file not shown.

docs/source/api/ms2rescore.feature_generators.rst

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,10 @@ ms2rescore.feature_generators.im2deep
4343

4444

4545

46-
ms2rescore.feature_generators.ionmob
47-
####################################
48-
49-
.. automodule:: ms2rescore.feature_generators.ionmob
50-
:members:
51-
52-
53-
54-
ms2rescore.feature_generators.maxquant
55-
######################################
46+
ms2rescore.feature_generators.ms2
47+
#################################
5648

57-
.. automodule:: ms2rescore.feature_generators.maxquant
49+
.. automodule:: ms2rescore.feature_generators.ms2
5850
:members:
5951

6052

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
********************
2+
ms2rescore.rescoring
3+
********************
4+
5+
.. automodule:: ms2rescore.rescoring
6+
:members:

docs/source/api/ms2rescore.rescoring_engines.rst

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"numpy": ("https://numpy.org/doc/stable/", None),
5151
"plotly": ("https://plotly.com/python-api-reference/", None),
5252
"psm_utils": ("https://psm-utils.readthedocs.io/en/stable/", None),
53-
"mokapot": ("https://mokapot.readthedocs.io/en/stable/", None),
5453
}
5554

5655
# nbsphinx options

0 commit comments

Comments
 (0)