diff --git a/benches/all_windows.rs b/benches/all_windows.rs index 918989d..10e3b1f 100644 --- a/benches/all_windows.rs +++ b/benches/all_windows.rs @@ -117,7 +117,8 @@ impl IterBasedSequenceWindows { })); aas.extend( dna.iter() - .reverse_complement() + .rev() + .complement() .self_reading_frames() .into_iter() .map(|codons| { @@ -128,7 +129,8 @@ impl IterBasedSequenceWindows { let dna_rc = dna .iter() - .reverse_complement() + .rev() + .complement() .map(|n| n.to_ascii()) .collect(); let dna_rc = String::from_utf8(dna_rc).unwrap(); diff --git a/src/iter.rs b/src/iter.rs index 95ca600..f201e38 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -152,22 +152,6 @@ pub trait NucleotideIter: Iterator + Sized { /// ``` fn complement(self) -> Complement; - /// Returns iterator of reverse complement of contained nucleotides. - /// - /// # Examples - /// - /// ``` - /// use quickdna::{Nucleotide, NucleotideIter}; - /// - /// use Nucleotide::*; - /// let dna = [C, G, A, T]; - /// - /// assert!(dna.iter().reverse_complement().eq([A, T, C, G])); - /// ``` - fn reverse_complement(self) -> std::iter::Rev> - where - Self: DoubleEndedIterator; - /// Returns up to 3 non-empty codon iterators for reading frames. /// /// The iterators are given in ascending order of offset from the beginning of the @@ -230,7 +214,7 @@ where let mut iter3 = iter2.clone(); iter3.next(); - let iter1_rc = iter1.clone().reverse_complement(); + let iter1_rc = iter1.clone().rev().complement(); let mut iter2_rc = iter1_rc.clone(); iter2_rc.next(); let mut iter3_rc = iter2_rc.clone(); @@ -256,13 +240,6 @@ where Complement(self) } - fn reverse_complement(self) -> std::iter::Rev> - where - Self: DoubleEndedIterator, - { - self.complement().rev() - } - fn self_reading_frames(self) -> SmallVec<[Codons; 3]> where Self: Clone + ExactSizeIterator, @@ -388,7 +365,7 @@ where #[derive(Clone, Debug)] pub enum ForwardOrRcCodons { Forward(Codons), - Rc(Codons>>), + Rc(Codons>>), } impl Iterator for ForwardOrRcCodons