nx_peptide_formula.nx
buildroot/runtime/nx_peptide_formula.nx
about
nx_peptide_formula.nx -- LIAR-KILLER for the peptide mass stack. Computes a
peptide's monoisotopic mass by a SECOND, INDEPENDENT path: counting the
C/H/N/O/S atoms of every residue and multiplying by CODATA element masses,
rather than summing a pre-rounded residue-mass table (nx_peptide).
WHY THIS IS REAL LIAR-KILLING, NOT SELF-CONSISTENCY. nx_peptide sums a
table of residue masses. If that table had a typo, its gate -- which checks
the sum against a literature number -- would still catch a SINGLE-peptide
error, but a systematic table error could hide. This organ derives the same
masses from a DIFFERENT primitive (atom counts x element masses), and the
gate demands three things agree:
(1) this elemental mass == nx_peptide's residue-sum mass (two methods)
(2) both == the PUBLISHED monoisotopic mass (external)
(3) the derived MOLECULAR FORMULA == the PUBLISHED formula (external)
For a table typo to survive, the SAME error would have to appear in the
residue-mass table AND the atom-count table AND match the published formula
AND the published mass -- which is not a mistake, it is a conspiracy. Two
independent representations converging on external ground truth is the
definition of a killed liar.
The molecular-formula check (3) is the sharpest: angiotensin II is the
published C50H71N13O12, bradykinin C50H73N15O11. Those are hand-checkable
integers, not a mass that hides rounding. If the atom table is wrong the
formula is visibly wrong.
All INTEGER, _q4 = x10^4 Da, matching nx_peptide.
Grounding (cited; researcher-groundable):
codata_monoisotopic_atomic_masses_H_C_N_O_S
published_molecular_formulas_angiotensin_ii_bradykinin
iupac_residue_elemental_compositions
genealogy_id: peptide_chemistry + liar_killer
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_peptide.nx
imported by: nx_peptide_isotope.nxnx_qc_svc.nx
structs
| 93 | struct NxFormula |
consts
| 45 | const PFM_H_Q6: i64 = 1007825 // 1.00782503 |
| 46 | const PFM_C_Q6: i64 = 12000000 // 12.00000000 |
| 47 | const PFM_N_Q6: i64 = 14003074 // 14.00307401 |
| 48 | const PFM_O_Q6: i64 = 15994915 // 15.99491462 |
| 49 | const PFM_S_Q6: i64 = 31972071 // 31.97207069 |
| 52 | const PFM_WATER_Q4: i64 = 180106 // (2*1007825 + 15994915 + 50)/100 |
functions
| 58 | func pfm_atoms_packed(aa: i64) -> i64 called by 1: pfm_formula |
| 82 | func pfm_unpack_c(p: i64) -> i64 { return p % 100 } called by 1: pfm_formula |
| 83 | func pfm_unpack_h(p: i64) -> i64 { return (p / 100) % 100 } called by 1: pfm_formula |
| 84 | func pfm_unpack_n(p: i64) -> i64 { return (p / 10000) % 100 } called by 1: pfm_formula |
| 85 | func pfm_unpack_o(p: i64) -> i64 { return (p / 1000000) % 100 } called by 1: pfm_formula |
| 86 | func pfm_unpack_s(p: i64) -> i64 { return (p / 100000000) % 100 } called by 1: pfm_formula |
| 102 | func pfm_formula(seq: *u8) -> *NxFormula |
| 135 | func pfm_mass_q4(seq: *u8) -> i64 |
| 154 | func pfm_methods_agree(seq: *u8, tol_q4: i64) -> i64 |
| 167 | func pfm_formula_matches(seq: *u8, c: i64, h: i64, n: i64, o: i64, s: i64) -> i64 calls 1: pfm_formula |