nx_peptide.nx
buildroot/runtime/nx_peptide.nx
about
nx_peptide.nx -- CHEMISTRY SUITE / PEPTIDE PRIMARY-STRUCTURE rung. Turns
an amino-acid SEQUENCE into real chemistry: exact mass, charge state,
isoelectric point, UV absorbance, hydropathy, and the b/y fragment-ion
ladder an MS/MS run actually observes.
This is the missing rung between the ecosystem's molecule stack
(nx_chem_molecule / nx_chem_mass / nx_chem_isotope_pattern / nx_chem_peak_list)
and peptide work: the mass stack could weigh a MolGraph but nothing could
go from "DRVYIHPF" to 1045.5345 Da, so the NIST Peptide Tandem Mass
Spectral Libraries (SRD 1c) in the corpus had no local counterpart to
match against. This closes that.
ALL INTEGER, no float:
*_q4 = value x 10^4 (mass in Da -> micro-AMU; matches nx_chem_mass)
*_q3 = value x 10^3 (charge, hydropathy, decade-log intermediates)
*_milli = value x 10^3 (pH and pKa)
THE exceed: a sequence viewer prints letters. This computes the mass an
instrument will SEE (monoisotopic, not average -- they differ by ~0.66 Da
at 1 kDa and that is the difference between a hit and a miss), the m/z of
every charge state, and the b/y ladder for identification -- and it
REFUSES a sequence containing a residue it does not know rather than
silently scoring the unknown as zero mass.
PRECISION, stated honestly (not asserted):
- Residue masses are rounded to Q4, so an n-mer accumulates up to n/2
Q4 units of rounding. Measured against literature: angiotensin II
(8-mer) is EXACT (1045.5345); bradykinin (9-mer) lands 1 Q4 unit
(0.0001 Da) high. pep_mass_agrees() makes that tolerance explicit.
- pI comes from bisection over pep_pow10_q3, whose decade table is
0.1-log granular, so pI is good to about +/-0.05 pH -- adequate to
choose a buffer, NOT a substitute for a titration.
Grounding (cited; researcher-groundable):
iupac_amino_acid_residue_monoisotopic_masses (residue table)
emboss_pepstats_pka_set (pKa set for pI/charge)
kyte_doolittle_hydropathy_1982 (GRAVY)
pace_1995_extinction_coefficient_280nm (Trp 5500 / Tyr 1490 / cystine 125)
biemann_1990_peptide_fragment_ion_nomenclature (b/y ions)
dependencies 2 imports · 11 importers
diagram shows first 10 each side; +0 more imports, +1 more importers in the complete lists below.
imports: nx_syscalls.nxnx_pow10.nx
imported by: nx_labsci_gate.nxnx_labsci_svc.nxnx_peptide_deconv.nxnx_peptide_denovo.nxnx_peptide_ext.nxnx_peptide_formula.nxnx_peptide_identify.nxnx_peptide_isotope.nxnx_peptide_msms.nxnx_qc_svc.nxnx_supplement_screen.nx
structs
| none |
consts
| 45 | const PEP_MAGIC_710371: i64 = 710371 |
| 46 | const PEP_MAGIC_1030092: i64 = 1030092 |
| 47 | const PEP_MAGIC_1150269: i64 = 1150269 |
| 48 | const PEP_MAGIC_1290426: i64 = 1290426 |
| 49 | const PEP_MAGIC_1470684: i64 = 1470684 |
| 50 | const PEP_MAGIC_570215: i64 = 570215 |
| 51 | const PEP_MAGIC_1370589: i64 = 1370589 |
| 52 | const PEP_MAGIC_1130841: i64 = 1130841 |
| 53 | const PEP_MAGIC_1280950: i64 = 1280950 |
| 54 | const PEP_MAGIC_1310405: i64 = 1310405 |
| 55 | const PEP_MAGIC_1140429: i64 = 1140429 |
| 56 | const PEP_MAGIC_970528: i64 = 970528 |
| 57 | const PEP_MAGIC_1280586: i64 = 1280586 |
| 58 | const PEP_MAGIC_1561011: i64 = 1561011 |
| 59 | const PEP_MAGIC_870320: i64 = 870320 |
| 60 | const PEP_MAGIC_1010477: i64 = 1010477 |
| 61 | const PEP_MAGIC_990684: i64 = 990684 |
| 62 | const PEP_MAGIC_1860793: i64 = 1860793 |
| 63 | const PEP_MAGIC_1630633: i64 = 1630633 |
| 64 | const PEP_MAGIC_710788: i64 = 710788 |
| 65 | const PEP_MAGIC_1031388: i64 = 1031388 |
| 66 | const PEP_MAGIC_1150886: i64 = 1150886 |
| 67 | const PEP_MAGIC_1291155: i64 = 1291155 |
| 68 | const PEP_MAGIC_1471766: i64 = 1471766 |
| 69 | const PEP_MAGIC_570519: i64 = 570519 |
| 70 | const PEP_MAGIC_1371411: i64 = 1371411 |
| 71 | const PEP_MAGIC_1131594: i64 = 1131594 |
| 72 | const PEP_MAGIC_1281741: i64 = 1281741 |
| 73 | const PEP_MAGIC_1311926: i64 = 1311926 |
| 74 | const PEP_MAGIC_1141038: i64 = 1141038 |
| 75 | const PEP_MAGIC_971167: i64 = 971167 |
| 76 | const PEP_MAGIC_1281307: i64 = 1281307 |
| 77 | const PEP_MAGIC_1561875: i64 = 1561875 |
| 78 | const PEP_MAGIC_870782: i64 = 870782 |
| 79 | const PEP_MAGIC_1011051: i64 = 1011051 |
| 80 | const PEP_MAGIC_991326: i64 = 991326 |
| 81 | const PEP_MAGIC_1862132: i64 = 1862132 |
| 82 | const PEP_MAGIC_1631760: i64 = 1631760 |
| 83 | const PEP_MAGIC_1800: i64 = 1800 |
| 84 | const PEP_MAGIC_2500: i64 = 2500 |
| 85 | const PEP_MAGIC_3500: i64 = 3500 |
| 86 | const PEP_MAGIC_2800: i64 = 2800 |
| 87 | const PEP_MAGIC_3200: i64 = 3200 |
| 88 | const PEP_MAGIC_4500: i64 = 4500 |
| 89 | const PEP_MAGIC_3900: i64 = 3900 |
| 90 | const PEP_MAGIC_3800: i64 = 3800 |
| 91 | const PEP_MAGIC_1900: i64 = 1900 |
| 92 | const PEP_MAGIC_1600: i64 = 1600 |
| 93 | const PEP_MAGIC_4200: i64 = 4200 |
| 94 | const PEP_MAGIC_1300: i64 = 1300 |
| 95 | const PEP_MAGIC_1000000: i64 = 1000000 |
| 99 | const PEP_A: i64 = 0 |
| 100 | const PEP_C: i64 = 1 |
| 101 | const PEP_D: i64 = 2 |
| 102 | const PEP_E: i64 = 3 |
| 103 | const PEP_F: i64 = 4 |
| 104 | const PEP_G: i64 = 5 |
| 105 | const PEP_H: i64 = 6 |
| 106 | const PEP_I: i64 = 7 |
| 107 | const PEP_K: i64 = 8 |
| 108 | const PEP_L: i64 = 9 |
| 109 | const PEP_M: i64 = 10 |
| 110 | const PEP_N: i64 = 11 |
| 111 | const PEP_P: i64 = 12 |
| 112 | const PEP_Q: i64 = 13 |
| 113 | const PEP_R: i64 = 14 |
| 114 | const PEP_S: i64 = 15 |
| 115 | const PEP_T: i64 = 16 |
| 116 | const PEP_V: i64 = 17 |
| 117 | const PEP_W: i64 = 18 |
| 118 | const PEP_Y: i64 = 19 |
| 119 | const PEP_N_AA: i64 = 20 |
| 121 | const PEP_INVALID: i64 = 0 - 1 |
| 127 | const PEP_WATER_MONO_Q4: i64 = 180106 // H2O monoisotopic 18.010565 Da |
| 128 | const PEP_WATER_AVG_Q4: i64 = 180153 // H2O average 18.0153 Da |
| 131 | const PEP_PROTON_Q4: i64 = 10073 // 1.00728 Da |
| 135 | const PEP_EXT_TRP: i64 = 5500 |
| 136 | const PEP_EXT_TYR: i64 = 1490 |
| 137 | const PEP_EXT_CYSTINE: i64 = 125 // per DISULFIDE, not per free Cys |
| 141 | const PEP_PKA_CTERM: i64 = 3600 |
| 142 | const PEP_PKA_NTERM: i64 = 8600 |
| 143 | const PEP_PKA_C: i64 = 8500 |
| 144 | const PEP_PKA_D: i64 = 3900 |
| 145 | const PEP_PKA_E: i64 = 4100 |
| 146 | const PEP_PKA_H: i64 = 6500 |
| 147 | const PEP_PKA_K: i64 = 10800 |
| 148 | const PEP_PKA_R: i64 = 12500 |
| 149 | const PEP_PKA_Y: i64 = 10100 |
| 153 | const PEP_PI_LO_MILLI: i64 = 0 |
| 154 | const PEP_PI_HI_MILLI: i64 = 14000 |
| 155 | const PEP_PI_ITERS: i64 = 20 |
| 159 | const PEP_POW10_CLAMP: i64 = 6000 |
functions
| 167 | func pep_residue_mono_q4(aa: i64) -> i64 |
| 193 | func pep_residue_avg_q4(aa: i64) -> i64 called by 1: pep_mass_avg_q4 |
| 218 | func pep_hydropathy_q3(aa: i64) -> i64 called by 1: pep_gravy_q3 |
| 249 | func pep_aa_from_char(c: i64) -> i64 |
| 273 | func pep_len(seq: *u8) -> i64 |
| 280 | func pep_seq_valid(seq: *u8) -> i64 called by 17: mainlab_peptide_analyzepep_mass_mono_q4pep_mass_avg_q4pep_b_ion_q4pep_y_ion_q4+11 calls 2: pep_lenpep_aa_from_char |
| 294 | func pep_count_aa(seq: *u8, aa_want: i64) -> i64 |
| 313 | func pep_mass_mono_q4(seq: *u8) -> i64 |
| 328 | func pep_mass_avg_q4(seq: *u8) -> i64 called by 2: mainlab_peptide_analyze calls 4: pep_seq_validpep_lenpep_aa_from_charpep_residue_avg_q4 |
| 345 | func pep_mass_agrees(computed_q4: i64, reference_q4: i64, tol_q4: i64) -> i64 |
| 359 | func pep_mz_q4(mass_q4: i64, n_charge: i64) -> i64 |
| 376 | func pep_b_ion_q4(seq: *u8, i_frag: i64) -> i64 |
| 393 | func pep_y_ion_q4(seq: *u8, i_frag: i64) -> i64 |
| 412 | func pep_by_complement_ok(seq: *u8, i_frag: i64) -> i64 |
| 433 | func pep_pow10_q3(d_milli: i64) -> i64 |
| 444 | func pep_frac_basic_q3(ph_milli: i64, pka_milli: i64) -> i64 |
| 451 | func pep_frac_acidic_q3(ph_milli: i64, pka_milli: i64) -> i64 |
| 463 | func pep_charge_q3(seq: *u8, ph_milli: i64) -> i64 |
| 497 | func pep_pi_milli(seq: *u8) -> i64 |
| 521 | func pep_ext_coeff_280(seq: *u8, n_cystine: i64) -> i64 |
| 532 | func pep_a280_quantifiable(seq: *u8, n_cystine: i64) -> i64 |
| 544 | func pep_gravy_q3(seq: *u8) -> i64 called by 2: lab_peptide_analyzepep_is_hydrophobic calls 4: pep_seq_validpep_lenpep_aa_from_charpep_hydropathy_q3 |
| 560 | func pep_is_hydrophobic(seq: *u8) -> i64 calls 1: pep_gravy_q3 |