nx_supplement_screen.nx
buildroot/runtime/nx_supplement_screen.nx
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
imports: nx_syscalls.nxnx_peptide.nxnx_peptide_ext.nx
imported by: nx_peptide_identify.nxnx_qc_svc.nx
structs
| none |
consts
| 62 | const SUP_MOD_NONE: i64 = 0 |
| 63 | const SUP_MOD_AMIDE: i64 = 1 |
| 64 | const SUP_MOD_ACETYL: i64 = 2 |
| 65 | const SUP_MOD_BOTH: i64 = 3 |
| 69 | const SUP_REG_UNKNOWN: i64 = 0 |
| 70 | const SUP_REG_APPROVED: i64 = 1 // approved drug / reference standard |
| 71 | const SUP_REG_ENDOGENOUS: i64 = 2 // naturally occurring, control |
| 72 | const SUP_REG_NOT_APPROVED: i64 = 3 // no marketing authorisation |
| 73 | const SUP_REG_WADA_PROHIBITED: i64 = 4 // WADA prohibited list |
| 77 | const SUP_BPC157: i64 = 0 |
| 78 | const SUP_TB500: i64 = 1 |
| 79 | const SUP_GHRP6: i64 = 2 |
| 80 | const SUP_ANGII: i64 = 3 |
| 81 | const SUP_BRADYK: i64 = 4 |
| 82 | const SUP_N_ENTRY: i64 = 5 |
| 84 | const SUP_NO_MATCH: i64 = 0 - 1 |
| 89 | const SUP_SCAN_LO_Q4: i64 = 1000000 |
| 90 | const SUP_SCAN_HI_Q4: i64 = 10000000 |
| 93 | const SUP_MAX_CHARGE: i64 = 4 |
| 96 | const SUP_LABEL_MIN_PCT: i64 = 90 |
| 97 | const SUP_LABEL_MAX_PCT: i64 = 110 |
functions
| 101 | func sup_seq(id: i64) -> *u8 |
| 110 | func sup_mod(id: i64) -> i64 called by 1: sup_mass_q4 |
| 115 | func sup_status(id: i64) -> i64 |
| 124 | func sup_is_prohibited(id: i64) -> i64 |
| 132 | func sup_mod_delta_q4(mod: i64) -> i64 called by 1: sup_mass_q4 |
| 142 | func sup_mass_q4(id: i64) -> i64 |
| 152 | func sup_mz_q4(id: i64, z: i64) -> i64 |
| 162 | func sup_ppm_q1(observed_q4: i64, reference_q4: i64) -> i64 called by 1: sup_within_ppm |
| 170 | func sup_within_ppm(observed_q4: i64, reference_q4: i64, tol_ppm_q1: i64) -> i64 |
| 182 | func sup_match_charge(id: i64, observed_mz_q4: i64, tol_ppm_q1: i64) -> i64 |
| 197 | func sup_screen(observed_mz_q4: i64, tol_ppm_q1: i64) -> i64 |
| 213 | func sup_mz_in_range(mz_q4: i64) -> i64 |
| 220 | func sup_mh_plus_in_range(id: i64) -> i64 |
| 226 | func sup_detectable_charges_in_range(id: i64) -> i64 |
| 241 | func sup_single_charge_blind_spot(id: i64) -> i64 |
| 254 | func sup_recovery_pct(measured_ug: i64, declared_ug: i64) -> i64 |
| 259 | func sup_label_compliant(measured_ug: i64, declared_ug: i64) -> i64 |
| 269 | func sup_dose_verdict(measured_ug: i64, declared_ug: i64) -> i64 |