nx_fasta.nx
buildroot/runtime/nx_fasta.nx
about
nx_fasta.nx -- FASTA single-record stream parser + strip-whitespace.
license_tier: INDEPENDENT_REDERIVE
genealogy_id: international-research-sources/lipman-1985-fasta-format
G2.0c of NISHI_GENOMICS_SUBSTRATE_ROADMAP.md. Reference-genome
ingestion bridge: most reference assemblies (GRCh38, T2T-CHM13,
every UCSC + Ensembl + NCBI download) ship as gzipped FASTA where
each chromosome / contig is a record with multi-line wrapped
sequence (canonical wrap = 60 or 80 chars per line).
FASTA canonical format (Lipman + Pearson 1985):
line 1: '>' + identifier [+ optional description]
line 2..N: nucleotide (or amino-acid) sequence, line-wrapped
record ends at next '>' or EOF
Differs from FASTQ:
- '>' marker (not '@')
- Sequence WRAPS across multiple lines -- any line not starting
with '>' is sequence content (no '+' / qual lines)
- No quality scores
API:
fasta_parse_one_record(buf, buf_len, offset, out_meta) -> i64
out_meta layout (5 i64s):
[0] header_start (offset after the '>', start of identifier)
[1] header_len (bytes from header_start to end of line 1)
[2] seq_start (first byte of seq region)
[3] seq_end_excl (one past last byte of seq region;
== offset of next '>' or buf_len at EOF)
[4] next_offset (where the next record begins; same as seq_end_excl)
Return: 0 success / 1 EOF / -1 malformed
fasta_strip_whitespace(src, src_start, src_end_excl,
dst, max_dst) -> i64
Copies src[src_start..src_end_excl) into dst, skipping
whitespace bytes (LF 0x0A, CR 0x0D, space 0x20, tab 0x09).
Returns count written or -1 if max_dst exceeded.
Typical caller flow:
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_const.nxnx_fastq.nx
imported by: nx_fasta_test.nx
structs
| none |
consts
| none |
functions
| 88 | func nx_is_whitespace(b: i64) -> i64 |
| 100 | func fasta_find_next_record_start(buf: *u8, start: i64, end: i64) -> i64 called by 1: fasta_parse_one_record |
| 117 | func fasta_strip_whitespace(src: *u8, src_start: i64, src_end_excl: i64, |
| 139 | func fasta_parse_one_record(buf: *u8, buf_len: i64, offset: i64, |