Skip to content

[PARAM] UniPEFF: map canonical annotations onto isoform entries by default - #10887

Merged
timosachsenberg merged 6 commits into
developfrom
feature/unipeff-map-canonical-by-default
Nov 13, 2026
Merged

timosachsenberg merged 6 commits into
developfrom
feature/unipeff-map-canonical-by-default

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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_features leaves them out. Annotations UniProt makes on an isoform itself are written either way, and isoform expansion (-omit_isoforms) is unchanged. -map_canonical_features from #10699 is removed: it was only in nightlies, never in a release.

Mapping rules for cleavage sites and termini (from #10776):

  • A processed region (chain, propeptide, signal or transit peptide, initiator methionine) may span a splice variant, but it is mapped only if the isoform keeps its cleavage sites, i.e. both residues at each cut lie outside every splice variant.
  • A region starting right after a removed initiator Met starts at the isoform's residue 1 when a splice variant changes residue 1 or 2. Whether the isoform's own Met is removed is unknown, and the residue is then kept, as discussed in [PARAM] UniPEFF: map canonical annotations onto isoform entries by default #10776.
  • A modification that the ptmlist places at a chain terminus (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:

  • The ptmlist PP line names one position per residue of a modification. [PARAM] UniPEFF: map canonical annotations onto isoform entries by default #10776 recognised only N-terminal., C-terminal. and N-terminal-C-terminal.. The line is now parsed per residue (parseChainPositions(), stored in PtmEntry::chain_positions).
  • A cross-link between two residues of the protein needs the cleavage site before its first residue if that part is N-terminal, and the site after its last residue if that part is C-terminal. This covers head-to-tail cyclopeptides as before, and now also lasso peptides (N-terminal-Anywhere., N-terminal-Protein core.) and the aminovinyl-cysteine of lantibiotics (Anywhere-C-terminal.).
  • The chromophore values (C-terminal-N-terminal., Protein core-N-terminal.) name backbone groups of internal residues and still need no site.
  • A feature at a single position uses the first part, which for an interchain link is the residue in this protein. In practice UniProt's interchain descriptions (e.g. "(interchain with G-Cter in ubiquitin)") don't match the ptmlist IDs, so they are not looked up.
  • The cleavage sites each canonical feature needs are computed once per entry, not once per isoform.
  • The -omit_canonical_features help again says that it has no effect with -omit_isoforms.

Tests:

  • From [PARAM] UniPEFF: map canonical annotations onto isoform entries by default #10776: the expected outputs of the UniPEFF tests with reconstructable isoforms gain the mapped annotations. New are TOPP_UniPEFF_21 (-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.
  • Follow-up: new class-test cases (lasso peptide, lantibiotic, both chromophores, interchain links) and a parseChainPositions() section. These were compiled and run with the real UniPEFFEntries.cpp against 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

  • Make sure that you are listed in the AUTHORS file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

AI use (see the OpenMS AI Policy)

  • I have read the OpenMS AI Policy, and I understand, have reviewed and tested every change in this PR and can explain it in my own words
  • AI use in this PR (tick one):
    • None
    • Assisted (e.g. completion, suggestions, small edits); commits carry an Assisted-by: trailer
    • Substantial (e.g. agentic tools wrote significant parts); commits carry a Co-authored-by: trailer, and the description above explains the design intent and rationale

No 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 out

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.

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Canonical protein annotations now map to isoforms by default. Use the new -omit_canonical_features option to skip this mapping.
    • Mapping accounts for splice changes, cleavage sites, protein termini, and terminal modifications or cross-links.
  • Bug Fixes
    • Improved annotation placement for isoforms with altered or removed N-termini, including cases where the initiator methionine is removed.
    • Annotations that depend on cleavage sites changed by splicing are now left unmapped rather than placed incorrectly.

aliviahossain and others added 6 commits October 29, 2026 16:38
…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

Copy link
Copy Markdown
Contributor Author

build-wheels-linux-arm failed before OpenMS was built. In the manylinux container, dnf could not read the AlmaLinux 9 AppStream metadata (repomd.xml parser error: ... Document is empty, log). That is a package-mirror problem that doesn't involve this diff (UniPEFF sources and tests only), and the same workflow passed on the recent PR runs and last night's nightly. GitHub doesn't allow re-running the job while the rest of the wheel run is still going, so I'll re-run it once when the run has finished.

Drafted with Claude Code.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

UniPEFF now maps canonical annotations to isoforms by default. The new -omit_canonical_features option disables this mapping. Mapping rules account for splice-altered cleavage sites, processed-region boundaries, initiator-methionine removal, and terminal PTM positions.

Changes: UniPEFF mapping behavior

Layer / File(s) Summary
PTM metadata and mapping option
src/topp/UniPEFF/include/UniPEFFEntries.h, src/topp/UniPEFF/source/UniPEFFEntries.cpp, src/topp/UniPEFF/UniPEFF.cpp
The PTM model and parser support chain-position metadata from PP records. Canonical mapping is enabled by default, and -omit_canonical_features disables it.
Isoform mapping rules
src/topp/UniPEFF/source/UniPEFFEntries.cpp, src/topp/UniPEFF/include/UniPEFFEntries.h, src/topp/UniPEFF/UniPEFF.cpp
Feature mapping checks required cleavage sites. Processed-region boundaries map to isoform termini when applicable, and annotations that fail mapping checks are counted as unmapped.
Mapping regression coverage
src/topp/UniPEFF/test/UniPEFFEntries_test.cpp, src/tests/topp/CMakeLists.txt, src/tests/topp/UniPEFF_*
Unit and TOPP tests cover mapping defaults and opt-out behavior, splice and terminal cases, PTM metadata, and expected PEFF annotations.

Sequence Diagram(s)

sequenceDiagram
  participant UniPEFF
  participant loadPtmlist
  participant parseChainPositions
  participant prepareEntry
  participant terminalCleavageSites
  participant mapFeature
  participant PEFFWriter
  UniPEFF->>loadPtmlist: Read PTM-list records
  loadPtmlist->>parseChainPositions: Parse PP chain positions
  UniPEFF->>prepareEntry: Prepare canonical annotations and isoforms
  prepareEntry->>terminalCleavageSites: Find required PTM cleavage sites
  prepareEntry->>mapFeature: Map feature coordinates and check cleavage sites
  prepareEntry->>PEFFWriter: Write mapped isoform annotations
Loading

Change: Feature

Merge Risk: Minimal · up to 49e79

UniPEFF now maps canonical annotations onto isoforms by default, and -omit_canonical_features disables that mapping. No actionable merge-blocking issue was identified. Rely on CI for the full build and TOPP test results before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: canonical UniProt annotations are now mapped onto isoform entries by default. The raw summary and PR objectives both describe this change, which replaces the opt-in -m…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: canonical UniProt annotations are now mapped onto isoform entries by default. The raw summary and PR objectives both describe this change, which replaces the opt-in -map_canonical_features flag with -omit_canonical_features. The title is specific and uses the [PARAM] prefix convention for a parameter change. It does not cover the cleavage-site, terminus, and PP chain-position parsing changes, which is acceptable for a title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks each splice-site line,
And maps the features, fine by fine.
Where cleavage holds, the notes take flight,
Where boundaries shift, they skip from sight.
New PEFF records greet the night.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1025706b-f441-45ca-aa77-0ebcdec728a4
Commits

Reviewing files that changed from the base of the PR and between 2287ee5 and 49e79e8.

Files selected for processing: 20

  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/UniPEFF_1_output_A.peff
  • src/tests/topp/UniPEFF_1_output_B.peff
  • src/tests/topp/UniPEFF_1_psi-mod.obo
  • src/tests/topp/UniPEFF_1_ptmlist.txt
  • src/tests/topp/UniPEFF_2_output_omitmods.peff
  • src/tests/topp/UniPEFF_2_output_omitproc.peff
  • src/tests/topp/UniPEFF_2_output_omitvar.peff
  • src/tests/topp/UniPEFF_2_output_prefix.peff
  • src/tests/topp/UniPEFF_3_output_isoforms.peff
  • src/tests/topp/UniPEFF_5_output_A.peff
  • src/tests/topp/UniPEFF_5_output_B.peff
  • src/tests/topp/UniPEFF_6_input_canonical_features.xml
  • src/tests/topp/UniPEFF_6_output_omitcanon.peff
  • src/tests/topp/UniPEFF_7_input_terminal_features.xml
  • src/tests/topp/UniPEFF_7_output_mapped.peff
  • src/topp/UniPEFF/UniPEFF.cpp
  • src/topp/UniPEFF/include/UniPEFFEntries.h
  • src/topp/UniPEFF/source/UniPEFFEntries.cpp
  • src/topp/UniPEFF/test/UniPEFFEntries_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@timosachsenberg
timosachsenberg merged commit 3d697b0 into develop Nov 13, 2026
14 of 15 checks passed
@timosachsenberg
timosachsenberg deleted the feature/unipeff-map-canonical-by-default branch November 13, 2026 10:42

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-test jobs passed, as did header-set-compatibility, cppcheck-test and the Linux, macOS and Windows wheels.
    • build-wheels-linux-arm failed in dnf before it built anything, as you noted.
  • Build:

    • I used the nightly OpenMS-SDK-2026.11.13-Linux-x86_64. It was built from 2287ee55, this PR's base.
    • I compiled with GCC 13.3, Release, -Wall -Wextra: the UniPEFF tool and UniPEFFEntries_test, each from this PR and from the base, plus FuzzyDiff. The test framework comes from src/testframework.
    • There were no warnings.
  • Tests:

    • UniPEFFEntries_test passes 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_UniPEFF tests pass with FuzzyDiff and 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 PP values. I ran the PR's parseChainPositions() 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.
  • 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_features 269,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 PEFFFile reads all four outputs, and no \Processed region 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 and pp.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 in mapFeature() and in the siteKept lambda of prepareEntry().
  • 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.cpp that 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) and TOPP_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.
  • 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_features help could say so.

Generated by Claude Code

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.

3 participants