OutFLANK: Fst outliers with trimming

Description Usage Arguments Details Value

View source: R/OutFLANK.R

Description

Takes Fst data for a list of loci to find outliers, using a trimmed likelihood approach.

Usage

1
2
OutFLANK(FstDataFrame, LeftTrimFraction = 0.05, RightTrimFraction = 0.05,
  Hmin = 0.1, NumberOfSamples, qthreshold = 0.05)

Arguments

FstDataFrame

A data frame that includes a row for each locus, with columns as follows:

  • $LocusName: a character string that uniquely names each locus.

  • $FST: Fst calculated for this locus. (Kept here to report the unbiased Fst of the results)

  • $T1: The numerator of the estimator for Fst (necessary, with $T2, to calculate mean Fst)

  • $T2: The denominator of the estimator of Fst

  • $FSTNoCorr: Fst calculated for this locus without sample size correction. (Used to find outliers)

  • $T1NoCorr: The numerator of the estimator for Fst without sample size correction (necessary, with $T2, to calculate mean Fst)

  • $T2NoCorr: The denominator of the estimator of Fst without sample size correction

  • $He: The heterozygosity of the locus (used to screen out low heterozygosity loci that have a different distribution)

LeftTrimFraction

The proportion of loci that are trimmed from the lower end of the range of Fst before the likelihood function is applied.

RightTrimFraction

The proportion of loci that are trimmed from the upper end of the range of Fst before the likelihood funciton is applied.

Hmin

The minimum heterozygosity required before including calculations from a locus.

NumberOfSamples

The number of spatial locations included in the data set.

qthreshold

The desired false discovery rate threshold for calculating q-values.

Details

This function should take in a dataframe ("FstDataFrame") that has columns for $LocusName,$Fst,$T1,$T2,$FstNoCorr, $T1NoCorr, $T2NoCorr,$H. It should return a dataframe with those same columns but also new columns for $LowOutlierFlag, $HighOutlierFlag, and $q.

This function requires Fst's calculated without sample size correction. These can be calculated, for example, with WC_FST_FiniteSample_Haploids_2AllelesB_NoSamplingCorrection in this package.

This use of the biased FSTs is necessary for the trimming outlier approach with small samples, because the debiasing sometimes creates negative Fsts which do not fit into the chi-square distribution. This will use FST's calculated without sample size correction for outlier tests. Such FSTs will be biased upwards, but as long as the sample size is similar for all loci, the resulting measures ought to be give similar results. This use of the biased FSTs is necessary for the trimming outlier approach with small samples, because the debiasing sometimes creates negative Fsts which do not fit into the chi-square distribution.

Value

The function returns a list with seven elements:


whitlock/OutFLANK documentation built on Nov. 5, 2019, 12:09 p.m.