Repository navigation
[PARAM] UniPEFF: map canonical annotations onto isoform entries by default - #10887
Conversation
…fault Isoform entries now carry the canonical entry's annotations, mapped through their splice variants, without a flag (as requested in #10643). The new flag -omit_canonical_features leaves them out; -map_canonical_features is removed (it was only in nightlies). Annotations UniProt makes on an isoform itself are written either way. Expected outputs of the UniPEFF tests with isoforms are updated; TOPP_UniPEFF_21 covers -omit_canonical_features.
…ications off changed isoform termini Review of #10776: with canonical mapping now on by default, an isoform whose splice variant changes the N-terminus got the canonical N-terminal annotations at internal positions (e.g. N-acetylalanine 2 -> 8 and chain 2-30 -> 8-36 for an N-terminal extension M1 -> MPRLLSG). - A processed region's ends are cleavage sites; the isoform keeps one only if both residues next to it lie outside every splice variant. A region whose cleavage site is not kept is not mapped, except one starting right after a removed initiator methionine, which then starts at the isoform's N-terminus. The initiator methionine itself needs residue 2 to be kept. - Modifications the ptmlist places at a chain terminus ("PP N-terminal." / "PP C-terminal.", e.g. N-acetylalanine, pyroglutamate, amidation) are not mapped if the residue before / after them lies in a splice variant. - New unit test sections and TOPP_UniPEFF_22 cover both.
…erminal CodeRabbit review of #10776: a cross-link whose ptmlist position is "N-terminal-C-terminal." links the first and last residue of a peptide (e.g. kalata B1, "Cyclopeptide (Gly-Asn)"), so it now needs both cleavage sites kept, like the peptide. Other compound values stay unused: their terminus can lie in another protein ("Anywhere-C-terminal.", ubiquitin) or name backbone groups of internal residues ("C-terminal-N-terminal.", the GFP-like 5-imidazolinone chromophore). Also name the changed cleavage site or chain terminus in the end-of-run summary of annotations not mapped onto isoforms.
…ast residue CodeRabbit review of #10776: with both terminus flags set, every linked residue of a head-to-tail cyclopeptide got both checks, so a splice variant inside the peptide next to one end dropped the cross-link although the peptide's cleavage sites were kept (and the peptide itself was mapped). The N-terminal check now applies to the feature's first residue and the C-terminal check to its last; single-residue modifications are unchanged.
…l cross-links
The PP line names one position per residue of a modification. Only "N-terminal.",
"C-terminal." and "N-terminal-C-terminal." were recognised, so other intrachain
cross-links that need a chain terminus were mapped onto isoforms whose splice variants
change that cleavage site: lasso peptides ("N-terminal-Anywhere.",
"N-terminal-Protein core.") and the aminovinyl-cysteine of lantibiotics
("Anywhere-C-terminal.").
PtmEntry now keeps the parsed positions (parseChainPositions()). A range cross-link
needs the site before its first residue if the first is N-terminal, and the site after
its last if the last is C-terminal. A feature at one position uses the first part,
i.e. the residue in this protein of an interchain link. The chromophore values
("C-terminal-N-terminal.", "Protein core-N-terminal.") still make no chain terminus.
The cleavage sites a feature needs are now computed once per canonical feature, not
once per isoform. The -omit_canonical_features help again says it has no effect with
-omit_isoforms.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmaq85rY3JjTXivaJXx
|
Drafted with Claude Code. Generated by Claude Code |
|
No actionable comments were generated in the recent review. Walkthrough
Change: Feature Merge Risk:
|
timosachsenberg
left a comment
There was a problem hiding this comment.
AI-generated initial review
This is an automated, AI-generated first review. It looks only for high- and medium-priority issues (no nits) and checks whether the PR has tests and measurements. Please double-check anything before acting on it; a maintainer will follow up. I reviewed 49e79e8b against develop (2287ee55, which is also this PR's base).
What I ran:
-
CI:
- All five
build-and-testjobs passed, as didheader-set-compatibility,cppcheck-testand the Linux, macOS and Windows wheels. build-wheels-linux-armfailed indnfbefore it built anything, as you noted.
- All five
-
Build:
- I used the nightly
OpenMS-SDK-2026.11.13-Linux-x86_64. It was built from2287ee55, this PR's base. - I compiled with GCC 13.3, Release,
-Wall -Wextra: theUniPEFFtool andUniPEFFEntries_test, each from this PR and from the base, plusFuzzyDiff. The test framework comes fromsrc/testframework. - There were no warnings.
- I used the nightly
-
Tests:
UniPEFFEntries_testpasses all 9 sections, including your new ones. The description says that the follow-up's cases ran only against stand-ins for the test and logging headers. This run closes that gap.- All 44
TOPP_UniPEFFtests pass withFuzzyDiffand the PR's references, including the new 21 and 22. On the base, all 40 pass.
-
ptmlist:
- The bundled snapshot (2026_02) and the current UniProt release (2026_04) have the same 16 distinct
PPvalues. I ran the PR'sparseChainPositions()on each, and it understands all of them. - The 28 interchain IDs end in "(interchain with X-...)". So UniProt's descriptions, such as "(interchain with G-Cter in ubiquitin)", never match them, as you write.
- The bundled snapshot (2026_02) and the current UniProt release (2026_04) have the same 16 distinct
-
Real data:
- The data: human Swiss-Prot from UniProt REST today, with 20,429 entries and 22,131 reconstructed isoforms. I used the bundled ptmlist and PSI-MOD.
- The runs: this PR with default settings and with
-omit_canonical_features, and the base with default settings and with-map_canonical_features.
Run Canonical annotations mapped Not mapped base, -map_canonical_features269,697 74,271 PR, default 268,145 75,823 - With
-omit_canonical_features, the output is byte-identical to the base's default output. - Against the base's
-map_canonical_features, 1,540 isoform headers differ. Here are all the differences:
Change with this PR Isoform annotations chain not mapped (the base clipped it) 1,244 chain starts at isoform residue 1 instead of at a clipped start (the removed-Met rule) 324 signal peptide / transit peptide / propeptide not mapped 154 / 28 / 64 initiator methionine not mapped (residue 2 changed) 2 N-terminal modification not mapped: N-acetyl-Ala 32, -Ser 14, -Thr 5, -Val 2, -Met 1, and N-myristoyl-Gly 5 59 C-terminal modification not mapped (the GPI anchor of CD59 isoform 2) 1 - I wrote an independent script that applies the rules of your description to the XML. It agrees with the PR on every one of these.
- In the base, the N-terminal modifications sat on internal residues. For example, O00410-3 has an N-terminal extension (M1 → MPEDQVGKLEATENTISAM), and the base put N-acetylalanine at its residue 20. So the PR fixes real misplacements.
- OpenMS's
PEFFFilereads all four outputs, and no\Processedregion lies outside its sequence.
Verdict:
- High priority: none.
- Medium priority: none.
- A smaller gap: an isoform that starts or ends exactly at a canonical cleavage site loses the chain and any terminal modification there. In human Swiss-Prot, that is 7 chains and 1 modification. A patch with a test is below.
- Checked and fine:
- The removed-Met rule. For example, in O00408-2 (PDE2A1), 27 residues replace residues 1–48. The chain 2–941 becomes 1–920 instead of the base's 28–920, and the N-myristoyl-Gly2 is not mapped.
pp.front()for a range's first residue andpp.back()for its last. An N-terminal part is the lowest residue of its chain and a C-terminal part the highest. So the order of the ID and the order of the sequence agree wherever it matters.- CRLF lines. The ptmlist reader trims the CR before it calls
parseChainPositions(). met_removed. It sees the initiator Met only when processing is recorded. That is consistent, because chains are not written otherwise.
- CodeRabbit: no actionable comments.
Smaller gap: an isoform that starts or ends exactly at a canonical cleavage site
- Where:
cleavageSiteKept(), as used inmapFeature()and in thesiteKeptlambda ofprepareEntry(). - Why:
- How UniProt describes an alternative start. A splice variant deletes residues 1..k, so the canonical residue k+1 becomes the isoform's residue 1.
- No cleavage is needed. If k|k+1 is the end of a transit or signal peptide, k+1 is already the isoform's N-terminus.
- What the PR does. It counts the site as changed, because residue k lies in a splice variant. So it drops the chain and any N-terminal modification of k+1. The base mapped both correctly.
- It is inconsistent with the removed-Met rule. That rule lets a chain start at the isoform's residue 1 even when an unrelated sequence replaces the N-terminus.
- The C-terminal mirror: a deletion of k+1..N, after a chain that ends at k.
- Shown on human Swiss-Prot: 7 chains and 1 modification. Six are cytoplasmic isoforms that skip the mitochondrial transit peptide:
- Q05932-2 (FPGS, cytoplasmic) loses the chain 43–587 and the N-acetylmethionine of M43, which is the isoform's residue 1.
- O95822-2 (MLYCD), P00390-2 (GSR), P09543-2 (CNP), P29372-5 (MPG) and P30044-2 (PRDX5) lose the chain.
- The seventh, O95633-2 (FSTL3), has a deletion that ends with its signal peptide.
- Impact: small. A chain that covers the whole isoform marks no new terminus. The real loss is the N-terminal modification: one in human, and more in proteomes with more alternative starts.
- Mitigation:
- Count the site as kept when a pure deletion from the canonical N-terminus ends right before it, or a pure deletion to the C-terminus starts right after it. The patch below does that.
- On human Swiss-Prot, the patch restores exactly those 8 annotations and changes nothing else. The class test and all 44 TOPP tests still pass.
- The two places in
UniPEFF.cppthat describe the rule would each need one more sentence.
Patch, with a test section that fails on the PR and passes with the patch (applies cleanly to 49e79e8b)
diff --git a/src/topp/UniPEFF/source/UniPEFFEntries.cpp b/src/topp/UniPEFF/source/UniPEFFEntries.cpp
--- a/src/topp/UniPEFF/source/UniPEFFEntries.cpp
+++ b/src/topp/UniPEFF/source/UniPEFFEntries.cpp
@@ -215,6 +215,19 @@ namespace
return mapPosition(p, edits, canonical_length) != 0 && mapPosition(p + 1, edits, canonical_length) != 0;
}
+ /// True if the isoform starts with canonical residue @p p + 1 (a splice variant deletes residues 1..p) or ends with
+ /// canonical residue @p p (one deletes p + 1..canonical_length): the residue is then the isoform's own terminus, as
+ /// for an alternative start that skips a transit peptide.
+ bool siteBecomesTerminus(int p, const std::vector<SpliceEdit>& edits, int canonical_length)
+ {
+ if (edits.empty()) return false;
+ const SpliceEdit& n = edits.front();
+ const SpliceEdit& c = edits.back();
+ return (n.begin == 1 && n.end == p && n.replacement_length == 0 && mapPosition(p + 1, edits, canonical_length) != 0)
+ || (c.begin == p + 1 && c.end == canonical_length && c.replacement_length == 0
+ && mapPosition(p, edits, canonical_length) != 0);
+ }
+
/// Map the coordinates of the canonical feature @p f onto an isoform built by @p edits; returns
/// false (and leaves @p mapped unspecified) if the isoform does not contain it:
/// - a single position, and each of the two linked residues of a disulfide bond or cross-link,
@@ -262,10 +275,12 @@ namespace
if (f.begin == 1) mapped.begin = 1;
else if (cleavageSiteKept(f.begin - 1, edits, canonical_length)) mapped.begin = mapPosition(f.begin, edits, canonical_length);
else if (f.begin == 2 && met_removed) mapped.begin = 1; // whether the isoform's own Met is removed is unknown
+ else if (siteBecomesTerminus(f.begin - 1, edits, canonical_length)) mapped.begin = 1;
else return false;
if (f.end == canonical_length) mapped.end = isoform_length;
else if (cleavageSiteKept(f.end, edits, canonical_length)) mapped.end = mapPosition(f.end, edits, canonical_length);
+ else if (siteBecomesTerminus(f.end, edits, canonical_length)) mapped.end = isoform_length;
else return false;
return true;
}
@@ -880,7 +895,7 @@ namespace
{
IsoformEntry& iso = pe.isoforms[i];
const std::vector<SpliceEdit>& edits = isoform_edits[i];
- auto siteKept = [&](int site) { return site == 0 || cleavageSiteKept(site, edits, canonical_length); };
+ auto siteKept = [&](int site) { return site == 0 || cleavageSiteKept(site, edits, canonical_length) || siteBecomesTerminus(site, edits, canonical_length); };
for (size_t j = 0; j < canonical_annotated.size(); ++j)
{
const UniProtFeature* f = canonical_annotated[j];
diff --git a/src/topp/UniPEFF/test/UniPEFFEntries_test.cpp b/src/topp/UniPEFF/test/UniPEFFEntries_test.cpp
--- a/src/topp/UniPEFF/test/UniPEFFEntries_test.cpp
+++ b/src/topp/UniPEFF/test/UniPEFFEntries_test.cpp
@@ -571,6 +571,44 @@ START_SECTION(([EXTRA] map_canonical_features: cleavage sites and chain-terminal
}
END_SECTION
+START_SECTION(([EXTRA] map_canonical_features: an isoform that starts or ends at a canonical cleavage site))
+{
+ // An alternative start that skips the targeting peptide (e.g. the cytoplasmic isoforms of FPGS, GSR or PRDX5:
+ // "Missing 1-k" with the canonical chain starting at k + 1) and its C-terminal mirror. The residue next to the
+ // deleted region is the isoform's own terminus, so the chain starts or ends there and a modification the ptmlist places at
+ // that terminus is still at one.
+ SkippedIsoformCounts skipped;
+ UniProtEntry e = cleavageSiteFeatures();
+ e.isoforms = {isoform("P99999-1", "displayed"), isoform("P99999-2", "described", "VSP_START"),
+ isoform("P99999-3", "described", "VSP_END")};
+ e.features.resize(6); // signal peptide, chain, propeptide and the three modifications
+ e.features.push_back(splice("VSP_START", 1, 10));
+ e.features.push_back(splice("VSP_END", 25, 30));
+ PreparedEntry pe = prepare(e, true, skipped, true);
+ ABORT_IF(pe.isoforms.size() != 2)
+ TEST_EQUAL(pe.isoforms[0].sequence, "PGRSTWEVQLKDNACYLRGE")
+ TEST_EQUAL(pe.isoforms[1].sequence, "MAEQCKTLDAPGRSTWEVQLKDNA")
+ // -2 starts with P11: chain 11-24 -> 1-14 and N,N-dimethylproline 11 -> 1; the signal peptide is deleted
+ const EntryAnnotations& start = pe.isoforms[0].annotations;
+ TEST_TRUE(modPositions(start) == std::vector<int>({1, 4, 14}))
+ ABORT_IF(start.processed.size() != 2)
+ TEST_EQUAL(start.processed[0].type_name, "mature protein")
+ TEST_EQUAL(start.processed[0].begin, 1)
+ TEST_EQUAL(start.processed[0].end, 14)
+ TEST_EQUAL(start.processed[1].type_name, "propeptide")
+ TEST_EQUAL(start.processed[1].begin, 15)
+ TEST_EQUAL(start.processed[1].end, 20)
+ // -3 ends with A24: chain 11-24 -> 11-24 and the amidated A24 stays at the C-terminus; the propeptide is deleted
+ const EntryAnnotations& end = pe.isoforms[1].annotations;
+ TEST_TRUE(modPositions(end) == std::vector<int>({11, 14, 24}))
+ ABORT_IF(end.processed.size() != 2)
+ TEST_EQUAL(end.processed[0].type_name, "signal peptide")
+ TEST_EQUAL(end.processed[1].type_name, "mature protein")
+ TEST_EQUAL(end.processed[1].begin, 11)
+ TEST_EQUAL(end.processed[1].end, 24)
+}
+END_SECTION
+
START_SECTION(std::vector<ChainPosition> parseChainPositions(const std::string& pp))
{
using V = std::vector<ChainPosition>;Tests
-
You added:
TOPP_UniPEFF_21(-omit_canonical_features) andTOPP_UniPEFF_22(an N-terminal extension);- the updated expected outputs;
- class-test sections for cleavage sites, terminal modifications, the cross-link variants and
parseChainPositions().
They cover the new rules well, and all of them pass in my build.
-
Not covered: an isoform with a pure N-terminal deletion ("Missing 1-k"), which is the most common alternative start.
- No test has it with a removed Met, where the chain 2-N maps to start at 1.
- None has the exact case above either. The section in the patch covers that case and its C-terminal mirror.
-
PR template: "New and existing unit tests pass locally" and the first box of the AI-policy section are unticked.
- CI and my run above cover the tests.
- The AI-policy box is for you or the original contributor to tick.
Measurements
- The description has none. For a change of the default output, the human Swiss-Prot run above can stand in.
- Runtime and memory:
- I ran 3 interleaved repeats each of the base default, the PR default and the base with
-map_canonical_features, on 4 cores. - All three took 8.0–8.8 s wall time with 49–50 MB peak memory, so there is no measurable cost.
- I ran 3 interleaved repeats each of the base default, the PR default and the base with
- Output size: with the new default, the human PEFF grows from 39.0 to 47.0 MB (+20 %).
- Isoform entries now carry 143,459 modifications and 26,860 processed regions. With the base default they carried 959 and 70.
- Simple variants grow from 84,197 to 196,105 over the whole file.
- This is what #10643 intends. Still, search engines that use PEFF variants and modifications will search a larger space for isoforms by default. A line in the
-omit_canonical_featureshelp could say so.
Generated by Claude Code
Description
Continues #10776 by @aliviahossain. Its commits are included unchanged, with their authorship, plus one follow-up commit from the review there. #10776 is closed in favour of this PR because the follow-up could not be pushed to the fork's branch.
Follow-up to #10699. As agreed in #10643, isoform entries now carry the canonical entry's annotations by default, mapped through their splice variants. The new flag
-omit_canonical_featuresleaves them out. Annotations UniProt makes on an isoform itself are written either way, and isoform expansion (-omit_isoforms) is unchanged.-map_canonical_featuresfrom #10699 is removed: it was only in nightlies, never in a release.Mapping rules for cleavage sites and termini (from #10776):
PP N-terminal./PP C-terminal., e.g. N-acetylalanine or an amidated residue) is not mapped if the residue before or after it lies in a splice variant. There it would sit inside the isoform's chain.Follow-up commit (
49e79e8), design intent:PPline names one position per residue of a modification. [PARAM] UniPEFF: map canonical annotations onto isoform entries by default #10776 recognised onlyN-terminal.,C-terminal.andN-terminal-C-terminal.. The line is now parsed per residue (parseChainPositions(), stored inPtmEntry::chain_positions).N-terminal-Anywhere.,N-terminal-Protein core.) and the aminovinyl-cysteine of lantibiotics (Anywhere-C-terminal.).C-terminal-N-terminal.,Protein core-N-terminal.) name backbone groups of internal residues and still need no site.-omit_canonical_featureshelp again says that it has no effect with-omit_isoforms.Tests:
-omit_canonical_features), TOPP_UniPEFF_22 (an N-terminal extension) and class-test sections for cleavage sites and terminal modifications. The author reported all UniPEFF tests passing locally.parseChainPositions()section. These were compiled and run with the realUniPEFFEntries.cppagainst stand-ins for the OpenMS test and logging headers: 197/197 checks pass. They have not been run in a full OpenMS build, and the TOPP tests were not run for the follow-up. The TOPP test ptmlist only marks N-acetylalanine, whose handling is unchanged, so no fixture changes are expected; CI is the first full build of this commit.Checklist
AI use (see the OpenMS AI Policy)
Assisted-by:trailerCo-authored-by:trailer, and the description above explains the design intent and rationaleNo need to edit the CHANGELOG file: entries are generated automatically once per week from merged changes.
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.Generated by Claude Code
Summary by CodeRabbit
-omit_canonical_featuresoption to skip this mapping.