Struct tskit::bindings::tsk_tree_t

source ·
#[repr(C)]
pub struct tsk_tree_t {
Show 26 fields pub tree_sequence: *const tsk_treeseq_t, pub virtual_root: tsk_id_t, pub parent: *mut tsk_id_t, pub left_child: *mut tsk_id_t, pub right_child: *mut tsk_id_t, pub left_sib: *mut tsk_id_t, pub right_sib: *mut tsk_id_t, pub num_children: *mut tsk_id_t, pub edge: *mut tsk_id_t, pub num_edges: tsk_size_t, pub interval: tsk_tree_t__bindgen_ty_1, pub index: tsk_id_t, pub num_nodes: tsk_size_t, pub options: tsk_flags_t, pub root_threshold: tsk_size_t, pub samples: *const tsk_id_t, pub num_samples: *mut tsk_size_t, pub num_tracked_samples: *mut tsk_size_t, pub left_sample: *mut tsk_id_t, pub right_sample: *mut tsk_id_t, pub next_sample: *mut tsk_id_t, pub sites: *const tsk_site_t, pub sites_length: tsk_size_t, pub direction: c_int, pub left_index: tsk_id_t, pub right_index: tsk_id_t,
}
Expand description

@brief A single tree in a tree sequence.

@rst A tsk_tree_t object has two basic functions:

  1. Represent the state of a single tree in a tree sequence;
  2. Provide methods to transform this state into different trees in the sequence.

The state of a single tree in the tree sequence is represented using the quintuply linked encoding: please see the :ref:data model <sec_data_model_tree_structure> section for details on how this works. The left-to-right ordering of nodes in this encoding is arbitrary, and may change depending on the order in which trees are accessed within the sequence. Please see the :ref:sec_c_api_examples_tree_traversals examples for recommended usage.

On initialisation, a tree is in the :ref:null state<sec_c_api_trees_null> and we must call one of the :ref:seeking<sec_c_api_trees_seeking> methods to make the state of the tree object correspond to a particular tree in the sequence. Please see the :ref:sec_c_api_examples_tree_iteration examples for recommended usage.

@endrst

Fields§

§tree_sequence: *const tsk_treeseq_t

@brief The parent tree sequence.

§virtual_root: tsk_id_t

@brief The ID of the “virtual root” whose children are the roots of the tree.

§parent: *mut tsk_id_t

@brief The parent of node u is parent[u]. Equal to TSK_NULL if node u is a root or is not a node in the current tree.

§left_child: *mut tsk_id_t

@brief The leftmost child of node u is left_child[u]. Equal to TSK_NULL if node u is a leaf or is not a node in the current tree.

§right_child: *mut tsk_id_t

@brief The rightmost child of node u is right_child[u]. Equal to TSK_NULL if node u is a leaf or is not a node in the current tree.

§left_sib: *mut tsk_id_t

@brief The sibling to the left of node u is left_sib[u]. Equal to TSK_NULL if node u has no siblings to its left.

§right_sib: *mut tsk_id_t

@brief The sibling to the right of node u is right_sib[u]. Equal to TSK_NULL if node u has no siblings to its right.

§num_children: *mut tsk_id_t

@brief The number of children of node u is num_children[u].

§edge: *mut tsk_id_t

@brief Array of edge ids where edge[u] is the edge that encodes the relationship between the child node u and its parent. Equal to TSK_NULL if node u is a root, virtual root or is not a node in the current tree.

§num_edges: tsk_size_t

@brief The total number of edges defining the topology of this tree. This is equal to the number of tree sequence edges that intersect with the tree’s genomic interval.

§interval: tsk_tree_t__bindgen_ty_1§index: tsk_id_t

@brief The index of this tree in the tree sequence.

@rst This attribute provides the zero-based index of the tree represented by the current state of the struct within the parent tree sequence. For example, immediately after we call tsk_tree_first(&tree), tree.index will be zero, and after we call tsk_tree_last(&tree), tree.index will be the number of trees - 1 (see :c:func:tsk_treeseq_get_num_trees) When the tree is in the null state (immediately after initialisation, or after, e.g., calling :c:func:tsk_tree_prev on the first tree) the value of the index is -1. @endrst

§num_nodes: tsk_size_t§options: tsk_flags_t§root_threshold: tsk_size_t§samples: *const tsk_id_t§num_samples: *mut tsk_size_t§num_tracked_samples: *mut tsk_size_t§left_sample: *mut tsk_id_t§right_sample: *mut tsk_id_t§next_sample: *mut tsk_id_t§sites: *const tsk_site_t§sites_length: tsk_size_t§direction: c_int§left_index: tsk_id_t§right_index: tsk_id_t

Trait Implementations§

source§

impl Clone for tsk_tree_t

source§

fn clone(&self) -> tsk_tree_t

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for tsk_tree_t

source§

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

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

impl Copy for tsk_tree_t

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Free for T

source§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.