Calculate diversity in given sets of individuals

ts_diversity(
  ts,
  sample_sets,
  mode = c("site", "branch", "node"),
  windows = NULL,
  span_normalise = TRUE
)

Arguments

ts

pyslim.SlimTreeSequence object

sample_sets

A list (optionally a named list) of character vectors with individual names (one vector per set)

mode

The mode for the calculation ("sites" or "branch")

windows

Coordinates of breakpoints between windows. The first coordinate (0) and the last coordinate (equal to ts$sequence_length) are added automatically)

span_normalise

Divide the result by the span of the window? Default TRUE, see the tskit documentation for more detail.

Value

For each set of individuals either a single diversity value or a vector of diversity values (one for each window)