pub struct Map(/* private fields */);
Expand description
A mapping from samples to populations.
Implementations§
Source§impl Map
impl Map
Sourcepub fn from_all<I>(samples: I) -> Selfwhere
I: IntoIterator<Item = Sample>,
pub fn from_all<I>(samples: I) -> Selfwhere
I: IntoIterator<Item = Sample>,
Creates a new mapping by mapping all samples to the same, unnamed population.
Sourcepub fn from_path<P>(path: P) -> Result<Self>
pub fn from_path<P>(path: P) -> Result<Self>
Creates a new mapping by reading a samples file at the provided path.
Sourcepub fn from_reader<R>(reader: R) -> Result<Self>where
R: Read,
pub fn from_reader<R>(reader: R) -> Result<Self>where
R: Read,
Creates a new mapping by reading a samples file from the provided reader.
Sourcepub fn get_population_id(&self, sample: &Sample) -> Option<Id>
pub fn get_population_id(&self, sample: &Sample) -> Option<Id>
Returns the population id of a sample if defined, otherwise None
.
Sourcepub fn get_sample(&self, id: Id) -> Option<&Sample>
pub fn get_sample(&self, id: Id) -> Option<&Sample>
Returns the sample with the provided id if defined, otherwise None
.
Sourcepub fn get_sample_id(&self, sample: &Sample) -> Option<Id>
pub fn get_sample_id(&self, sample: &Sample) -> Option<Id>
Returns the id of the provided sample if defined, otherwise None
.
Sourcepub fn number_of_populations(&self) -> usize
pub fn number_of_populations(&self) -> usize
Returns the number of populations in the mapping.
Sourcepub fn population_sizes(&self) -> HashMap<Id, usize>
pub fn population_sizes(&self) -> HashMap<Id, usize>
Returns the number of samples defined for each population id.
Trait Implementations§
Source§impl<S, P> FromIterator<(S, P)> for Map
impl<S, P> FromIterator<(S, P)> for Map
impl Eq for Map
impl StructuralPartialEq for Map
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.