HWE_filter: A wrapper function for the hw.test function from pegas to...

Description Usage Arguments Value Examples

View source: R/HWE_filter.R

Description

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).

Usage

1
HWE_filter(GenInd.obj, perm, FDR_cut, pop_thresh, no_cores)

Arguments

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

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 ## 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)

pygmyperch/melfuR documentation built on Oct. 10, 2020, 1:23 p.m.