bam is a crate that allows to read BAM files, written completely in Rust.
Why?
Having a crate written completely in Rust reduces the number of dependencies and compilation time. Additionally, it removes the need to install additional C libraries.
Errors produced by this crate are more readable and easier to catch and fix on-the-fly.
Overview
Currently, there are three readers and two writers:
bam::IndexedReader
- fetches records from random genomic regions.bam::BamReader
- reads a BAM file consecutively.bam::SamReader
- reads a SAM file consecutively.bam::BamWriter
- writes a BAM file.bam::SamWriter
- writes a SAM file.
The bgzip
module contains bgzip readers and writers.
The crate also allows to conviniently work with SAM/BAM records
and their fields, such as CIGAR
or tags
.
Usage
The following code would load BAM file in.bam
and its index in.bam.bai
, take all records
from 3:600001-700000
and print them on the stdout.
extern crate bam;
use io;
use RecordWriter;
You can find more detailed usage here.
Changelog
You can find changelog here.
Future versions
- Support for multi-thread loading and writing,
- Speed optimizations.