pcoa_freqs | R Documentation |
Takes a long-format data table of allele frequencies, calculates pairwise FST,
and conducts a PCoA of these pairwise FST values using R's ape::pcoa()
function (be sure to cite Paradis & Schliep 2019).
pcoa_freqs(
dat,
popCol = "POP",
locusCol = "LOCUS",
freqCol = "FREQ",
indsCol = "INDS"
)
dat |
Data table: A long-format data table containing allele frequency estimates for biallelic SNP loci. Requires the following columns:
|
popCol |
Character: The column name with the population information.
Default is |
locusCol |
Character: The column name with the locus information.
Default is |
freqCol |
Character: The column name with the allele freuqency information.
Default is |
indsCol |
Character: The column name with the number of individuals
contributing to the allele freuqency estimate. Default is |
Returns a list-like object of class eigen
, as per ape::pcoa
,
with an additional long-format data table of genome-wide pairiwse FST
estimates in an index $fst
.
Paradis & Schliep (2019) Bioinformatics. DOI: 10.1093/bioinformatics/bty633
library(genomalicious)
data(data_PoolFreqs)
data(data_PoolInfo)
# Note columns in data_PoolFreqs
colnames(data_PoolFreqs)
# We need to add in the number of diploid individuals, $INDS
newFreqData <- left_join(data_PoolFreqs, data_PoolInfo)
head(newFreqData)
# Fit the PCoA
PCOA <-pcoa_freqs(newFreqData)
# Object class
class(PCOA)
# Axes
PCOA$vectors
# Eigenvalues
PCOA$values
# Pairwise FST in long-format data table
PCOA$fst
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.