Struct tskit::Tree[][src]

pub struct Tree { /* fields omitted */ }

A Tree.

Wrapper around tsk_tree_t.

Implementations

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]

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]

Get the parent of node u.

Errors

TskitError if u is out of range.

pub fn left_child(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>[src]

Get the left child of node u.

Errors

TskitError if u is out of range.

pub fn right_child(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>[src]

Get the right child of node u.

Errors

TskitError if u is out of range.

pub fn left_sib(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>[src]

Get the left sib of node u.

Errors

TskitError if u is out of range.

pub fn right_sib(&self, u: tsk_id_t) -> Result<tsk_id_t, TskitError>[src]

Get the right sib of node u.

Errors

TskitError::IndexError if u is out of range.

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]

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

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: if true, multiply the return value by Tree::span.

Errors

TskitError may be returned via Tree::traverse_nodes.

pub fn num_tracked_samples(&self, u: tsk_id_t) -> Result<u64, TskitError>[src]

Get the number of samples below node u.

Errors

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. If lambda is 0, we only consider topology. If lambda is 1, we only consider branch lengths.

Trait Implementations

impl DoubleEndedStreamingIterator for Tree[src]

impl Drop for Tree[src]

impl StreamingIterator for Tree[src]

type Item = Tree

The type of the elements being iterated over.

impl TskitTypeAccess<tsk_tree_t> for Tree[src]

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl !Send for Tree

impl !Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.