Skip to contents

Extract genotype table from the tree sequence

Usage

ts_genotypes(ts)

Arguments

ts

Tree sequence object of the class slendr_ts

Value

Data frame object of the class tibble containing genotypes of simulated individuals in columns

Examples

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

init_env()
#> The interface to all required Python modules has been activated.

# 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"))

# load the tree-sequence object from disk
ts <- ts_load(slendr_ts, model, simplify = TRUE, mutate = TRUE,
              mutation_rate = 1e-8, random_seed = 42)

# extract the genotype matrix (this could take  a long time consume lots
# of memory!)
gts <- ts_genotypes(ts)
#> 2 multiallelic sites (0.092% out of 2184 total) detected and removed