pub struct ChrMap { /* private fields */ }Expand description
Insertion-ordered chromosome map. Order is the file’s reference order, which
callers depend on — chr_sizes is documented as coming back in it, and the
case-insensitive walk in try_lookup — private, so not linked — resolves
ties by it.
Implementations§
Source§impl ChrMap
impl ChrMap
Sourcepub fn from_entries(entries: impl IntoIterator<Item = (String, i64)>) -> Self
pub fn from_entries(entries: impl IntoIterator<Item = (String, i64)>) -> Self
Build from names and sizes, numbering them by insertion order.
A name given twice keeps the index it was first given, and its later
size wins. Numbering from map.len() instead left the two entries
sharing an index — the second overwrote the first in the map while the
count stood still — and an index is what a data record carries.
Sourcepub fn from_indexed_entries(
entries: impl IntoIterator<Item = (String, i64, usize)>,
) -> Self
pub fn from_indexed_entries( entries: impl IntoIterator<Item = (String, i64, usize)>, ) -> Self
Build from names, sizes and the indices the file gives them.
A bbi chromosome tree and a BAM reference list both store an explicit
index, and that index is what data records and R-tree items carry — so
it cannot be re-derived from position here. Entries are sorted by it,
which is the order chr_sizes reports them in.
Sourcepub fn with_key_size(self, key_size: usize) -> Self
pub fn with_key_size(self, key_size: usize) -> Self
The fixed key width a bbi chromosome tree declares. Message-only.
pub fn declared_key_size(&self) -> Option<usize>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = &ChrEntry>
pub fn names(&self) -> Vec<String>
Sourcepub fn by_index(&self, index: usize) -> Option<&ChrEntry>
pub fn by_index(&self, index: usize) -> Option<&ChrEntry>
The chromosome the file numbers index, not the one at that
position.
The two coincide on every file whose indices are dense and 0-based, which is every file any writer here or at UCSC produces — so the positional lookup is tried first and the walk is the fallback for a file that numbers its chromosomes otherwise.
Sourcepub fn genome_size(&self) -> i64
pub fn genome_size(&self) -> i64
Total size of every chromosome, which is what a whole-genome walk covers.
pub fn get(&self, id: &str) -> Option<&ChrEntry>
pub fn contains(&self, id: &str) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChrMap
impl RefUnwindSafe for ChrMap
impl Send for ChrMap
impl Sync for ChrMap
impl Unpin for ChrMap
impl UnsafeUnpin for ChrMap
impl UnwindSafe for ChrMap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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