Struct tskit::MutationTable
source · #[repr(transparent)]pub struct MutationTable { /* private fields */ }
Expand description
An immutable view of site table.
Implementations§
source§impl MutationTable
impl MutationTable
sourcepub fn site<M: Into<MutationId> + Copy>(&self, row: M) -> Option<SiteId>
pub fn site<M: Into<MutationId> + Copy>(&self, row: M) -> Option<SiteId>
Return the site
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn node<M: Into<MutationId> + Copy>(&self, row: M) -> Option<NodeId>
pub fn node<M: Into<MutationId> + Copy>(&self, row: M) -> Option<NodeId>
Return the node
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn parent<M: Into<MutationId> + Copy>(&self, row: M) -> Option<MutationId>
pub fn parent<M: Into<MutationId> + Copy>(&self, row: M) -> Option<MutationId>
Return the parent
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn time<M: Into<MutationId> + Copy>(&self, row: M) -> Option<Time>
pub fn time<M: Into<MutationId> + Copy>(&self, row: M) -> Option<Time>
Return the time
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn derived_state<M: Into<MutationId>>(&self, row: M) -> Option<&[u8]>
pub fn derived_state<M: Into<MutationId>>(&self, row: M) -> Option<&[u8]>
Get the derived_state
value from row row
of the table.
Return
Will return None
if there is no derived state.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn metadata<T: MutationMetadata>(
&self,
row: MutationId
) -> Option<Result<T, TskitError>>
pub fn metadata<T: MutationMetadata>( &self, row: MutationId ) -> Option<Result<T, TskitError>>
Retrieve decoded metadata for a row
.
Returns
Some(Ok(T))
ifrow
is valid and decoding succeeded.Some(Err(_))
ifrow
is not valid and decoding failed.None
ifrow
is not valid.
Errors
TskitError::MetadataError
if decoding fails.
Examples.
The big-picture semantics are the same for all table types.
See crate::IndividualTable::metadata
for examples.
sourcepub fn iter(&self) -> impl Iterator<Item = MutationTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = MutationTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is MutationTableRow
.
pub fn lending_iter(&self) -> MutationTableRowView<'_>
sourcepub fn row<M: Into<MutationId> + Copy>(&self, r: M) -> Option<MutationTableRow>
pub fn row<M: Into<MutationId> + Copy>(&self, r: M) -> Option<MutationTableRow>
sourcepub fn row_view<M: Into<MutationId> + Copy>(
&self,
r: M
) -> Option<MutationTableRowView<'_>>
pub fn row_view<M: Into<MutationId> + Copy>( &self, r: M ) -> Option<MutationTableRowView<'_>>
Return a view of row r
of the table.
Parameters
r
: the row id.
Returns
Some(row view)
ifr
is validNone
otherwise
sourcepub fn node_slice(&self) -> &[NodeId]
pub fn node_slice(&self) -> &[NodeId]
Get the node column as a slice
sourcepub fn node_slice_raw(&self) -> &[tsk_id_t]
pub fn node_slice_raw(&self) -> &[tsk_id_t]
Get the node column as a slice
sourcepub fn site_slice(&self) -> &[SiteId]
pub fn site_slice(&self) -> &[SiteId]
Get the site column as a slice
sourcepub fn site_slice_raw(&self) -> &[tsk_id_t]
pub fn site_slice_raw(&self) -> &[tsk_id_t]
Get the site column as a slice
sourcepub fn time_slice(&self) -> &[Time]
pub fn time_slice(&self) -> &[Time]
Get the time column as a slice
sourcepub fn time_slice_raw(&self) -> &[f64]
pub fn time_slice_raw(&self) -> &[f64]
Get the time column as a slice
sourcepub fn parent_slice(&self) -> &[MutationId]
pub fn parent_slice(&self) -> &[MutationId]
Get the parent column as a slice
sourcepub fn parent_slice_raw(&self) -> &[tsk_id_t]
pub fn parent_slice_raw(&self) -> &[tsk_id_t]
Get the parent column as a slice