calc_prop_poly: Calculate the proportion of polymorphic loci.

calc_prop_polyR Documentation

Calculate the proportion of polymorphic loci.

Description

Calculates the proportion of polymorphic (genotyped) loci for any combination of SNP and sample facets. Note: per window counts of polymorphic loci can be calculated using calc_tajimas_d.

Usage

calc_prop_poly(x, facets = NULL)

Arguments

x

snpRdata object

facets

facets over which to check for polymorphic loci. Can be any combination of SNP/sample facets. See Facets_in_snpR for details.

Details

Note that per window counts of polymorphic loci can be calculated using calc_tajimas_d (contained in the num_seg column). Dividing this by the n_snps column will return the proportion of polymorphic loci in each window if that is desired!

Value

A snpRdata object with prop_poly merged into the weighted.means slot.

Author(s)

William Hemstrom

Examples

# base facet
x <- calc_prop_poly(stickSNPs)
get.snpR.stats(x, stats = "prop_poly")$weighted.means

# multiple facets
x <- calc_prop_poly(stickSNPs, c("pop", "fam", "pop.fam", 
                                 "pop.fam.chr", "chr"))
get.snpR.stats(x, c("pop", "fam", "pop.fam", "pop.fam.chr", "chr"), 
               stats = "prop_poly")$weighted.means


hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.