[][src]Module debruijn::dna_string

A 2-bit encoding of arbitrary length DNA sequences.

Store arbitrary-length DNA strings in a packed 2-bit encoding. Individual base values are encoded as the integers 0,1,2,3 corresponding to A,C,G,T.

Example

use debruijn::Kmer;
use debruijn::dna_string::*;
use debruijn::kmer::Kmer16;
use debruijn::Vmer;

// Construct a new DNA string
let dna_string1 = DnaString::from_dna_string("ACAGCAGCAGCACGTATGACAGATAGTGACAGCAGTTTGTGACCGCAAGAGCAGTAATATGATG");

// Get an immutable view into the sequence
let slice1 = dna_string1.slice(10, 40);

// Get a kmer from the DNA string
let first_kmer: Kmer16 = slice1.get_kmer(0);
assert_eq!(first_kmer, Kmer16::from_ascii(b"CACGTATGACAGATAG"))

Structs

DnaString

A container for sequence of DNA bases.

DnaStringIter

Iterator over values of a DnaStringoded sequence (values will be unpacked into bytes).

DnaStringSlice

An immutable slice into a DnaString

PackedDnaStringSet

Container for many distinct sequences, concatenated into a single DnaString. Each sequence is accessible by index as a DnaStringSlice.

Functions

ndiffs

Compute the number of base positions at which two DnaStrings differ, assuming that they have the same length.