code wiki / (root) / nx_supplement_screen.nx

nx_supplement_screen.nx

buildroot/runtime/nx_supplement_screen.nx

10335 B275 linesdepth 5pulls 5 transitivereach 2 importersview sourcekind librarytopic supplement
docsdependenciesstructsconstsfunctions

about

nx_supplement_screen.nx -- SUPPLEMENT ARC / PEPTIDE ADULTERANT rung. Screens an observed LC-MS peak against a catalog of peptide actives sold in supplement and "research peptide" channels, ACROSS CHARGE STATES. WHY THIS EXISTS -- a measured hole, not a hypothetical one. nx_chem_adulterant_db screens small molecules well: it parses SMILES, computes a monoisotopic mass, and matches an observed peak against [M+H]+ within a ppm window. That design silently cannot see peptides: 1. A peptide is a SEQUENCE, not a SMILES the parser will take. 2. Electrospray puts peptides on a CHARGE LADDER. BPC-157 is 1418.70 Da, so [M+H]+ sits at m/z 1419.7 -- outside the m/z 100-1000 window a small-molecule method typically scans. Its real signals are [M+2H]2+ at 710.4 and [M+3H]3+ at 473.9. A screen that computes only [M+H]+ therefore reports CLEAN on a spiked sample. sup_mh_plus_in_range and sup_detectable_charges_in_range make that failure MECHANICAL rather than rhetorical: they compute, per compound, whether the single-charge assumption would have missed it. MASSES ARE DERIVED, NOT TABULATED. Every catalog mass comes from nx_peptide walking the actual sequence, plus an explicit terminal modification delta. Nothing here is a copied number that can drift out of agreement with the residue table. FAIL-CLOSED ON WHAT IT CANNOT DO. Peptides carrying non-proteinogenic residues (ipamorelin's Aib and 2-Nal, melanotan-II's Nle) are REFUSED by nx_peptide rather than approximated, so they screen as "unknown", never as "absent". Extending to them needs a non-standard residue table and is an honest open gap, listed below -- not quietly rounded away. All INTEGER. _q4 = x10^4 (mass/mz in Da), _q1 = x10 (ppm). Grounding (cited; researcher-groundable): fda_tainted_supplements_database (adulteration channel) wada_prohibited_list_s2_peptide_hormones (status flags) fenn_1989_electrospray_multiple_charging (the charge ladder) usp_dietary_supplement_label_claim_bands (dose acceptance) Open gaps (stated, not hidden):

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_peptide.nx nx_peptide_ext.nx nx_supplement_screen.nx nx_peptide_identify.nx nx_qc_svc.nx

imports: nx_syscalls.nxnx_peptide.nxnx_peptide_ext.nx

imported by: nx_peptide_identify.nxnx_qc_svc.nx

structs

none

consts

62const SUP_MOD_NONE: i64 = 0
63const SUP_MOD_AMIDE: i64 = 1
64const SUP_MOD_ACETYL: i64 = 2
65const SUP_MOD_BOTH: i64 = 3
69const SUP_REG_UNKNOWN: i64 = 0
70const SUP_REG_APPROVED: i64 = 1 // approved drug / reference standard
71const SUP_REG_ENDOGENOUS: i64 = 2 // naturally occurring, control
72const SUP_REG_NOT_APPROVED: i64 = 3 // no marketing authorisation
73const SUP_REG_WADA_PROHIBITED: i64 = 4 // WADA prohibited list
77const SUP_BPC157: i64 = 0
78const SUP_TB500: i64 = 1
79const SUP_GHRP6: i64 = 2
80const SUP_ANGII: i64 = 3
81const SUP_BRADYK: i64 = 4
82const SUP_N_ENTRY: i64 = 5
84const SUP_NO_MATCH: i64 = 0 - 1
89const SUP_SCAN_LO_Q4: i64 = 1000000
90const SUP_SCAN_HI_Q4: i64 = 10000000
93const SUP_MAX_CHARGE: i64 = 4
96const SUP_LABEL_MIN_PCT: i64 = 90
97const SUP_LABEL_MAX_PCT: i64 = 110

functions

101func sup_seq(id: i64) -> *u8
110func sup_mod(id: i64) -> i64
called by 1: sup_mass_q4
115func sup_status(id: i64) -> i64
124func sup_is_prohibited(id: i64) -> i64
132func sup_mod_delta_q4(mod: i64) -> i64
called by 1: sup_mass_q4
142func sup_mass_q4(id: i64) -> i64
152func sup_mz_q4(id: i64, z: i64) -> i64
162func sup_ppm_q1(observed_q4: i64, reference_q4: i64) -> i64
called by 1: sup_within_ppm
170func sup_within_ppm(observed_q4: i64, reference_q4: i64, tol_ppm_q1: i64) -> i64
called by 1: sup_match_charge calls 1: sup_ppm_q1
182func sup_match_charge(id: i64, observed_mz_q4: i64, tol_ppm_q1: i64) -> i64
197func sup_screen(observed_mz_q4: i64, tol_ppm_q1: i64) -> i64
called by 1: qc_screen calls 1: sup_match_charge
213func sup_mz_in_range(mz_q4: i64) -> i64
220func sup_mh_plus_in_range(id: i64) -> i64
226func sup_detectable_charges_in_range(id: i64) -> i64
241func sup_single_charge_blind_spot(id: i64) -> i64
254func sup_recovery_pct(measured_ug: i64, declared_ug: i64) -> i64
259func sup_label_compliant(measured_ug: i64, declared_ug: i64) -> i64
called by 1: qc_label calls 1: sup_recovery_pct
269func sup_dose_verdict(measured_ug: i64, declared_ug: i64) -> i64
called by 1: qc_label calls 1: sup_recovery_pct