pub struct ReverseComplement { /* private fields */ }Expand description
Reverse complement transformation for DNA/RNA sequences.
This augmentation reverses the sequence and complements each base:
- DNA: A↔T, C↔G
- RNA: A↔U, C↔G
§Examples
use deepbiop_fq::augment::{ReverseComplement, Augmentation};
let mut rc = ReverseComplement::new();
let sequence = b"ACGT";
let result = rc.apply(sequence);
assert_eq!(result, b"ACGT"); // Palindrome!
let sequence = b"AACCGGTT";
let result = rc.apply(sequence);
assert_eq!(result, b"AACCGGTT"); // Also palindrome!Implementations§
Source§impl ReverseComplement
impl ReverseComplement
Sourcepub fn new() -> ReverseComplement
pub fn new() -> ReverseComplement
Create a new reverse complement transformer for DNA.
Sourcepub fn for_rna() -> ReverseComplement
pub fn for_rna() -> ReverseComplement
Create a new reverse complement transformer for RNA.
Source§impl ReverseComplement
impl ReverseComplement
Sourcepub fn apply_batch(&mut self, sequences: &[Vec<u8>]) -> Vec<Vec<u8>>
pub fn apply_batch(&mut self, sequences: &[Vec<u8>]) -> Vec<Vec<u8>>
Apply reverse complement to a batch of sequences in parallel.
§Arguments
sequences- Slice of sequences to transform
§Returns
Vector of reverse complemented sequences
§Example
use deepbiop_fq::augment::ReverseComplement;
let mut rc = ReverseComplement::new();
let sequences = vec![b"ACGT".to_vec(), b"TTAA".to_vec()];
let results = rc.apply_batch(&sequences);
assert_eq!(results.len(), 2);Trait Implementations§
Source§impl Augmentation for ReverseComplement
impl Augmentation for ReverseComplement
Source§impl Clone for ReverseComplement
impl Clone for ReverseComplement
Source§fn clone(&self) -> ReverseComplement
fn clone(&self) -> ReverseComplement
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReverseComplement
impl Debug for ReverseComplement
Source§impl Default for ReverseComplement
impl Default for ReverseComplement
Source§fn default() -> ReverseComplement
fn default() -> ReverseComplement
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Forget for ReverseComplement
impl Freeze for ReverseComplement
impl Move for ReverseComplement
impl RefUnwindSafe for ReverseComplement
impl Send for ReverseComplement
impl Sync for ReverseComplement
impl Unpin for ReverseComplement
impl UnsafeUnpin for ReverseComplement
impl UnwindSafe for ReverseComplement
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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