#dna #protein #matrix #rna #sequence-alignment #blosum

bin+lib jean_blosum

BLOSUM feature for jean

1 unstable release

0.1.0 Dec 1, 2022

#271 in Biology

26 downloads per month
Used in jean

GPL-3.0 license

3.5K SLoC


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.

Getting Started

Add jean and any needed features to your Rust project:

$ cargo add jean # --features io,...

Feature Matrix

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)


DNA Sequence Alignment

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()
    .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--"));


DNA -> RNA -> Protein

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_);



~98K SLoC