Struct noodles_fasta::record::Sequence
source · [−]pub struct Sequence(_);
Expand description
A FASTA record sequence.
Implementations
sourceimpl Sequence
impl Sequence
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the sequence.
Examples
use noodles_fasta::record::Sequence;
let sequence = Sequence::default();
assert_eq!(sequence.len(), 0);
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the sequence is empty.
Examples
use noodles_fasta::record::Sequence;
let sequence = Sequence::default();
assert!(sequence.is_empty());
sourcepub fn get<I>(&self, index: I) -> Option<&I::Output> where
I: SequenceIndex<u8>,
pub fn get<I>(&self, index: I) -> Option<&I::Output> where
I: SequenceIndex<u8>,
Returns a reference to a base at or slice of bases between the given index.
Examples
use noodles_core::Position;
use noodles_fasta::record::Sequence;
let sequence = Sequence::from(b"ACGT".to_vec());
let start = Position::try_from(2)?;
assert_eq!(sequence.get(start), Some(&b'C'));
assert_eq!(sequence.get(start..), Some(&b"CGT"[..]));
let end = Position::try_from(3)?;
assert_eq!(sequence.get(start..=end), Some(&b"CG"[..]));
Trait Implementations
sourceimpl<I> Index<I> for Sequence where
I: SequenceIndex<u8>,
impl<I> Index<I> for Sequence where
I: SequenceIndex<u8>,
impl Eq for Sequence
impl StructuralEq for Sequence
impl StructuralPartialEq for Sequence
Auto Trait Implementations
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnwindSafe for Sequence
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more