ts_extend: Extend the span of sequences covered by ancestral nodes...

View source: R/tree-sequences.R

ts_extendR Documentation

Extend the span of sequences covered by ancestral nodes (EXPERIMENTAL)

Description

Run the "extend haplotypes" algorithm to extend the span of sequence covered by ancestral nodes, as implemented by the tskit method TreeSequence.extend_haplotypes.

Usage

ts_extend(ts, iterations = 10)

Arguments

ts

Tree sequence object

iterations

Maximum number of iterations over the tree sequence (default is 10)

Details

For more details about this functionality, please read the following resources:

  1. Paper by Fritze et al. 2025 (\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/genetics/iyaf198")})

  2. Official tskit documentation at https://tskit.dev/tskit/docs/stable/python-api.html#tskit.TreeSequence.extend_haplotypes

Note that this function has been currently tested exclusively on tree sequences simulated by slendr's msprime() simulation engine.

Value

Tree-sequence object of the class slendr_ts

Examples


init_env()

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

ts <- ts_read(slendr_ts, model)
ts_ext <- ts_extend(ts, iterations = 10)

ts_ext

slendr documentation built on June 26, 2026, 5:11 p.m.