pcadapt
performs principal component analysis and compute P-values to test for selection as indicated
by significant correlations between genetic variation and principal components. pcadapt
also allows the user to read PCAdapt outputs
for further analysis in R
. Returns an object of class pcadapt
.pcadapt(data = NULL, file = NULL, K, communality_test = FALSE,
ploidy = 2, minmaf = 0.05)
FALSE
.0
and 0.5
specifying the threshold under which the frequencies are considered minor allele frequencies.x
is an object of class pcadapt
.
The different fields can be viewed using the dollar sign (example: x$neutral_sdev
).
The returned value contains the following components:K
first principal components.K
PCs.K
columns. Gives the proportions removed from the loadings distributions in order to estimate the standard deviation of the neutral markers.K
columns. Each column of q
represents the kurtosis evaluated on the distribution of the loadings for each cut-off provided by p
.K
corresponding to the proportions of markers to remove from the loading distributions to match the kurtosis expected for a Gaussian distribution.eigen
function. The p-values are then computed based on the matrix of loadings. The loadings of the neutral markers
are assumed to follow a centered Gaussian distribution. The standard deviation of the Gaussian distribution
is estimated after removing a proportion of genetic markers with the largest loadings (in absolute values).
The removal proportion is the smallest percentage such that the kurtosis of the truncated distribution of the loadings matches the kurtosis
of a Gaussian distribution, which is equal to 3. The standard deviation of the loadings is finaly estimated using the maximum likelihood of a truncated Gaussian distribution.x <- read4pcadapt("geno3pops",option="example")
x <- floor(abs(x))
y <- pcadapt(x,K=10)
## Screeplot
plot(y,option="screeplot")
## PCA
plot(y,option="scores")
## Neutral SNPs distribution
plot(y,option="neutral",K=1)
## Manhattan Plot
plot(y,option="manhattan",K=1)
## Q-Q Plot
plot(y,option="qqplot",K=1)
Run the code above in your browser using DataLab