readfx
FASTX parser for SeqFu (klib)
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Passing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install readfx
choosenim install readfx
git clone https://github.com/quadram-institute-bioscience/readfx
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| readfx | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/quadram-institute-bioscience/readfx |
|---|---|
| Homepage | https://github.com/quadram-institute-bioscience/readfx |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
ReadFX - Nim FASTQ/FASTA Parser
The Nim FASTA/FASTQ parsing library for SeqFu.
Installation
nimble install readfx
Usage
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.sequenceLen
# 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
# Reading paired-end FASTQ files
for pair in readFQPair("sample_R1.fastq.gz", "sample_R2.fastq.gz"):
echo "R1: ", pair.read1.name, " (", pair.read1.sequence.len, " bp)"
echo "R2: ", pair.read2.name, " (", pair.read2.sequence.len, " bp)"
# Pointer-based paired-end iteration (zero-copy, pointers are reused)
for pair in readFQPairPtr("sample_R1.fastq.gz", "sample_R2.fastq.gz"):
echo "Pair length: ", pair.read1.sequenceLen + pair.read2.sequenceLen
# Pointer-based interleaved paired-end iteration
for pair in readFQInterleavedPairPtr("sample.interleaved.fastq.gz", checkNames = true):
echo "Pair length: ", pair.read1.sequenceLen + pair.read2.sequenceLen
FQRecordPtr now includes cached nameLen, commentLen, sequenceLen, and
qualityLen fields. These lengths exclude the trailing NUL terminator and
avoid repeated cstring scans in pointer-heavy code. Because FQRecordPtr
layout changed, downstream projects must be recompiled after upgrading to this
release.
Authors
- Original library by Heng Li (kseq.h) and Andreas Wilm (readfq)
- Updated and maintained by Andrea Telatin and the Quadram Institute Bioscience Core Bioinformatics team
- Co-authored by Claude code