outflank_input_freqs: Convert a (long_) allele frequency data table to 'OutFLANK'...

View source: R/outflank_input_freqs.R

outflank_input_freqsR Documentation

Convert a (long_) allele frequency data table to OutFLANK input

Description

Converts a long format data table of allele frequency information into a data frame fit for analysis by OutFLANK (Whitlock & Lotterhos 2015).

Usage

outflank_input_freqs(
  dat,
  popCol = "POP",
  locusCol = "LOCUS",
  freqCol = "FREQ",
  indsCol = "INDS",
  HoCol = NULL
)

Arguments

dat

Data table: The biallelic allele frequency data. Requires the following columns:

  1. The population ID.

  2. The locus ID.

  3. The allele frequency of the Reference allele.

  4. The number of individuals (sample size) used to estimate allele frequency.

popCol

Character: The column name with the sampled individual information. Default = 'POP'.

locusCol

Character: The column name with the locus information. Default = 'LOCUS'.

freqCol

Character: The column name with the allele frequency information. Default = 'FREQ'.

indsCol

Character: The column name with the number of individuals (sample size) used to estimate the allele frequency. Default = 'INDS'.

HoCol

Character: An optional argument. The column name with the observed number of heterozygotes. Affects estimation of FST, see details. Default = NULL.

Details

FST is estimated using modified versions of the OutFLANK functions WC_FST_FiniteSample_Diploids_2Alleles_NoCorr() and WC_FST_FiniteSample_Diploids_2Alleles(). The observed heterozygosity, Ho, is required to calculate the variance components. However, allele frequencies alone do not carry this information. Users can specify a column containing the Ho (argument HoCol) if this is known, otherwise, a naive assumption that Ho = He (the expected heterozygosity) is made.

Value

A data frame in the required format for analysis by OutFLANK.

References

Whitlock & Lotterhos (2015) Reliable detection of loci responsible for local adaptation: Inference of a null model through trimming the distribution of FST. The American Naturalist 186.

Examples

library(genomalicious)
data(data_PoolFreqs)

data_PoolFreqs

ofDF <- outflank_input_freqs(
   dat=data_PoolFreqs,
   popCol='POOL',
   locusCol='LOCUS',
   freqCol='FREQ',
   indsCol='INDS')


j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.