#bioinformatics #sequencing #dna

bin+lib fxread

A barebones fastx reader for rust

12 releases

0.2.5 Sep 28, 2022
0.2.4 Jul 26, 2022
0.1.8 Jul 21, 2022

#183 in Science

Download history 27/week @ 2022-10-08 14/week @ 2022-10-15 25/week @ 2022-10-22 21/week @ 2022-10-29 22/week @ 2022-11-05 10/week @ 2022-11-12 30/week @ 2022-11-19 7/week @ 2022-11-26 10/week @ 2022-12-03 18/week @ 2022-12-10 13/week @ 2022-12-17 23/week @ 2022-12-24 6/week @ 2022-12-31 7/week @ 2023-01-07 9/week @ 2023-01-14 30/week @ 2023-01-21

54 downloads per month
Used in 3 crates

MIT license

31KB
670 lines

fxread

MIT licensed actions status codecov

A barebones fastx reader for rust.

Summary

This crate attempts to be a faster and more lightweight alternative to bio-rs and provides a standardized interface to working with fasta and fastq formats. The goal of this crate is to be fast and flexible - it is about twice as fast as bio-rs on average but about half as fast than fastq for standard fastx files. The difference between the different crates is reduced heavily though once gzip files are included (see benchmark).

The speed up can be attributed to reducing the total number of vectors allocated for each record - but the limitation compared to fastq is that each record has ownership over its data and is allocated once. This creates extra overhead, but is very convenient as you can treat the reader directly as an iterator.

Usage

Some benefits of this interface is that each FastaReader and FastqReader share the FastxReader trait and act as iterators over Records.

initialize_reader can determine the fastq format from the path name

use fxread::initialize_reader;

let path = "example/sequences.fq";
let reader = initialize_reader(path).unwrap();
assert_eq!(reader.count(), 10);

initialize_reader can handle if the file is gzip or not without changing the downstream usage

use fxread::initialize_reader;

let path = "example/sequences.fq.gz";
let reader = initialize_reader(path).unwrap();
assert_eq!(reader.count(), 10);

Check out the API Documentation for usage

Dependencies

~420KB