HWE_filter | R Documentation |
A wrapper function for the hw.test function from pegas to filter a genind object for per locus Hardy-Weinberg equilibrium by population (i.e. remove loci out of HWE in >x% of populations at a specified FDR).
HWE_filter(GenInd.obj, perm, FDR_cut, pop_thresh, no_cores)
GenInd.obj |
a genind object |
perm |
the number of permutations for the monte carlo simulations |
FDR_cut |
the false discovery rate threshold |
pop_thresh |
the minimum number (%) of populations each locus needs to be in HWE to be retained |
no_cores |
the number of cores to use for the analysis |
FDRadjP.csv a table of FDR adjusted P values for each locus per population
OutOfHWE_SNPs.csv a table of SNPs out of HWE at the specified FDR in >pop_thresh % of populations
HWE_SNPs.csv a table of SNPs in HWE at the specified FDR in >pop_thresh populations
HWE_list a vector of SNPs in HWE suitable for input to the subset_snps function
## set directory for results to be written
setwd("path/to/working/directory")
# load data
data(rainbow.genind)
#subset rainbow.genind to 100 loci
gen100 <- rainbow.genind[ ,1:200]
# run HWE_filter to exclude loci out of HWE in >50\% of populations at a FDR of 0.1
run1 <- HWE_filter(gen100, perm=999, FDR_cut=0.1, pop_thresh=50, no_cores=6)
## use output to generate new structure file retaining the 97 loci in HWE
# load original structure file
stfile <- system.file("extdata", "Mfsub500.stru", package="melfuR")
# run subset_snps using output of HWE_filter
subset_snps(stfile, "new_structure_file", run1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.