Skip to main content

ChrMap

Struct ChrMap 

Source
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

Source

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.

Source

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.

Source

pub fn with_key_size(self, key_size: usize) -> Self

The fixed key width a bbi chromosome tree declares. Message-only.

Source

pub fn declared_key_size(&self) -> Option<usize>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = &ChrEntry>

Source

pub fn names(&self) -> Vec<String>

Source

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.

Source

pub fn genome_size(&self) -> i64

Total size of every chromosome, which is what a whole-genome walk covers.

Source

pub fn get(&self, id: &str) -> Option<&ChrEntry>

Source

pub fn contains(&self, id: &str) -> bool

Source

pub fn resolve(&self, id: &str) -> Result<&ChrEntry>

Resolve a requested name, or fail with everything known about why not.

Source

pub fn select(&self, requested: &[String]) -> Result<Vec<ChrEntry>>

Which chromosomes a request walks: the ones named, resolved, in the order they were asked for — or every chromosome in the file’s order when none were named.

Trait Implementations§

Source§

impl Clone for ChrMap

Source§

fn clone(&self) -> ChrMap

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChrMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChrMap

Source§

fn default() -> ChrMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.