pub struct ColumnarDNA { /* private fields */ }Implementations§
Source§impl ColumnarDNA
impl ColumnarDNA
pub const fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub const fn len(&self) -> usize
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}pub const fn is_empty(&self) -> bool
pub const fn capacity(&self) -> usize
pub fn clear(&mut self)
pub fn append(&mut self, high: u64, low: u64, size: usize)
Sourcepub fn high_bits(&self) -> (&[u64], u64)
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}Sourcepub fn low_bits(&self) -> (&[u64], u64)
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}pub fn get(&self, i: usize) -> (bool, bool)
pub fn get_char(&self, i: usize) -> char
Trait Implementations§
Source§impl Clone for ColumnarDNA
impl Clone for ColumnarDNA
Source§fn clone(&self) -> ColumnarDNA
fn clone(&self) -> ColumnarDNA
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ColumnarDNA
impl Default for ColumnarDNA
Source§fn default() -> ColumnarDNA
fn default() -> ColumnarDNA
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ColumnarDNA
impl RefUnwindSafe for ColumnarDNA
impl Send for ColumnarDNA
impl Sync for ColumnarDNA
impl Unpin for ColumnarDNA
impl UnsafeUnpin for ColumnarDNA
impl UnwindSafe for ColumnarDNA
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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