Recapitate the tree sequence

ts_recapitate(
  ts,
  recombination_rate,
  Ne,
  migration_matrix = NULL,
  random_seed = NULL
)

Arguments

ts

Tree sequence object loaded by ts_load

recombination_rate

A constant value of the recombination rate

Ne

Effective population size during the recapitation process

migration_matrix

Migration matrix used for coalescence of ancient lineages (passed to ts_recapitate)

random_seed

Random seed passed to pyslim's recapitate method

Value

Tree-sequence object of the class slendr_ts, which serves as an interface point for the Python module tskit using slendr functions with the ts_ prefix.

See also

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

Examples

check_dependencies(python = TRUE) # make sure dependencies are present

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

ts <-
  ts_load(slendr_ts, model) %>%
  ts_recapitate(recombination_rate = 1e-8, Ne = 10000, random_seed = 42)

ts
#> ╔═══════════════════════════╗
#> ║TreeSequence               ║
#> ╠═══════════════╤═══════════╣
#> ║Trees          │         17║
#> ╟───────────────┼───────────╢
#> ║Sequence Length│     500000║
#> ╟───────────────┼───────────╢
#> ║Time Units     │generations║
#> ╟───────────────┼───────────╢
#> ║Sample Nodes   │         26║
#> ╟───────────────┼───────────╢
#> ║Total Size     │   55.2 KiB║
#> ╚═══════════════╧═══════════╝
#> ╔═══════════╤════╤════════╤════════════╗
#> ║Table      │Rows│Size    │Has Metadata║
#> ╠═══════════╪════╪════════╪════════════╣
#> ║Edges      │ 105│ 3.3 KiB│          No║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Individuals│  50│ 6.7 KiB│         Yes║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Migrations │   0│ 8 Bytes│          No║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Mutations  │   0│ 1.2 KiB│          No║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Nodes      │  63│ 3.0 KiB│         Yes║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Populations│   4│ 2.6 KiB│         Yes║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Provenances│   3│35.4 KiB│          No║
#> ╟───────────┼────┼────────┼────────────╢
#> ║Sites      │   0│16 Bytes│          No║
#> ╚═══════════╧════╧════════╧════════════╝
#>