R/tree-sequences.R
ts_simplify.Rd
This function is a convenience wrapper around the simplify
method
implemented in tskit, designed to work on tree sequence data simulated by
SLiM using the slendr R package.
ts_simplify(ts, simplify_to = NULL, keep_input_roots = FALSE)
Tree sequence object of the class slendr_ts
A character vector of individual names. If NULL, all
explicitly remembered individuals (i.e. those specified via the
schedule_sampling
function will be left in the tree sequence
after the simplification.
Should the history ancestral to the MRCA of all
samples be retained in the tree sequence? Default is FALSE
.
Tree sequence object of the class slendr_ts
The simplification process is used to remove redundant information from the tree sequence and retains only information necessary to describe the genealogical history of a set of samples.
For more information on how simplification works in pyslim and tskit, see the official documentation at https://tskit.dev/tskit/docs/stable/python-api.html#tskit.TreeSequence.simplify and https://tskit.dev/pyslim/docs/latest/tutorial.html#simplification.
A very clear description of the difference between remembering and retaining and how to use these techniques to implement historical individuals (i.e. ancient DNA samples) is in the pyslim documentation at https://tskit.dev/pyslim/docs/latest/tutorial.html#historical-individuals.
ts_nodes
for extracting useful information about
individuals, nodes, coalescent times and geospatial locations of nodes on a
map
if (FALSE) # simplify tree sequence to sampled individuals
ts_simplified <- ts_simplify(ts)
# simplify to a subset of sampled individuals
ts_small <- ts_simplify(
ts,
simplify_to = c("CH_1", "NEA_1", "NEA_2", "AFR_1",
"AFR_2", "EUR_20", "EUR_50")
)