Crates.io Crates.io docs.rs

kseq

kseq is a simple fasta/fastq (fastx) format parser library for Rust, its main function is to iterate over the records from fastx files (similar to kseq in C). It uses shared buffer to read and store records, so the speed is very fast. It supports a plain or gz fastx file or io::stdin, as well as a fofn (file-of-file-names) file, which contains multiple plain or gz fastx files (one per line).

Using kseq is very simple. Users only need to call parse_path to parse a path or parse_reader to parse a reader, and then use iter_record method to get each record.

Example

```norun use std::env::args; use std::fs::File; use kseq::parsepath;

fn main(){ let path: String = args().nth(1).unwrap(); let mut records = parsepath(path).unwrap(); // let mut records = parsereader(File::open(path).unwrap()).unwrap(); while let Some(record) = records.iter_record().unwrap() { println!("head:{} des:{} seq:{} qual:{} len:{}", record.head(), record.des(), record.seq(), record.qual(), record.len()); } } ```

Installation

text cargo add kseq

Benchmarking

text cargo bench