ts_descendants {slendr}R Documentation

Extract all descendants of a given tree-sequence node

Description

Extract all descendants of a given tree-sequence node

Usage

ts_descendants(ts, x, verbose = FALSE, complete = TRUE)

Arguments

ts

Tree sequence object of the class slendr_ts

x

An integer node ID of the ancestral node

verbose

Report on the progress of ancestry path generation?

complete

Does every individual in the tree sequence need to have complete metadata recorded? If TRUE, only individuals/nodes with complete metadata will be included in the reconstruction of ancestral relationships. For instance, nodes added during the coalescent recapitation phase will not be included because they don't have spatial information associated with them.

Value

A table of descendant nodes of a given tree-sequence node all the way down to the leaves of the tree sequence

Examples


init_env()

# load an example model with an already simulated tree sequence
slendr_ts <- system.file("extdata/models/introgression_slim.trees", package = "slendr")
model <- read_model(path = system.file("extdata/models/introgression", package = "slendr"))

# load the tree-sequence object from disk
ts <- ts_load(slendr_ts, model)

# find the complete descendancy information for a given individual
ts_descendants(ts, x = 62, verbose = TRUE)

[Package slendr version 0.9.1 Index]