pcadapt: Principal Component Analysis for outlier detection

Description Usage Arguments Details Value

View source: R/pcadapt.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
pcadapt(input, K = 2, method = "mahalanobis", min.maf = 0.05,
  ploidy = 2, LD.clumping = NULL, pca.only = FALSE)

## S3 method for class 'pcadapt_matrix'
pcadapt(input, K = 2, method = c("mahalanobis",
  "componentwise"), min.maf = 0.05, ploidy = 2, LD.clumping = NULL,
  pca.only = FALSE)

## S3 method for class 'pcadapt_bed'
pcadapt(input, K = 2, method = c("mahalanobis",
  "componentwise"), min.maf = 0.05, ploidy = 2, LD.clumping = NULL,
  pca.only = FALSE)

## S3 method for class 'pcadapt_pool'
pcadapt(input, K = (nrow(input) - 1),
  method = "mahalanobis", min.maf = 0.05, ploidy = NULL,
  LD.clumping = NULL, pca.only = FALSE)

Arguments

input

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

K

an integer specifying the number of principal components to retain.

method

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

min.maf

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

ploidy

Number of trials, parameter of the binomial distribution. Default is 2, which corresponds to diploidy, such as for the human genome.

LD.clumping

Default is NULL and doesn't use any SNP thinning. If you want to use SNP thinning, provide a named list with parameters size and thr which corresponds respectively to the window radius and the squared correlation threshold. A good default value would be list(size = 200, thr = 0.1).

pca.only

a logical value indicating whether PCA results should be returned (before computing any statistic).

Details

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. Deprecated in version 4.0.0.

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 using method="mahalanobis", 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.

Value

The returned value x is an object of class pcadapt.


pcadapt documentation built on April 14, 2018, 1:03 a.m.