Skip to content

Site claims: knockoff sites and site q-values for annotated modification sites (experimental) - #184

Merged
ypriverol merged 2 commits into
mainfrom
feat/site-knockoffs
Oct 19, 2026
Merged

ypriverol merged 2 commits into
mainfrom
feat/site-knockoffs

Conversation

@ypriverol

@ypriverol ypriverol commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Merged as experimental. Tested afterwards against known sites, it does not control the main error: claiming the wrong modification at the right site. The follow-up plan is in the last section.

Annotated modification sites become claims with their own error control, built the same way as knockoff variants.

Change

  • Site claims. Every annotated site of a reference protein is a claim ("residue r carries modification M") with a prior tier. Sites come from UniProt XML, annotation-file mods rows and PEFF \ModRes* keys.

  • Knockoff sites. For each annotated site, up to --knockoffs knockoff sites carry the same modification on matched residues no annotation names. A knockoff site must have:

    • the same residue;
    • the same digestion: a modified K/R blocks cleavage, so the merged peptide is compared;
    • the same next-residue rule as variant knockoffs;
    • the same motif status (phospho S/T: P at +1, R/K at −3, D/E at +3; phospho Y: D/E at −1..−4; methyl R, deamidated N, hydroxy P: G at +1; N: the sequon);
    • another peptide of similar length;
    • at least 5 residues from every real site of that modification.

    Terminal sites get none. Knockoff sites are added before decoys are built, so decoys carry them like real sites.

  • Site q-values. After rescoring, PSMs placing a modification on a knockoff site estimate the false claims, per modification × residue × tier (small tiers pool within their modification and residue). Each annotated site gets a site q-value. A PSM's own q-value is unchanged.

  • Reporting. Placements on knockoff sites are not reported for a sites=annotated mod, because they exist only for the estimate. For an unrestricted mod they stay ordinary PSMs. <stem>.sites.tsv lists the sites whose best PSM passes --fdr and whose site q-value passes --proteoform-fdr.

Some knockoff sites are really modified, because site annotation is incomplete. Counting them as false makes the estimate err towards rejecting true claims, never towards accepting false ones.

Measured

Mouse-liver phospho run (PXD007653), reviewed mouse UniProt: 51,906 annotated sites, 42,985 knockoff sites; 31,165 sites had no matching residue.

Phospho PSMs at 1% Phosphopeptides Sites at site q ≤ 0.05
placed freely, no knockoffs 37,750 14,265 –
placed freely, knockoffs 37,750 14,265 1,403
sites=annotated, no knockoffs 33,434 9,820 –
sites=annotated, knockoffs 33,192 9,745 119
  • Freely placed: identifications are unchanged and the site claims come at no cost.
  • Restricted to annotated sites: knockoff placements cost 0.7% of PSMs, and few claims pass, because many knockoff residues are really phosphorylated. Site claims are therefore most useful with freely placed mods.

Tested against known sites (fails)

Setup: synthetic PTM peptide pools (PXD009449). Every synthesized K site was claimed with six lysine modifications and every Y site with phospho. Each pool's run was searched separately, so only the pool's own modification is true.

Result: 1,535 sites accepted at site q ≤ 0.05, of which 580 (38%) are false.

  • Phospho-Y is clean: 49 sites, 0 false.
  • Almost every false claim is the right site with the wrong modification: trimethyl or methyl in the acetyl pool, methyl in the dimethyl pool, methyl and succinyl in the GG pool.
  • Knockoff peptides are absent from a synthetic sample, so knockoff PSMs are close to zero. The knockoff-site null models whether a residue is modified (occupancy), not which modification it carries (identity).

Some false labels are probably synthesis side products: the unmodified K pool gives methyl-K PSMs. Acetyl vs trimethyl (0.036 Da) is a real search error either way.

Plan

Report two probabilities per site:

  • Occupancy: the residue carries a modification, controlled by knockoff sites as here.

  • Identity: given that it is modified, the probability of each candidate modification (for example acetyl 0.99, trimethyl 0.01). This comes from evidence that separates near-isobaric modifications:

    • precursor mass error under each candidate;
    • diagnostic immonium ions;
    • neutral losses (trimethyl-K loses trimethylamine, for example).

    It is calibrated on synthetic pools held out from the validation runs.

The synthetic pools are the test for both probabilities.

Tests

  • Knockoff-site placement: motif match, distance from real sites, digestion context of a modified K, terminal and unmatched sites.
  • Peptide-string parsing.
  • The site q-value of a claim against its knockoff PSMs, with restricted and unrestricted mods.
  • End to end on BSA: knockoff sites added, real sites counted without them, site table written.
  • Clippy is clean, and the input, model, output, search and andes test suites pass.

…ion sites

Every reference protein's annotated sites (UniProt XML, annotation-file mods,
PEFF ModRes) are site claims with a tier. For each, up to --knockoffs knockoff
sites carry the same modification on matched unannotated residues: same
residue and digestion (a modified K/R blocks cleavage), the next-residue rule,
the same motif status (phospho S/T: P at +1, R/K at -3, D/E at +3; phospho Y:
D/E at -1..-4; methyl R, deamidated N, hydroxy P: G at +1; N: sequon), another
peptide of similar length, at least 5 residues from real sites of that mod. A
sites=annotated mod may be placed on them. After rescoring, knockoff-site PSMs
estimate the false claims per modification x residue x tier; each site gets a
site q-value, and <stem>.sites.tsv lists the accepted ones. PSM q-values are
unchanged; knockoff-site placements of restricted mods are not reported.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2e1701e2-a267-4c5e-b0c8-c6228d07e41c
📥 Commits

Reviewing files that changed from the base of the PR and between a94c400 and 4ff4929.

📒 Files selected for processing: 12
  • DOCS.md
  • README.md
  • crates/andes/src/bin/andes/search.rs
  • crates/andes/tests/uniprot_database.rs
  • crates/input/src/annotation.rs
  • crates/input/src/annotations_file.rs
  • crates/input/src/lib.rs
  • crates/input/src/uniprot.rs
  • crates/model/src/lib.rs
  • crates/model/src/protein.rs
  • crates/output/src/lib.rs
  • crates/output/src/site_fdr.rs
  • 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

Comment @coderabbitai help to get the list of available commands.

@ypriverol
ypriverol merged commit db2493c into main Oct 19, 2026
5 checks passed
@ypriverol
ypriverol deleted the feat/site-knockoffs branch November 4, 2026 07:38
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.

1 participant