randomallele.pca: PCA of a pooldata or countdata object using a random allele...

View source: R/randomallele.pca.R

randomallele.pcaR Documentation

PCA of a pooldata or countdata object using a random allele approach

Description

PCA of a pooldata or countdata object using a random allele approach

Usage

randomallele.pca(
  x,
  scale = TRUE,
  return.snploadings = FALSE,
  plot.pcs = c(1, 2),
  ...
)

Arguments

x

A pooldata object containing Pool-Seq information or a countdata object containing allele count information

scale

If FALSE the random allele data matrix is not scaled (default=TRUE)

return.snploadings

If TRUE return the SNP loadings (may be large)

plot.pcs

A vector with two-elements giving the two PCs to plot. If NULL, no plotting is done.

...

graphical parameters (see plot function)

Details

PCA is performed by singular-value decomposition (SVD) of a npop (or npools) x nsnp matrix of a single randomly sampled allele (i.e. or read for pooldata object) for each SNP and for each population (inspired by Skoglund and Jakobsson, 2011, https://doi.org/10.1073/pnas.1108181108). Although this approach leads to information loss, it allows to efficiently account for unequal sample size (and read coverages for pool-seq data) and have little impact on the resulting representation when the number of SNPs is large. Note also that the implemented approach is similar to that implemented in the PCA_MDS module of the software ANGSD by Korneliussen et al. (2014) (see http://www.popgen.dk/angsd/index.php/PCA_MDS).

Value

An object of class fstats (see help(fstats) for details)

See Also

To generate pooldata object, see vcf2pooldata, popsync2pooldata,genobaypass2pooldata or genoselestim2pooldata. To generate coundata object, see genobaypass2countdata or genotreemix2countdata.

Examples

 make.example.files(writing.dir=tempdir())
 pooldata<-popsync2pooldata(sync.file=paste0(tempdir(),"/ex.sync.gz"),poolsizes=rep(50,15))
 res.pca<-randomallele.pca(pooldata)

poolfstat documentation built on Sept. 8, 2023, 5:49 p.m.