Struct tskit::Tree [−][src]
pub struct Tree { /* fields omitted */ }
A Tree.
Wrapper around tsk_tree_t
.
Implementations
impl Tree
[src]
impl Tree
[src]pub fn parent_array(&self) -> WrappedTskArray<tsk_id_t>
[src]
pub fn samples_array(&self) -> Result<WrappedTskArray<tsk_id_t>, TskitError>
[src]
pub fn next_sample_array(&self) -> Result<WrappedTskArray<tsk_id_t>, TskitError>
[src]
pub fn left_sample_array(&self) -> Result<WrappedTskArray<tsk_id_t>, TskitError>
[src]
pub fn right_sample_array(
&self
) -> Result<WrappedTskArray<tsk_id_t>, TskitError>
[src]
&self
) -> Result<WrappedTskArray<tsk_id_t>, TskitError>
pub fn left_sib_array(&self) -> WrappedTskArray<tsk_id_t>
[src]
pub fn right_sib_array(&self) -> WrappedTskArray<tsk_id_t>
[src]
pub fn left_child_array(&self) -> WrappedTskArray<tsk_id_t>
[src]
pub fn right_child_array(&self) -> WrappedTskArray<tsk_id_t>
[src]
pub fn interval(&self) -> (f64, f64)
[src]
Return the [left, right)
coordinates of the tree.
pub fn span(&self) -> f64
[src]
Return the length of the genome for which this tree is the ancestry.
pub fn parent(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>
[src]
pub fn left_child(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>
[src]
pub fn right_child(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>
[src]
pub fn left_sib(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>
[src]
pub fn right_sib(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>
[src]
pub fn samples_to_vec(&self) -> Vec<tsk_id_t>
[src]
Obtain the list of samples for the current tree/tree sequence as a vector.
pub fn path_to_root(
&self,
u: tsk_id_t
) -> Result<Box<dyn NodeIterator>, TskitError>
[src]
&self,
u: tsk_id_t
) -> Result<Box<dyn NodeIterator>, TskitError>
Return a NodeIterator
from the node u
to the root of the tree.
Errors
TskitError::IndexError
if u
is out of range.
pub fn children(&self, u: tsk_id_t) -> Result<Box<dyn NodeIterator>, TskitError>
[src]
Return a NodeIterator
over the children of node u
.
Errors
TskitError::IndexError
if u
is out of range.
pub fn samples(&self, u: tsk_id_t) -> Result<Box<dyn NodeIterator>, TskitError>
[src]
Return a NodeIterator
over the sample nodes descending from node u
.
Note
If u
is itself a sample, then it is included in the values returned.
Errors
TskitError::IndexError
if u
is out of range.
TskitError::NotTrackingSamples
if TreeFlags::SAMPLE_LISTS
was not used
to initialize self
.
pub fn roots(&self) -> Box<dyn NodeIterator>
[src]
Return a NodeIterator
over the roots of the tree.
Note
For a tree with multiple roots, the iteration starts at the left root.
pub fn roots_to_vec(&self) -> Vec<tsk_id_t>
[src]
Return all roots as a vector.
pub fn traverse_nodes(&self, order: NodeTraversalOrder) -> Box<dyn NodeIterator>
[src]
Return a NodeIterator
over all nodes in the tree.
Parameters
order
: A value fromNodeTraversalOrder
specifying the iteration order.
pub fn node_table<'a>(&'a self) -> NodeTable<'a>
[src]
Return the crate::NodeTable
for this current tree
(and the tree sequence from which it came).
This is a convenience function for accessing node times, etc..
pub fn total_branch_length(&self, by_span: bool) -> Result<f64, TskitError>
[src]
Calculate the total length of the tree via a preorder traversal.
Parameters
by_span
: iftrue
, multiply the return value byTree::span
.
Errors
TskitError
may be returned via Tree::traverse_nodes
.
pub fn num_tracked_samples(&self, u: tsk_id_t) -> Result<u64, TskitError>
[src]
pub fn kc_distance(&self, other: &Tree, lambda: f64) -> Result<f64, TskitError>
[src]
Calculate the average Kendall-Colijn (K-C
) distance between
pairs of trees whose intervals overlap.
Note
Parameters
lambda
specifies the relative weight of topology and branch length. Iflambda
is 0, we only consider topology. Iflambda
is 1, we only consider branch lengths.
Trait Implementations
impl DoubleEndedStreamingIterator for Tree
[src]
impl DoubleEndedStreamingIterator for Tree
[src]impl StreamingIterator for Tree
[src]
impl StreamingIterator for Tree
[src]type Item = Tree
The type of the elements being iterated over.
fn advance(&mut self)
[src]
fn get(&self) -> Option<&Tree>
[src]
pub fn next(&mut self) -> Option<&Self::Item>
[src]
pub fn size_hint(&self) -> (usize, Option<usize>)
[src]
pub fn all<F>(&mut self, f: F) -> bool where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn any<F>(&mut self, f: F) -> bool where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn by_ref(&mut self) -> &mut Self
[src]
pub fn chain<I>(self, other: I) -> Chain<Self, I> where
I: StreamingIterator<Item = Self::Item>,
[src]
I: StreamingIterator<Item = Self::Item>,
pub fn cloned(self) -> Cloned<Self> where
Self::Item: Clone,
[src]
Self::Item: Clone,
pub fn count(self) -> usize
[src]
pub fn filter<F>(self, f: F) -> Filter<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F> where
F: FnMut(&Self::Item) -> Option<B>,
[src]
F: FnMut(&Self::Item) -> Option<B>,
pub fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F> where
F: FnMut(&Self::Item) -> J,
J: StreamingIterator,
[src]
F: FnMut(&Self::Item) -> J,
J: StreamingIterator,
pub fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F> where
F: FnMut(&Self::Item) -> Option<B>,
[src]
F: FnMut(&Self::Item) -> Option<B>,
pub fn find<F>(&mut self, f: F) -> Option<&Self::Item> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn fuse(self) -> Fuse<Self>
[src]
pub fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item),
[src]
F: FnMut(&Self::Item),
pub fn map<B, F>(self, f: F) -> Map<Self, B, F> where
F: FnMut(&Self::Item) -> B,
[src]
F: FnMut(&Self::Item) -> B,
pub fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F> where
F: FnMut(&Self::Item) -> B,
[src]
F: FnMut(&Self::Item) -> B,
pub fn map_ref<B, F>(self, f: F) -> MapRef<Self, F> where
F: Fn(&Self::Item) -> &B,
B: ?Sized,
[src]
F: Fn(&Self::Item) -> &B,
B: ?Sized,
pub fn nth(&mut self, n: usize) -> Option<&Self::Item>
[src]
pub fn position<F>(&mut self, f: F) -> Option<usize> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn skip(self, n: usize) -> Skip<Self>
[src]
pub fn skip_while<F>(self, f: F) -> SkipWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn take(self, n: usize) -> Take<Self>
[src]
pub fn take_while<F>(self, f: F) -> TakeWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn rev(self) -> Rev<Self> where
Self: DoubleEndedStreamingIterator,
[src]
Self: DoubleEndedStreamingIterator,
pub fn fold<B, F>(self, init: B, f: F) -> B where
F: FnMut(B, &Self::Item) -> B,
[src]
F: FnMut(B, &Self::Item) -> B,
pub fn for_each<F>(self, f: F) where
F: FnMut(&Self::Item),
[src]
F: FnMut(&Self::Item),
impl TskitTypeAccess<tsk_tree_t> for Tree
[src]
impl TskitTypeAccess<tsk_tree_t> for Tree
[src]fn as_ptr(&self) -> *const tsk_tree_t
[src]
fn as_mut_ptr(&mut self) -> *mut tsk_tree_t
[src]
Auto Trait Implementations
impl RefUnwindSafe for Tree
impl RefUnwindSafe for Tree
impl UnwindSafe for Tree
impl UnwindSafe for Tree