Skip to content

Introduction

High-Performance Bioinformatics I/O for Mojo

Section titled “High-Performance Bioinformatics I/O for Mojo”

GitHub · API Reference · PyPI

BlazeSeq is a cohesive parsing stack for genomics formats in Mojo. It is designed for the full path from local files to accelerated compute with high throughput, explicit data ownership, and GPU-ready batch layouts.

  • One stack, multiple formats: FASTQ, FASTA, FAI, and BED in one library.
  • Performance by default: SIMD-oriented parsing and low-allocation APIs.
  • CPU to GPU bridge: Batch APIs and upload utilities for accelerator workflows.
  • Ergonomic interfaces: Stream views, owned records, or batch iteration from the same parser.
FormatParserTypical use
FASTQFastqParserRead sequencing reads with quality scores
FASTAFastaParserReference and assembly sequence parsing
FAIFaiParserFASTA/FASTQ index metadata access
BEDBedParserGenomic interval and region processing

Install via pixi by adding BlazeSeq to your pixi.toml:

[dependencies]
blazeseq = { git = "https://github.com/MoSafi2/BlazeSeq", branch = "main" }

Then run pixi install and parse FASTQ data:

from blazeseq import FastqParser, FileReader
from std.pathlib import Path
def main() raises:
var parser = FastqParser[FileReader](FileReader(Path("reads.fastq")), "sanger")
for view in parser.views():
_ = view.id()
_ = len(view)
from blazeseq import FastaParser, FileReader
from std.pathlib import Path
def main() raises:
var parser = FastaParser[FileReader](FileReader(Path("ref.fa")))
for record in parser:
print(record.id(), len(record))
from blazeseq import FaiParser, FileReader
from std.pathlib import Path
def main() raises:
var parser = FaiParser[FileReader](FileReader(Path("ref.fa.fai")))
for rec in parser:
print(rec.name(), rec.length(), rec.offset())
from blazeseq import BedParser, FileReader
from std.pathlib import Path
def main() raises:
var parser = BedParser[FileReader](FileReader(Path("regions.bed")))
for interval in parser.views():
print(interval.chrom(), interval.chrom_start, interval.chrom_end)

RapidgzipReader currently preserves the older API but falls back to GZFile internally while the external rapidgzip dependency is disabled.

from blazeseq import FastqParser, RapidgzipReader
from std.pathlib import Path
def main() raises:
var reader = RapidgzipReader(Path("reads.fastq.gz"), parallelism=4)
var parser = FastqParser[RapidgzipReader](reader^, "illumina_1.8")
for batch in parser.batches(1024):
var device_batch = batch.to_device()
_ = device_batch