pub struct SequenceDictionary { /* private fields */ }Expand description
A lookup table mapping reference sequence names to their indices and lengths.
Constructed from a FASTA index, this type consolidates all name-index-length mapping into a single shared structure.
Implementations§
Source§impl SequenceDictionary
impl SequenceDictionary
Sourcepub fn get_by_index(&self, index: usize) -> Option<&SequenceMetadata>
pub fn get_by_index(&self, index: usize) -> Option<&SequenceMetadata>
Look up a sequence by its 0-based index.
Sourcepub fn get_by_name(&self, name: &str) -> Option<&SequenceMetadata>
pub fn get_by_name(&self, name: &str) -> Option<&SequenceMetadata>
Look up a sequence by name.
Sourcepub fn iter(&self) -> impl Iterator<Item = &SequenceMetadata>
pub fn iter(&self) -> impl Iterator<Item = &SequenceMetadata>
Iterate over all sequences in index order.
Sourcepub fn total_length(&self) -> u64
pub fn total_length(&self) -> u64
Return the total length of all sequences combined.
Sourcepub fn from_entries(sequences: Vec<SequenceMetadata>) -> Self
pub fn from_entries(sequences: Vec<SequenceMetadata>) -> Self
Build a dictionary from a pre-constructed list of entries.
Useful for testing and for cases where the dictionary is constructed
from sources other than a FASTA index. Entries are re-indexed by their
position in the vector (the index field of each SequenceMetadata
is ignored and replaced).
Trait Implementations§
Source§impl Clone for SequenceDictionary
impl Clone for SequenceDictionary
Source§fn clone(&self) -> SequenceDictionary
fn clone(&self) -> SequenceDictionary
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 Debug for SequenceDictionary
impl Debug for SequenceDictionary
Source§impl From<&Index> for SequenceDictionary
impl From<&Index> for SequenceDictionary
Source§impl Index<&str> for SequenceDictionary
impl Index<&str> for SequenceDictionary
Source§type Output = SequenceMetadata
type Output = SequenceMetadata
The returned type after indexing.
Source§impl Index<usize> for SequenceDictionary
impl Index<usize> for SequenceDictionary
Source§type Output = SequenceMetadata
type Output = SequenceMetadata
The returned type after indexing.
Auto Trait Implementations§
impl Freeze for SequenceDictionary
impl RefUnwindSafe for SequenceDictionary
impl Send for SequenceDictionary
impl Sync for SequenceDictionary
impl Unpin for SequenceDictionary
impl UnsafeUnpin for SequenceDictionary
impl UnwindSafe for SequenceDictionary
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