nx_fastq.nx
buildroot/runtime/nx_fastq.nx
about
nx_fastq.nx -- FASTQ single-record stream parser.
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/cock-2010-fastq-format
G2.0b of NISHI_GENOMICS_SUBSTRATE_ROADMAP.md. The bridge between
raw sequencer-emitted byte streams and the substrate's typed DNA
+ Phred primitives. Parses ONE record per call (4-line format)
and emits offset metadata; the caller composes downstream with:
dna_pack_ambig(buf + seq_start, seq_len, out_bases, out_nbits)
nx_phred33_decode_string(buf + qual_start, qual_len, out_qs)
FASTQ canonical 4-line format (Cock 2010):
line 1: '@' + identifier [+ optional description]
line 2: nucleotide sequence (single line in G2.0b -- see deferred)
line 3: '+' [+ optional repeated identifier]
line 4: quality string, len == seq len, Phred+33 encoded
Validation enforced:
- record starts with '@' (offset position 0)
- separator line starts with '+'
- seq_len == qual_len
What G2.0b does NOT do (deferred):
- Multi-line sequence / quality (rare in modern data; complicates
parsing because qual chars include '@' and '+' so line-by-line
scanning ambiguates without lookahead) -- G2.0b.2
- gzip / bgzip decompression -- callers pre-decompress; nx_gzip
wrapper exists, integration is G2.0b.3
- Header field parsing (Illumina-style "INSTRUMENT:RUN:FLOWCELL:..."
metadata) -- G2.0b.4
- Phred encoding auto-detection (+33 vs +64) -- G2.0a.1 heuristic
- Paired-end record pairing across R1/R2 files -- G2.0b.5
API:
nx_find_lf(buf, start, end) -> i64 offset of next LF or -1
fastq_parse_one_record(buf, buf_len, offset, out_meta) -> i64
out_meta layout (7 i64s):
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_const.nx
imported by: nx_fasta.nxnx_fastq_test.nx
structs
| none |
consts
| none |
functions
| 87 | func nx_find_lf(buf: *u8, start: i64, end: i64) -> i64 |
| 98 | func fastq_parse_one_record(buf: *u8, buf_len: i64, offset: i64, |