Skip to content

UniPEFF: do not apply isoform-scoped features to the canonical entry - #10266

Merged
timosachsenberg merged 2 commits into
developfrom
claude/unipeff-isoform-scoped-features
Sep 28, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
claude/unipeff-isoform-scoped-features

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

UniPEFF wrote UniProt features annotated on a different isoform as annotations of the canonical entry, so their coordinates landed on the wrong residues.

In UniProtKB XML such features carry <location sequence="P56181-2">. According to uniprot.xsd (locationType), the attribute is "only used when the location is not on the canonical sequence displayed in the current entry". UniPEFF ignored it.

Example from human Swiss-Prot: sp:O00139 got \ModResPsi=(556|MOD:00046|O-phospho-L-serine), but canonical residue 556 is D. The serine is in isoform O00139-4.

Change

  • UniProtFeature::location_sequence stores location/@sequence.
  • prepareEntry() no longer applies features that set it to the canonical entry.
  • Each run ends with one info line counting the skipped features that would otherwise have become annotations. Feature types UniPEFF never writes, such as sequence conflicts, are not counted.

Effect on human Swiss-Prot (20,431 entries)

  • 1,228 features in 442 entries are no longer applied. 1,839 features carry the attribute in total; the rest are types UniPEFF does not write anyway.
  • 1,214 annotations are removed from 435 descriptor lines. Nothing is added or altered, and all sequences are unchanged.
  • Phospho S/T/Y \ModResPsi on a residue that is not S/T/Y: 427 → 2. The remaining two use a different UniProt convention and are not isoform-scoped (e.g. O75478 "Phosphoserine; in variant Ser-6").
  • \ModRes* / \VariantSimple positions past the sequence end: 40 → 0. The 20 "out of bounds; omitted" warnings the writer printed for such variants are gone.

Tests

  • UniProtXMLFile_test checks the parsed attribute and its absence.
  • New TOPP_UniPEFF_12 mixes isoform-scoped and canonical modified residues and sequence variants.
  • New TOPP_UniPEFF_12_summary checks the summary count; its fixture includes an isoform-scoped sequence conflict that must not be counted.
  • Existing expected outputs are unchanged.

Related

  • Found while reviewing UniPEFF: Implement isoform expansion from splice-variant features #9966 (isoform expansion), but independent of it. The two branches merge without conflicts (checked with git merge-tree).
  • Once both are merged, these annotations could go onto the matching isoform entries instead of being dropped (follow-up).
  • The per-feature detail is logged at debug level, but TOPP tools currently print no OPENMS_LOG_DEBUG output even with -debug. That is a separate framework issue, so the docs don't point to it.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes (all 24 UniPEFF / UniProtXMLFile tests; full suite not run locally)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

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.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

🤖 Generated with Claude Code

https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • UniPEFF now skips features whose coordinates refer to a different protein isoform, preventing incorrect annotations on the canonical sequence.
    • Run summaries report how many isoform-specific features were skipped and how many entries were affected.

timosachsenberg and others added 2 commits September 24, 2026 10:55
A UniProtKB feature with <location sequence="P56181-2"> carries
coordinates of that isoform, not of the entry's canonical sequence
(uniprot.xsd, locationType). The XML handler ignored <location>, and
prepareEntry() classified every feature onto the canonical entry, so
isoform coordinates were written as canonical PEFF annotations: on human
Swiss-Prot, e.g. sp:O00139 got \ModResPsi=(556|MOD:00046|...) although
canonical residue 556 is D, and 40 ModRes/VariantSimple positions in 14
entries lay past the end of the sequence.

UniProtFeature gains location_sequence (location/@sequence). prepareEntry()
skips features that set it (per-feature OPENMS_LOG_DEBUG), and the run
ends with one summary log line counting them.

Tests: UniProtXMLFile_test checks the parsed attribute and its absence;
new TOPP_UniPEFF_12 mixes isoform-scoped modified residues and sequence
variants with canonical ones. Existing goldens are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vtf85tr3QGsMbs53Zz11FB
- The summary line counted every feature with <location sequence="...">,
  including types UniPEFF never writes (human Swiss-Prot: 1,839 features in
  756 entries, e.g. 437 sequence conflicts). It now counts only features that
  would otherwise have become annotations of the canonical entry (1,228 in
  442 entries). New test TOPP_UniPEFF_12_summary checks the count; the
  fixture gains an isoform-scoped sequence conflict that must not be counted.
- Drop the claim that -debug 1 shows per-feature details: TOPP tools
  currently print no OPENMS_LOG_DEBUG output.
- Move UniProtFeature::location_sequence next to the other location fields,
  away from the lines #9966 changes, so the two branches merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX
@OpenMS OpenMS deleted a comment from coderabbitai Bot Sep 24, 2026

@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.

Reviewed the current head. The parser retains location/@sequence, and prepareEntry() filters these features before merging half-cystines or assigning annotation IDs. The mixed canonical/isoform fixture covers the important output behavior, and the summary test excludes feature types that UniPEFF would never emit. The current Build and Test and wheel workflows pass.

I found no blocking issue in this PR. It would be useful to merge this before #9966 so that isoform expansion starts from corrected canonical annotations; moving the filtered annotations onto reconstructed isoforms can remain a separate follow-up.

@timosachsenberg
timosachsenberg merged commit 5cca8a9 into develop Sep 28, 2026
33 checks passed
@timosachsenberg
timosachsenberg deleted the claude/unipeff-isoform-scoped-features branch September 28, 2026 09:03
timosachsenberg pushed a commit that referenced this pull request Sep 28, 2026
Brings in #10266 (isoform-scoped features are no longer applied to the
canonical entry), so isoform expansion now builds on the corrected
canonical annotations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX
timosachsenberg pushed a commit that referenced this pull request Sep 28, 2026
With #10266, some UniProt feature coordinates refer to another isoform
(<location sequence="...">), so "UniProt feature coordinates refer to the
canonical sequence only" no longer holds. State both actual reasons in the
tool documentation and at writeIsoformPeffEntry(): canonical coordinates are
not mapped onto the spliced sequence, and features annotated on an isoform
are not applied to its entry either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX
timosachsenberg pushed a commit that referenced this pull request Sep 28, 2026
Brings in #10266 (isoform-scoped UniProt features are no longer applied
to the canonical entry).

Conflict in src/topp/UniPEFF/UniPEFF.cpp at the writePeffEntry() call:
keep develop's isoform_scoped_tracker.add() and this branch's
writePeffEntry() signature, which no longer takes option_b.

TOPP_UniPEFF_12 (new on develop) runs in default mode on an entry with
a canonical 6-18 disulfide bond, so its expected output
UniPEFF_4_output_location_sequence.peff gains the half-cystine labels
(0:6|...)(1:18|...), \DisulfideBond=(2:0,1) and
"# HasAnnotationIdentifiers=true" in the sp block header.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0154SXArrtJiK1yY4Qxfc371
timosachsenberg added a commit that referenced this pull request Sep 29, 2026
)

* UniPEFF: report UniProt isoforms as additional PEFF entries (#9830)

UniProtKB XML defines alternative products (isoforms) via the
<comment type="alternative products"> subtree plus
<feature type="splice variant"> records; the sequences themselves are
not stored and must be reconstructed from the canonical sequence.
UniPEFF previously skipped all of this.

Parser (UniProtXMLFile/UniProtXMLHandler):
- new UniProtIsoform POD (first <id>, first <name>, sequence type,
  space-separated VSP refs) harvested from the alternative-products
  comment instead of skipping the subtree
- UniProtFeature gains the feature/@id attribute so isoform refs can be
  resolved

UniPEFF:
- every "described" isoform is reconstructed by applying its referenced
  splice variants to the canonical sequence: a range without <variation>
  is deleted, one with <variation> is substituted; features are applied
  C- to N-terminal so coordinates never shift. The rules reproduce
  UniProt's official isoform FASTA sequences byte-exactly for all 18
  described isoforms of P02768 and P15692 (the issue's examples)
- reconstructed isoforms are emitted directly after their parent entry
  with a UniProt-FASTA-style descriptor (\PName=(Isoform N of X),
  inherited GName/NcbiTaxId/TaxName/ID, no per-isoform SV/EV/PE) and are
  counted in the per-prefix "# NumberOfEntries="
- "displayed" (= canonical), "external" and "not described" isoforms are
  skipped with a log message; dangling refs, invalid/overlapping ranges
  and <original> mismatches are validated and skipped with a warning
- new -omit_isoforms flag restores the previous (upstream C#) output
  byte-exactly

Tests:
- UniProtXMLFile class test covers isoform + feature-id parsing
- new TOPP fixture UniPEFF_3_input_isoforms.xml exercises deletion,
  replacement, single-position extension, multi-VSP application and
  every skip path; golden hand-derived and cross-checked
- existing goldens gain the P12345-2 isoform entry (fixture's VSP range
  corrected from 56-62 to 55-61 to match its <original>VYEVVLR)
- TOPP_UniPEFF_10 (-omit_isoforms) pins the pre-expansion output

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HJemySJ9eeY5nyq37NHJfR

* Address review: TEST_TRUE for boolean asserts, '\n' over std::endl in new logs

Applies the two CodeRabbit nitpicks on the isoform change, per AGENTS.md
coding guidelines: the two new has_range assertions use TEST_TRUE, and the
four log statements added for isoform reconstruction end with '\n' instead
of std::endl. Pre-existing statements elsewhere in the files are untouched.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HJemySJ9eeY5nyq37NHJfR

* UniPEFF: summarize isoforms without a sequence, refresh stale comments

Isoforms typed "external" (stored as their own UniProt entry) or "not
described" no longer produce one INFO line each (282 for human
Swiss-Prot). They are counted per sequence type and reported once after
the run, e.g. "282 isoform(s) without a reconstructable sequence were not
emitted (232 'external', 50 'not described')"; the per-isoform line is
kept at debug level. Reconstruction failures still warn per isoform.

Also update comments that still described the pre-isoform behaviour: the
alternative-products gate in UniProtXMLHandler no longer skips the whole
subtree, UniProtFeature::original/variation also hold splice variants,
and the isoform fixture's skipped isoforms are not each logged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX

* UniPEFF docs: why isoform entries carry no annotations, after #10266

With #10266, some UniProt feature coordinates refer to another isoform
(<location sequence="...">), so "UniProt feature coordinates refer to the
canonical sequence only" no longer holds. State both actual reasons in the
tool documentation and at writeIsoformPeffEntry(): canonical coordinates are
not mapped onto the spliced sequence, and features annotated on an isoform
are not applied to its entry either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX

---------

Co-authored-by: Claude <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Sep 29, 2026
A UniProt feature whose <location sequence="..."> names an isoform carries
that isoform's coordinates. #10266 stopped applying such features to the
canonical entry; since #9966 the isoform is usually written as an entry of
its own, so the features now go there:

- prepareEntry() reconstructs the isoforms first and routes each feature to
  the canonical entry (no location/@sequence, or the "displayed" isoform) or
  to the entry of the isoform it names. Features of isoforms that are not
  written (external, not described, not reconstructable, -omit_isoforms) are
  still skipped and counted.
- Isoform annotations go through the same steps as canonical ones against the
  isoform sequence: half-cystine merge, disulfide range check, and Option B
  ids or default-mode disulfide labels. writeAnnotationTags(), split out of
  writePeffEntry(), writes them for both kinds of entry. An isoform entry
  with ids also sets HasAnnotationIdentifiers.
- The summary reports the features written to isoform entries and those not
  applied.

New TOPP_UniPEFF_15/_16/_17 (default, -annotation_identifiers,
-omit_isoforms) and two summary checks run on
UniPEFF_5_input_isoform_features.xml; the expected outputs were written by
hand. TOPP_UniPEFF_12_summary keeps its counts under the new wording.

On human Swiss-Prot, all 1,228 such features (442 entries) land on their
isoform entries at the positions UniProt gives. Canonical entries, isoform
sequences and the -omit_isoforms output are byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX
timosachsenberg added a commit that referenced this pull request Sep 29, 2026
* UniPEFF: remove the unused isEmpty() helper and two unused handler fields

clang warned about all three (-Wunused-function, -Wunused-private-field):
isEmpty() in UniProtXMLHandler.cpp and UniProtXMLHandler's
gene_name_is_primary_ / organism_name_is_scientific_ had no users. Removing
isEmpty() also puts the UTF-16 conversion comment back above xmlchToString(),
the function it describes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX

* UniPEFF: write isoform-scoped features to their isoform entries

A UniProt feature whose <location sequence="..."> names an isoform carries
that isoform's coordinates. #10266 stopped applying such features to the
canonical entry; since #9966 the isoform is usually written as an entry of
its own, so the features now go there:

- prepareEntry() reconstructs the isoforms first and routes each feature to
  the canonical entry (no location/@sequence, or the "displayed" isoform) or
  to the entry of the isoform it names. Features of isoforms that are not
  written (external, not described, not reconstructable, -omit_isoforms) are
  still skipped and counted.
- Isoform annotations go through the same steps as canonical ones against the
  isoform sequence: half-cystine merge, disulfide range check, and Option B
  ids or default-mode disulfide labels. writeAnnotationTags(), split out of
  writePeffEntry(), writes them for both kinds of entry. An isoform entry
  with ids also sets HasAnnotationIdentifiers.
- The summary reports the features written to isoform entries and those not
  applied.

New TOPP_UniPEFF_15/_16/_17 (default, -annotation_identifiers,
-omit_isoforms) and two summary checks run on
UniPEFF_5_input_isoform_features.xml; the expected outputs were written by
hand. TOPP_UniPEFF_12_summary keeps its counts under the new wording.

On human Swiss-Prot, all 1,228 such features (442 entries) land on their
isoform entries at the positions UniProt gives. Canonical entries, isoform
sequences and the -omit_isoforms output are byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015br53P8rFQMnErUa4SiMSX

---------

Co-authored-by: Claude <[email protected]>
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