Skip to content

Keep valid semi-specific peptides from long cleavage products - #223

Merged
levitsky merged 1 commit into
levitsky:masterfrom
antonsoo:fix/semi-cleavage-length
Oct 23, 2026
Merged

levitsky merged 1 commit into
levitsky:masterfrom
antonsoo:fix/semi-cleavage-length

Conversation

@antonsoo

Copy link
Copy Markdown
Contributor
from pyteomics import parser

print(parser.xcleave('PEPTIDEK', 'trypsin', semi=True,
                    min_length=3, max_length=5))

This returns [] before the change. The expected result is [(0, 'PEP'), (0, 'PEPT'), (0, 'PEPTI'), (3, 'TIDEK'), (4, 'IDEK'), (5, 'DEK')].

Generate semi-specific prefixes and suffixes independently of whether the full cleavage product satisfies the length limit. Include prefixes whose length equals max_length. Two regression tests cover exact bounds and preserve the order and duplicates of the equivalent unbounded result followed by a length filter, including missed cleavages.

An independent enumeration on four UniProt albumin/hemoglobin sequences agrees with all 80 digestion and precursor-planning configurations after the change; 42 configurations previously omitted candidates. All 38 previously correct records remain identical. Another 2,880 constructed short-sequence cases agree with exhaustive interval enumeration.

Validation uses Python 3.10/NumPy 1.26 and Python 3.12/NumPy 2.5, the project's per-file test commands, and an isolated wheel replay. The separate isoelectric-point correction also composes cleanly and preserves these results.

All 27 project CI test files succeed on each dependency profile (491 tests, including one live-PostgreSQL service skip).

@levitsky
levitsky merged commit 5651f6d into levitsky:master Oct 23, 2026
15 checks passed
@levitsky

Copy link
Copy Markdown
Owner

Thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants