pcadapt: Principal Component Analysis for outlier detection

Description Usage Arguments Details Value

View source: R/pcadapt.R


pcadapt performs principal component analysis and computes p-values to test for outliers. The test for outliers is based on the correlations between genetic variation and the first K principal components. pcadapt also handles Pool-seq data for which the statistical analysis is performed on the genetic markers frequencies. Returns an object of class pcadapt.


pcadapt(input, K = 5, method = "mahalanobis", data.type = "genotype",
  min.maf = 0.05, ploidy = 2, output.filename = "pcadapt_output",
  clean.files = TRUE, transpose, cover.matrix = NULL)



a character string specifying the name of the file to be processed with pcadapt.


an integer specifying the number of principal components to retain.


a character string specifying the method to be used to compute the p-values. Three statistics are currently available, "mahalanobis", "communality" and "componentwise".


a character string specifying the type of data being read, either a genotype matrix (data.type="genotype"), or a matrix of allele frequencies (data.type="pool").


a value between 0 and 0.45 specifying the threshold of minor allele frequencies above which p-values are computed.


an integer specifying the ploidy of the individuals.


a character string specifying the names of the files created by pcadapt.


a logical value indicating whether the auxiliary files should be deleted or not.


deprecated argument.


a matrix specifying the average coverage per genetic marker and per population.


First, a principal component analysis is performed on the scaled and centered genotype data. To account for missing data, the correlation matrix between individuals is computed using only the markers available for each pair of individuals. Depending on the specified method, different test statistics can be used.

mahalanobis (default): the robust Mahalanobis distance is computed for each genetic marker using a robust estimate of both mean and covariance matrix between the K vectors of z-scores.

communality: the communality statistic measures the proportion of variance explained by the first K PCs.

componentwise: returns a matrix of z-scores.

To compute p-values, test statistics (stat) are divided by a genomic inflation factor (gif) when method="mahalanobis". When method="communality", the test statistic is first multiplied by K and divided by the percentage of variance explained by the first K PCs before accounting for genomic inflation factor. When using method="mahalanobis" or "communality", the scaled statistics (chi2_stat) should follow a chi-squared distribution with K degrees of freedom. When using method="componentwise", the z-scores should follow a chi-squared distribution with 1 degree of freedom. For Pool-seq data, pcadapt provides p-values based on the Mahalanobis distance for each SNP.


The returned value x is an object of class pcadapt.

pcadapt documentation built on May 30, 2017, 7:10 a.m.