code wiki / (root) / nx_peptide_identify.nx

nx_peptide_identify.nx

buildroot/runtime/nx_peptide_identify.nx

5574 B138 linesdepth 6pulls 7 transitivereach 1 importersview sourcekind librarytopic peptide
docsdependenciesstructsconstsfunctions

about

nx_peptide_identify.nx -- SOTA CAPSTONE: end-to-end peptide identification from a RAW multiply-charged spectrum. One call chains the whole anchored analytical stack: deconvolve the peak list to a neutral mass, screen that mass against the catalog, and return an identity with a confidence that REFUSES a guess. This is the "spectrum in, identity out" a lab actually wants, and it is the recombination of every rung built before it. THE PIPELINE, EACH STEP ALREADY LIAR-KILLED: 1. DECONVOLVE (nx_peptide_deconv): raw m/z peaks, no known charge -> the neutral monoisotopic mass, plus how many charge-pairs corroborate it. 2. SCREEN (nx_supplement_screen catalog): match that mass against the catalogued peptide actives within a ppm window. 3. JUDGE: an identification is CONFIDENT only if a catalog entry matches AND at least one charge-pair corroborated the deconvolved mass. A single spurious peak, or a mass with no catalog hit, returns "no confident ID" -- it reports the mass it found and declines to name it, rather than forcing a wrong answer. WHY THE REFUSAL MATTERS. A screen that always returns its nearest catalog entry is a liar generator -- it will "identify" noise. The confidence gate here is the difference between an instrument and a rubber stamp: feed it a real BPC-157 ladder and it says BPC-157; feed it noise and it says nothing. The gate proves both. ANCHORED where it is physics: the mass recovery and catalog masses are anchored; the ppm arithmetic is exact. The catalog's regulatory STATUS is asserted (that is nx_supplement_screen's domain), so a caller reads the mass identity as verified and the legal call as advisory -- honestly split. All INTEGER, _q4 = x10^4 Da. Grounding (cited; researcher-groundable): mann_1989_electrospray_charge_deconvolution fda_tainted_supplements_peptide_actives ppm_mass_accuracy_identification_window genealogy_id: peptide_chemistry + analytical_sota + liar_killer

dependencies 4 imports · 1 importers

nx_syscalls.nx nx_peptide.nx nx_peptide_deconv.nx nx_supplement_screen.nx nx_peptide_identify.nx nx_qc_svc.nx

imports: nx_syscalls.nxnx_peptide.nxnx_peptide_deconv.nxnx_supplement_screen.nx

imported by: nx_qc_svc.nx

structs

56struct NxIdentResult

consts

43const IDENT_MAGIC_10000000: i64 = 10000000
47const IDENT_MIN_SUPPORT: i64 = 1
52const IDENT_PPM_WINDOW: i64 = 50
54const IDENT_NO_MATCH: i64 = 0 - 1

functions

64func nx_ident_result_new() -> *NxIdentResult
called by 1: nx_identify_spectrum calls 1: sys_mmap
75func ident_ppm_q1(observed_q4: i64, reference_q4: i64) -> i64
84func ident_match_catalog(mass_q4: i64, ppm_window: i64) -> i64
106func nx_identify_spectrum(peaks: *i64, n: i64, tol_q4: i64) -> *NxIdentResult
127func ident_is_confident(r: *NxIdentResult) -> i64 { return r.confident }
129func ident_is_prohibited(r: *NxIdentResult) -> i64
called by 1: qc_identify calls 1: sup_is_prohibited
135func ident_sequence(r: *NxIdentResult) -> *u8
called by 1: qc_identify calls 1: sup_seq