pub trait DnaIterExt: Iterator {
// Provided methods
fn reverse_complemented<N>(self) -> Complemented<N, Rev<Self>> ⓘ
where Self: Sized + DoubleEndedIterator<Item: AsRef<N>>,
N: Nucleotide { ... }
fn complemented<N>(self) -> Complemented<N, Self> ⓘ
where Self: Sized + Iterator<Item: AsRef<N>>,
N: Nucleotide { ... }
fn reverse_complement<N>(self)
where Self: Sized + DoubleEndedIterator<Item: AsMut<N>>,
N: Nucleotide { ... }
fn complement<'a, N>(self)
where Self: Sized + Iterator<Item = &'a mut N>,
N: Nucleotide { ... }
fn codons<N>(self) -> Codons<N, Self> ⓘ
where Self: Sized + Iterator<Item: AsRef<N>>,
N: Nucleotide { ... }
fn trimmed_to_codon<N>(self) -> Self
where Self: Sized + DoubleEndedIterator<Item: AsRef<N>> + ExactSizeIterator,
N: Nucleotide { ... }
fn translated_by<N, G>(
self,
genetic_code: G,
) -> Translated<G, Codons<N, Self>> ⓘ
where Self: Sized + Iterator<Item: AsRef<N>>,
N: Nucleotide,
G: GeneticCode { ... }
fn display<N>(&self) -> Display<Self>
where Self: Clone + Iterator<Item: AsRef<N>>,
N: Nucleotide { ... }
}Expand description
Helpers for working with iterators of Nucleotides.
Provided Methods§
Sourcefn reverse_complemented<N>(self) -> Complemented<N, Rev<Self>> ⓘ
fn reverse_complemented<N>(self) -> Complemented<N, Rev<Self>> ⓘ
Return iterator over reverse-complemented nucleotides.
§Examples
use nucs::{DnaIterExt, Nuc};
let complement = Nuc::arr(b"GATTACA").into_iter().reverse_complemented();
assert!(complement.eq(Nuc::arr(b"TGTAATC")));Sourcefn complemented<N>(self) -> Complemented<N, Self> ⓘ
fn complemented<N>(self) -> Complemented<N, Self> ⓘ
Return iterator over complemented nucleotides.
This is like mapping the iterator through Nucleotide::complement.
§Examples
use nucs::{DnaIterExt, Nuc};
let complement = Nuc::arr(b"GATTACA").into_iter().complemented();
assert!(complement.eq(Nuc::arr(b"CTAATGT")));Sourcefn reverse_complement<N>(self)
fn reverse_complement<N>(self)
Perform in-place reverse-complement, consuming the iterator.
This swaps the front and back of the iterator and sets them to their
Nucleotide::complement.
§Examples
use nucs::{DnaIterExt, Nuc};
let mut dna = Nuc::arr(b"GATTACA");
dna.iter_mut().reverse_complement();
assert_eq!(dna, Nuc::arr(b"TGTAATC"));Sourcefn complement<'a, N>(self)
fn complement<'a, N>(self)
Perform in-place complement, consuming the iterator.
This is sets each element to its Nucleotide::complement.
§Examples
use nucs::{DnaIterExt, Nuc};
let mut dna = Nuc::arr(b"GATTACA");
dna.iter_mut().complement();
assert_eq!(dna, Nuc::arr(b"CTAATGT"));Sourcefn codons<N>(self) -> Codons<N, Self> ⓘ
fn codons<N>(self) -> Codons<N, Self> ⓘ
Return iterator over codons of first reading frame.
This discards any leftover trailing nucleotides.
§Examples
use nucs::{DnaIterExt, Nuc};
use Nuc::{A, C, G, T};
let codons = Nuc::arr(b"GATTACA").into_iter().codons();
assert!(codons.eq([
[G, A, T],
[T, A, C],
]));Sourcefn trimmed_to_codon<N>(self) -> Self
fn trimmed_to_codon<N>(self) -> Self
Discard trailing nucleotides that aren’t part of the first reading frame.
§Examples
use nucs::{DnaIterExt, Nuc};
use Nuc::{A, C, G, T};
let codons = Nuc::arr(b"GATTACA").into_iter().trimmed_to_codon();
assert!(codons.eq([
G, A, T,
T, A, C,
]));Sourcefn translated_by<N, G>(self, genetic_code: G) -> Translated<G, Codons<N, Self>> ⓘ
fn translated_by<N, G>(self, genetic_code: G) -> Translated<G, Codons<N, Self>> ⓘ
Return iterator translating codons into amino acids.
The given GeneticCode is applied to the first reading frame’s codons
(discarding leftover trailing nucleotides).
§Examples
use nucs::{DnaIterExt, NCBI1, Nuc, Seq};
let peptide: Seq<Vec<_>> = Nuc::arr(b"TATGCGAGAAAC")
.into_iter()
.translated_by(NCBI1)
.collect();
assert_eq!(peptide, "YARN");Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".