code wiki / (root) / nx_peptide_msms.nx

nx_peptide_msms.nx

buildroot/runtime/nx_peptide_msms.nx

8083 B220 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind librarytopic peptide
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_peptide.nx nx_peptide_msms.nx nx_qc_svc.nx

imports: nx_syscalls.nxnx_peptide.nx

imported by: nx_qc_svc.nx

structs

155struct NxCandidates

consts

40const MSMS_MAX_IONS: i64 = 512 // 2*(n-1); a 256-mer is well past any real peptide
47const MSMS_REFUSED: i64 = 0 - 1
199const MSMS_SCORE_FLOOR: i64 = 500 // >=50% of the ladder seen
200const MSMS_MARGIN_PERMIL: i64 = 200 // best beats 2nd by >=20 points

functions

49func msms_theoretical_spectrum(seq: *u8, out_mz: *i64, cap: i64) -> i64
70func msms_theoretical_count(seq: *u8) -> i64
called by 2: msms_score_permilqc_msms calls 1: pep_len
79func msms_peak_present(target: i64, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
94func msms_matched_ions(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
112func msms_score_permil(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
126func msms_coverage_permil(seq: *u8, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
160func nx_candidates_new(cap: i64) -> *NxCandidates
calls 1: sys_mmap
167func msms_add_candidate(c: *NxCandidates, seq: *u8) -> i64
174func msms_best_candidate(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
188func msms_best_score_permil(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64
202func msms_confident_id(c: *NxCandidates, obs: *i64, n_obs: i64, tol_q4: i64) -> i64