jean is a computational biology library written in Rust. It offers
computational biology primitives such as sequences (DNA, RNA, and Protein), bases, amino acids, and codons. Optional features extend the
abilities of jean, such as io
which allows for reading/writing from/to common biological file formats (e.g. FASTA, GFF3) and alignment
which allows for aligning sequences.
Add jean
and any needed features to your Rust project:
$ cargo add jean # --features io,...
Feature | Use | Links |
---|---|---|
io |
I/O of common biological file formats (e.g. FASTA, GFF3) | (Documentation) |
macros |
Macros for creating sequences | (Documentation) |
alignment |
Sequence alignment tools | (Documentation) |
blosum |
BLOSUM substitution matrices | (Documentation) |
#[macro_use]
extern crate jean;
use jean::{alignment::global::NeedlemanWunsch, blosum::NUC_4_2, dna::Dna};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let seq1: Dna = dna!("AGACTAGTTAC");
let seq2: Dna = dna!("CGAGACGT");
let alignment = NeedlemanWunsch::new()
.matrix(&NUC_4_2)
.gap_penalty(|k| -2 * k)
.align(&seq1, &seq2)?;
assert_eq!(alignment.score, 16);
assert_eq!(alignment.a, dna!("--AGACTAGTTAC"));
assert_eq!(alignment.b, dna!("CGAGAC--G-T--"));
Ok(())
}
#[macro_use]
extern crate jean;
use jean::{cut::Cut, dna::Dna, prelude::*, protein::Protein, rna::Rna};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let cut = Cut::read_file("homo_sapien.cut")?;
/* DNA -> RNA -> Protein */
let d: Dna = dna!("AGGCTGGGCACC");
let r: Rna = d.transcribe();
let p: Protein = r.translate(&cut);
assert_eq!(p, protein!("RLGT"));
/* ...and back again */
let r_ = p.rev_translate(&cut);
let d_ = r_.rev_transcribe();
assert_eq!(d, d_);
Ok(())
}