ts_ancestors: Extract (spatio-)temporal ancestral history for given...

ts_ancestorsR Documentation

Extract (spatio-)temporal ancestral history for given nodes/individuals

Description

Extract (spatio-)temporal ancestral history for given nodes/individuals

Usage

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

Arguments

ts

Tree sequence object of the class slendr_ts

x

Either an individual name or an integer node ID

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 ancestral nodes of a given tree-sequence node all the way up to the root 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 ancestry information for a given individual
ts_ancestors(ts, "EUR_1", verbose = TRUE)

slendr documentation built on June 22, 2024, 6:56 p.m.