Skip to main content

ColumnarDNA

Struct ColumnarDNA 

Source
pub struct ColumnarDNA { /* private fields */ }

Implementations§

Source§

impl ColumnarDNA

Source

pub const fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Source

pub const fn len(&self) -> usize

Examples found in repository?
examples/histogram.rs (line 27)
13fn main() {
14    let path = std::env::args().nth(1).expect("No input file given");
15
16    // create a parser with the desired options
17    let mut parser = FastxParser::<CONFIG>::from_file(&path).expect("Cannot open file");
18    let mut num_a = 0;
19    let mut num_c = 0;
20    let mut num_t = 0;
21    let mut num_g = 0;
22
23    while let Some(_event) = parser.next() {
24        let cdna = parser.get_dna_columnar();
25        let (high_bits, hi) = cdna.high_bits();
26        let (low_bits, lo) = cdna.low_bits();
27        let rem = cdna.len() % 64;
28        for (&hi, &lo) in high_bits.iter().zip(low_bits) {
29            num_a += (!hi & !lo).count_ones() as usize;
30            num_c += (!hi & lo).count_ones() as usize;
31            num_t += (hi & !lo).count_ones() as usize;
32            num_g += (hi & lo).count_ones() as usize;
33        }
34        if rem > 0 {
35            num_a += (!hi & !lo).count_ones() as usize - (64 - rem);
36            num_c += (!hi & lo).count_ones() as usize;
37            num_t += (hi & !lo).count_ones() as usize;
38            num_g += (hi & lo).count_ones() as usize;
39        }
40    }
41
42    println!("a: {num_a}");
43    println!("c: {num_c}");
44    println!("t: {num_t}");
45    println!("g: {num_g}");
46}
Source

pub const fn is_empty(&self) -> bool

Source

pub const fn capacity(&self) -> usize

Source

pub fn clear(&mut self)

Source

pub fn append(&mut self, high: u64, low: u64, size: usize)

Source

pub fn high_bits(&self) -> (&[u64], u64)

Examples found in repository?
examples/histogram.rs (line 25)
13fn main() {
14    let path = std::env::args().nth(1).expect("No input file given");
15
16    // create a parser with the desired options
17    let mut parser = FastxParser::<CONFIG>::from_file(&path).expect("Cannot open file");
18    let mut num_a = 0;
19    let mut num_c = 0;
20    let mut num_t = 0;
21    let mut num_g = 0;
22
23    while let Some(_event) = parser.next() {
24        let cdna = parser.get_dna_columnar();
25        let (high_bits, hi) = cdna.high_bits();
26        let (low_bits, lo) = cdna.low_bits();
27        let rem = cdna.len() % 64;
28        for (&hi, &lo) in high_bits.iter().zip(low_bits) {
29            num_a += (!hi & !lo).count_ones() as usize;
30            num_c += (!hi & lo).count_ones() as usize;
31            num_t += (hi & !lo).count_ones() as usize;
32            num_g += (hi & lo).count_ones() as usize;
33        }
34        if rem > 0 {
35            num_a += (!hi & !lo).count_ones() as usize - (64 - rem);
36            num_c += (!hi & lo).count_ones() as usize;
37            num_t += (hi & !lo).count_ones() as usize;
38            num_g += (hi & lo).count_ones() as usize;
39        }
40    }
41
42    println!("a: {num_a}");
43    println!("c: {num_c}");
44    println!("t: {num_t}");
45    println!("g: {num_g}");
46}
Source

pub fn low_bits(&self) -> (&[u64], u64)

Examples found in repository?
examples/histogram.rs (line 26)
13fn main() {
14    let path = std::env::args().nth(1).expect("No input file given");
15
16    // create a parser with the desired options
17    let mut parser = FastxParser::<CONFIG>::from_file(&path).expect("Cannot open file");
18    let mut num_a = 0;
19    let mut num_c = 0;
20    let mut num_t = 0;
21    let mut num_g = 0;
22
23    while let Some(_event) = parser.next() {
24        let cdna = parser.get_dna_columnar();
25        let (high_bits, hi) = cdna.high_bits();
26        let (low_bits, lo) = cdna.low_bits();
27        let rem = cdna.len() % 64;
28        for (&hi, &lo) in high_bits.iter().zip(low_bits) {
29            num_a += (!hi & !lo).count_ones() as usize;
30            num_c += (!hi & lo).count_ones() as usize;
31            num_t += (hi & !lo).count_ones() as usize;
32            num_g += (hi & lo).count_ones() as usize;
33        }
34        if rem > 0 {
35            num_a += (!hi & !lo).count_ones() as usize - (64 - rem);
36            num_c += (!hi & lo).count_ones() as usize;
37            num_t += (hi & !lo).count_ones() as usize;
38            num_g += (hi & lo).count_ones() as usize;
39        }
40    }
41
42    println!("a: {num_a}");
43    println!("c: {num_c}");
44    println!("t: {num_t}");
45    println!("g: {num_g}");
46}
Source

pub fn get(&self, i: usize) -> (bool, bool)

Source

pub fn get_char(&self, i: usize) -> char

Trait Implementations§

Source§

impl Clone for ColumnarDNA

Source§

fn clone(&self) -> ColumnarDNA

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ColumnarDNA

Source§

fn default() -> ColumnarDNA

Returns the “default value” for a type. Read more
Source§

impl Display for ColumnarDNA

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.