ReadFX is a Nim library for parsing FASTQ/FASTA files with high performance.
ReadFX is a Nim library for parsing FASTA and FASTQ files (collectively known as FASTX). It combines two approaches to sequence file parsing:
Both implementations provide efficient parsing with different tradeoffs in terms of performance and memory usage.
nimble install readfx
import readfx
# Using the C wrapper (klib)
for record in readFQ("example.fastq"):
echo record.name, ": ", record.sequence.len
# Using pointer-based version (more efficient, reuses memory)
for record in readFQPtr("example.fastq.gz"):
echo $record.name, ": ", $record.sequence.len
# Using the native Nim implementation
var r: FQRecord
var f = xopen[GzFile]("example.fastq.gz")
defer: f.close()
while f.readFastx(r):
echo r.name, ": ", r.sequence.len
Parsing algorithms - Details about the parsing implementation