ts_genotypes: Extract genotype table from the tree sequence

View source: R/tree-sequences.R

ts_genotypesR Documentation

Extract genotype table from the tree sequence

Description

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


init_env()

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

# load the tree-sequence object from disk, recapitate it, simplify it, and mutate it
ts <- ts_read(slendr_ts, model) %>%
  ts_recapitate(Ne = 10000, recombination_rate = 1e-8) %>%
  ts_simplify() %>%
  ts_mutate(mutation_rate = 1e-8)

# extract the genotype matrix (this could take  a long time consume lots
# of memory!)
gts <- ts_genotypes(ts)

bodkan/slendr documentation built on Dec. 19, 2024, 11:41 p.m.