nx_chem_peak_list.nx
buildroot/runtime/nx_chem_peak_list.nx
about
nx_chem_peak_list.nx -- C5.0 milestone: text-format peak list parser.
A lab analyst's LC-MS output (after peak picking) is typically a
list of "m/z [intensity] [retention_time]" entries. This module
parses that format into a PeakList struct that composes directly
with C4.0 adulterant_db_lookup_mh_plus.
Supported format (whitespace-separated, '#' comments):
# comment line ignored
m/z [intensity] [rt_seconds]
280.1826 10000 742.3
102.1274 8500 45.2
195.0875 15000 234.1
166.1223 5000 89.5
Decimals are parsed to Q4 (4 fractional digits) for m/z; rt stored
as Q3 milliseconds. Intensity stored as raw nx_int.
Honest gaps (deferred):
- mzML/mzXML parsing (XML-based standard): too complex without
full XML parser in substrate; C5.1.
- JCAMP-DX (NMR/IR/spectra format): C5.2.
- Centroided vs profile-mode discrimination: caller responsibility.
- Adduct/charge state assignment heuristics (a la CAMERA): C5.3.
dependencies 3 imports · 11 importers
diagram shows first 10 each side; +0 more imports, +1 more importers in the complete lists below.
imports: nx_chem.nxnx_syscalls.nxnx_loop.nx
imported by: nx_chem_adulterant_db.nxnx_chem_adulterant_db_test.nxnx_chem_peak_list_test.nxnx_chem_report_csv.nxnx_chem_report_csv_test.nxnx_chem_report_json.nxnx_chem_report_json_test.nxnx_supplement.nxnx_supplement_batch.nxnx_supplement_check.nxnx_supplement_csv.nx
structs
| 31 | struct PeakObservation |
| 38 | struct PeakList |
consts
| 36 | const NX_PEAK_OBS_BYTES: nx_int = 24 |
| 43 | const NX_PEAK_LIST_BYTES: nx_int = 24 |
functions
| 48 | func nx_chem_peak_list_new(cap: nx_int) -> *PeakList |
| 59 | func nx_chem_peak_list_add(pl: *PeakList, mz_q4: nx_int, intensity_q4: nx_int, rt_q3: nx_int) -> nx_int |
| 80 | func nx_chem_parse_decimal_q4(buf: *u8, offset: nx_int, len: nx_int, out_value: *nx_int) -> nx_int |
| 149 | func nx_chem_is_hspace(c: nx_int) -> nx_int |
| 159 | func nx_chem_is_lineterm(c: nx_int) -> nx_int |
| 176 | func nx_chem_peak_list_parse(buf: *u8, len: nx_int) -> *PeakList |
| 289 | func nx_chem_peak_list_read_file(path: *u8) -> *PeakList |
| 306 | func nx_chem_write_file(path: *u8, buf: *u8, len: nx_int) -> nx_int called by 3: o_load_compoundsm_load_rt_calibrationi_file_roundtrip calls 3: sys_openat_wrsys_writesys_close |
| 335 | func nx_chem_path_from_literal(literal: *u8) -> *u8 |
| 366 | func nx_chem_basename(path: *u8, out_buf: *u8) -> nx_int |