code wiki / (root) / nx_chem_peak_list.nx

nx_chem_peak_list.nx

buildroot/runtime/nx_chem_peak_list.nx

15504 B404 linesdepth 7pulls 9 transitivereach 11 importersview sourcekind librarytopic chem
docsdependenciesstructsconstsfunctions

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

nx_chem.nx nx_syscalls.nx nx_loop.nx nx_chem_peak_list.nx nx_chem_adulterant_db.nx nx_chem_adulterant_db_test.nx nx_chem_peak_list_test.nx nx_chem_report_csv.nx nx_chem_report_csv_test.nx nx_chem_report_json.nx nx_chem_report_json_test.nx nx_supplement.nx nx_supplement_batch.nx nx_supplement_check.nx

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

31struct PeakObservation
38struct PeakList

consts

36const NX_PEAK_OBS_BYTES: nx_int = 24
43const NX_PEAK_LIST_BYTES: nx_int = 24

functions

48func nx_chem_peak_list_new(cap: nx_int) -> *PeakList
59func nx_chem_peak_list_add(pl: *PeakList, mz_q4: nx_int, intensity_q4: nx_int, rt_q3: nx_int) -> nx_int
80func nx_chem_parse_decimal_q4(buf: *u8, offset: nx_int, len: nx_int, out_value: *nx_int) -> nx_int
149func nx_chem_is_hspace(c: nx_int) -> nx_int
159func nx_chem_is_lineterm(c: nx_int) -> nx_int
176func nx_chem_peak_list_parse(buf: *u8, len: nx_int) -> *PeakList
289func nx_chem_peak_list_read_file(path: *u8) -> *PeakList
306func nx_chem_write_file(path: *u8, buf: *u8, len: nx_int) -> nx_int
335func nx_chem_path_from_literal(literal: *u8) -> *u8
366func nx_chem_basename(path: *u8, out_buf: *u8) -> nx_int