This function computes Tajima's D for a sliding window across each chromosome.
Arguments
- .x
a (potentially grouped)
gen_tibble
object- type
type of object to return, if using grouped method. One of "matrix", "tidy", or "list". Default is "matrix".
- window_size
The size of the window to use for the estimates.
- step_size
The step size to use for the windows.
- size_unit
Either "snp" or "bp". If "snp", the window size and step size are in number of SNPs. If "bp", the window size and step size are in base pairs.
- min_loci
The minimum number of loci required to calculate a window statistic. If the number of loci in a window is less than this, the window statistic will be NA.
- complete
Should the function be evaluated on complete windows only? If FALSE, the default, then partial computations will be allowed at the end of the chromosome.
Value
if data is not grouped, a data frame with the following columns:
chromosome
: the chromosome for the windowstart
: the starting locus of the windowend
: the ending locus of the windowtajimas_d
: the Tajima's D for the population if data are grouped, either: a data frame as above with the following columns:chromosome
: the chromosome for the windowstart
: the starting locus of the windowend
: the ending locus of the windown_loci
: the number of loci in the windowgroup
: the Tajima's D for the group for the given window (there will be as many of these columns as groups in the gen_tibble, and they will be named by the grouping levels) a tidy tibble with the following columns:chromosome
: the chromosome for the windowstart
: the starting locus of the windowend
: the ending locus of the windown_loci
: the number of loci in the windowgroup
: the name of the groupstat
: the Tajima's D for the given group at the given window or a list of data frames, one per group, with the following columns:chromosome
: the chromosome for the windowstart
: the starting locus of the windowend
: the ending locus of the windowstat
: the Tajima's D for the given windown_loci
: the number of loci in the window