nx_peptide_msms.nx
buildroot/runtime/nx_peptide_msms.nx
about
nx_peptide_msms.nx -- SOTA ANALYTICAL CAPSTONE: peptide identification by
MS/MS spectral matching. Given an observed fragment-ion peak list, it
generates the theoretical b/y ladder for a candidate sequence, matches
observed against theoretical within a tolerance, and returns an identity
score, the sequence coverage, and -- across a set of candidates -- which
peptide the spectrum IS. This is the literal core of how a mass
spectrometer identifies a peptide.
WHY IT IS STATE OF THE ART. A single-mass match ("a peak near 1046") is a
guess; a fragment-spectrum match is an identification. Backbone cleavage
gives the b (N-terminal) and y (C-terminal) ion ladders, and a real ID
scores how much of that predicted ladder the instrument actually saw, and
how much of the backbone that covers. That is what nx_peptide_msms computes.
ANCHORED, NOT ASSERTED. The b/y ion masses come from the residue table that
two independent methods (residue-sum and elemental formula) agree on and
that matches published values; the scoring is exact integer arithmetic. The
gate liar-kills it: a spectrum matched against its OWN sequence scores a
perfect 1000, and against a DIFFERENT peptide scores low -- if the matcher
could not tell them apart it would be useless, and the negative control
proves it can.
The b_i + y_(n-i) = M + 2*proton invariant (proven in nx_peptide) means the
two ladders are not independent evidence of the same thing twice; coverage
counts a backbone SITE as seen if EITHER its b or its complementary y ion
appears, which is the honest way to score.
All INTEGER, _q4 = x10^4 Da matching nx_peptide.
Grounding (cited; researcher-groundable):
biemann_1990_peptide_fragment_ion_nomenclature
eng_1994_sequest_cross_correlation_spectral_match
published_peptide_ms_ms_fragment_ladders
genealogy_id: peptide_chemistry + analytical_sota + liar_killer
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_peptide.nx
imported by: nx_qc_svc.nx
structs
| 155 | struct NxCandidates |
consts
| 40 | const MSMS_MAX_IONS: i64 = 512 // 2*(n-1); a 256-mer is well past any real peptide |
| 47 | const MSMS_REFUSED: i64 = 0 - 1 |
| 199 | const MSMS_SCORE_FLOOR: i64 = 500 // >=50% of the ladder seen |
| 200 | const MSMS_MARGIN_PERMIL: i64 = 200 // best beats 2nd by >=20 points |
functions
| 49 | func msms_theoretical_spectrum(seq: *u8, out_mz: *i64, cap: i64) -> i64 |
| 70 | func msms_theoretical_count(seq: *u8) -> i64 |
| 79 | func msms_peak_present(target: i64, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 |
| 94 | func msms_matched_ions(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 called by 1: msms_score_permil calls 5: pep_seq_validpep_lenpep_b_ion_q4pep_y_ion_q4msms_peak_present |
| 112 | func msms_score_permil(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 |
| 126 | func msms_coverage_permil(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 |
| 160 | func nx_candidates_new(cap: i64) -> *NxCandidates calls 1: sys_mmap |
| 167 | func msms_add_candidate(c: *NxCandidates, seq: *u8) -> i64 |
| 174 | func msms_best_candidate(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 |
| 188 | func msms_best_score_permil(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 |
| 202 | func msms_confident_id(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64 calls 1: msms_score_permil |