Struct debruijn::dna_string::DnaString[][src]

pub struct DnaString { /* fields omitted */ }
Expand description

A container for sequence of DNA bases.

use debruijn::dna_string::DnaString;
use debruijn::kmer::Kmer8;
use debruijn::{Mer, Vmer};

let dna_string = DnaString::from_dna_string("ATCGTACGTACGTAGTC");

// Iterate over 8-mers
for k in dna_string.iter_kmers::<Kmer8>() {
    println!("{:?}", k);
}

// Get a base, encoded as a byte in 0-3 range
assert_eq!(dna_string.get(0), 0);
assert_eq!(dna_string.get(1), 3);

// Make a read-only 'slice' of a DnaString
let slc = dna_string.slice(1, 10);

 assert_eq!(slc.iter_kmers::<Kmer8>().next(), dna_string.iter_kmers::<Kmer8>().skip(1).next());

Implementations

Create an empty DNA string

Length of the sequence

Create a new instance with a given capacity.

Create a DnaString of length n initialized to all A’s

Create a DnaString corresponding to an ACGT-encoded str.

Create a DnaString corresponding to an ACGT-encoded str.

Create a DnaString from an ASCII ACGT-encoded byte slice. Non ACGT positions will be converted to ‘A’

Create a DnaString from an ACGT-encoded byte slice, Non ACGT positions will be converted to repeatable random base determined by a hash of the read name and the position within the string.

Create a DnaString from a 0-4 encoded byte slice

Convert sequence to a String

Convert sequence to a Vector of 0-4 encoded bytes

Convert sequence to a Vector of ascii-encoded bytes

Append a 0-4 encoded base.

Push 0-4 encoded bases from a byte array.

Arguments

bytes: byte array to read values from seq_length: how many values to read from the byte array. Note that this is number of values not number of elements of the byte array.

Iterate over stored values (values will be unpacked into bytes).

Clear the sequence.

Get the length k prefix of the DnaString

Get the length k suffix of the DnaString

Get slice containing the interval [start, end) of self

Create a fresh DnaString containing the reverse of self

Compute Hamming distance between this DnaString and another DnaString. The two strings must have the same length.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Get the value at position i.

Set the value as position i.

Length of DNA sequence

Set nbases positions in the sequence, starting at pos. Values must be packed into the upper-most bits of value. Read more

Return a new object containing the reverse complement of the sequence

Iterate over the bases in the sequence

Count the number of A/T bases in the kmer

Count the number of G/C bases in the kmer

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Get the kmer starting at position pos

Create a new sequence with length len, initialized to all A’s

Maximum sequence length that can be stored in this type

Create a Vmer from a sequence of bytes

Get the first Kmer from the sequence

Get the last kmer in the sequence

Get the terminal kmer of the sequence, on the both side of the sequence

Get the terminal kmer of the sequence, on the side of the sequence given by dir

Iterate over the kmers in the sequence

Iterate over the kmers and their extensions, given the extensions of the whole sequence

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.