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

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



Compiled slendr_model model object


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


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


Should the tree sequence be recapitated?


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


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 passed to pyslim's recapitate method


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


pyslim.SlimTreeSequence object of the class slendr_ts


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:

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