This function loads a tree sequence file simulated from a given slendr model. Optionally, the tree sequence can be recapitated and simplified.

ts_load(
  model,
  output_dir = model$path,
  output_prefix = "output",
  recapitate = FALSE,
  simplify = FALSE,
  spatial = TRUE,
  recomb_rate = NULL,
  Ne = NULL,
  random_seed = NULL,
  simplify_to = NULL
)

Arguments

model

Compiled slendr_model model object

output_dir

A directory where to look for simulation outputs (by default, all output files are in a model directory)

output_prefix

A common prefix of output files (by default, all files will share a prefix "output")

recapitate

Should the tree sequence be recapitated?

simplify

Should the tree sequence be simplified down to only remembered (i.e. "sampled", in slendr parlance) individuals?

spatial

Should spatial information encoded in the tree sequence data be converted to spatial R datastructures? If FALSE, pixel-based raster-dimensions will not be converted to the coordinate reference system implied by the model. If TRUE (default), reprojection of coordinates will be performed. If the model was non-spatial, the value of this parameter is disregarded.

recomb_rate, Ne

Arguments passed to ts_recapitate

random_seed

Random seed passed to pyslim's recapitate method

simplify_to

A character vector of individual names. If NULL, all remembered individuals will be retained. Only used when simplify = TRUE.

Value

pyslim.SlimTreeSequence object of the class slendr_ts

Details

The loading, recapitation and simplification is performed using the Python module pyslim which serves as a link between tree sequences generated by SLiM and the tskit module for manipulation of tree sequence data. All of these steps have been modelled after the official pyslim tutorial and documentation available at: https://pyslim.readthedocs.io/en/latest/tutorial.html.

The recapitation and simplification steps can also be performed individually using the functions ts_recapitate and ts_simplify.

See also

ts_data for extracting useful information about individuals, nodes, coalescent times and geospatial locations of nodes on a map