Skip to content

Add multi-term ProForma parsing/writing (chimeric +, charge /z, multi-chain //)#118

Merged
trishorts merged 2 commits into
topdownproteomics:masterfrom
trishorts:feature/multi-term-proteoform-group
Jun 30, 2026
Merged

Add multi-term ProForma parsing/writing (chimeric +, charge /z, multi-chain //)#118
trishorts merged 2 commits into
topdownproteomics:masterfrom
trishorts:feature/multi-term-proteoform-group

Conversation

@trishorts

Copy link
Copy Markdown
Contributor

Summary

Adds first-class support for the ProForma 2.0 constructs that live above a single proteoform term, which ParseString (single-term) rejects today:

  • Chimeric peptidoforms — + (section 7.2)
  • Charge state and ion adducts — /z, /z[adducts] (section 7.1)
  • Inter-chain crosslinks / branches// (sections 4.2.3.2, 4.2.4)

The approach is intentionally thin and additive: the string is split on the top-level +, /, and // operators (respecting bracket nesting), and each chain is parsed and written by the existing single-term ProFormaParser / ProFormaWriter. Single-term behavior is untouched.

var parser = new ProFormaParser();
var writer = new ProFormaWriter();

var group = parser.ParseProteoformGroupString("EMEVEESPEK/2+ELVISLIVER/3");
group.Peptidoforms.Count;            // 2  (chimeric)
group.Peptidoforms[0].Charge;        // 2
writer.WriteString(group);           // "EMEVEESPEK/2+ELVISLIVER/3"

parser.ParseProteoformGroupString("EMEVEESPEK/2[+2Na+,+H+]");                 // charge + adducts
parser.ParseProteoformGroupString("SEK[XLMOD:02001#XL1]UENCE//EMEVTK[#XL1]SESPEK"); // inter-chain //
parser.ParseProteoformGroupString("EM[Oxidation]EVEES[Phospho]PEK");         // plain term -> 1 peptidoform, 1 chain

API added

  • ProFormaPeptidoform — one peptidoform: IList<ProFormaTerm> Chains (joined by //), int? Charge, string? IonAdducts.
  • ProFormaProteoformGroupIList<ProFormaPeptidoform> Peptidoforms (chimeric, joined by +).
  • ProFormaParser.ParseProteoformGroupString(string) and a ProFormaWriter.WriteString(ProFormaProteoformGroup) overload.

🟨 API shape is open to your preference

This is a feature proposal — the naming and placement are yours to shape. Reasonable alternatives include folding charge onto ProFormaTerm, or exposing these as a separate ProFormaMultiTermParser. Happy to adjust to whatever fits the SDK's direction; the parsing/writing logic is the same regardless.

Tests

  • Charge / negative charge / adducts, chimeric, multi-chain, branch, and "plain term -> single peptidoform".
  • RoundTripIsCanonicallyIdempotent over the section 4.2.3.2 / 4.2.4 / 7.1 / 7.2 specification examples.
  • Full suite green: 249 passed, 7 skipped, 0 failed (net472 + net6.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JNnpzBNwfnTbZxtZdtAzLG

Adds support for ProForma 2.0 constructs above a single term: chimeric
peptidoforms (+, section 7.2), charge states (/z[adducts], section 7.1), and
inter-chain crosslink / branch chains (//, sections 4.2.3.2 and 4.2.4). The
string is split on the top-level +, /, and // operators (respecting bracket
nesting) and each chain is parsed and written by the existing single-term
ProFormaParser/ProFormaWriter; single-term behavior is unchanged.

New types: ProFormaPeptidoform (chains plus optional charge/adducts) and
ProFormaProteoformGroup (chimeric peptidoforms). New entry points:
ProFormaParser.ParseProteoformGroupString and a ProFormaWriter.WriteString
overload. 16 tests including canonical round-trips of the specification
examples; full suite green (249 passed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JNnpzBNwfnTbZxtZdtAzLG
@trishorts trishorts requested a review from rfellers June 19, 2026 16:35
@trishorts trishorts added the Enhancement New feature or request label Jun 19, 2026

@rfellers rfellers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like the approach of keeping things separate. One could argue that together is better, but it all comes down to what someone considers a ProForma 'term'. From a practical standpoint, we already have code using the existing API and a breaking change doesn't seem worth it.

trishorts pushed a commit to trishorts/sdk that referenced this pull request Jun 30, 2026
The Build and Test job failed on all open PRs (topdownproteomics#116, topdownproteomics#117, topdownproteomics#118) because
the final Codecov step errored on upload (exit 4294967295) while
fail_ci_if_error was true, marking the whole job failed even though
restore, build, and tests all passed (235 passed, 0 failed).

- fail_ci_if_error: true -> false so a Codecov-side hiccup no longer
  fails the build
- fix coverage file path: coverage.net6.0.xml -> coverage.xml to match
  the Coverlet output (/p:CoverletOutput='../../coverage.xml')
- bump checkout/setup-dotnet/codecov-action v3 -> v4 to clear the
  Node 20 deprecation warnings

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.01709% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.37%. Comparing base (b4d1949) to head (91abd85).

Files with missing lines Patch % Lines
src/TopDownProteomics/ProForma/ProFormaParser.cs 92.13% 3 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #118      +/-   ##
==========================================
+ Coverage   89.23%   89.37%   +0.14%     
==========================================
  Files         103      105       +2     
  Lines        5721     5838     +117     
  Branches      882      908      +26     
==========================================
+ Hits         5105     5218     +113     
- Misses        429      431       +2     
- Partials      187      189       +2     
Files with missing lines Coverage Δ
.../TopDownProteomics/ProForma/ProFormaPeptidoform.cs 100.00% <100.00%> (ø)
...DownProteomics/ProForma/ProFormaProteoformGroup.cs 100.00% <100.00%> (ø)
src/TopDownProteomics/ProForma/ProFormaWriter.cs 91.39% <100.00%> (+2.33%) ⬆️
src/TopDownProteomics/ProForma/ProFormaParser.cs 92.80% <92.13%> (-0.20%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trishorts trishorts merged commit 80b7334 into topdownproteomics:master Jun 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants