pca.genotypes: Perform PCA on a 'genotypes' object

Description Usage Arguments Details Value See Also

Description

Performs principal components analysis (PCA) on either (numerically-coded) genotypes or on the underliny 2D hybridization-intensity matrices.

Usage

1
2
3
## S3 method for class 'genotypes'
pca(x, extras = NULL, what = c("genotypes", "intensity",
  "norm"), K = 3, fast = FALSE, weights = NULL, ...)

Arguments

x

an object of class genotypes

extras

a second dataset of class genotypes, to be projected onto PCs computed from the first. NB: this function *does not* verify that the underlying features (ie. markers) match.

what

"genotypes" to do PCA on genotypes (coded 0/1/2); "intensity" to do PCA on underlying 2D intensities. The latter triggers an error if intensity matrices are absent.

K

how many PCs to return.

fast

if TRUE, use corpcor::fast.svd() to speed up calculations

weights

a vector of weights by which to pre-multiply the genotypes matrix

...

other parameters for call to prcomp, such as center and scale (both TRUE by default)

Details

Uses base-R's prcomp under the hood (unless fast = TRUE). By default, columns are centered and scaled; not doing so will likely produce a strange result. When doing PCA on genotypes, missing values are replaced with the column mean, which in many circumstances can be interpreted as the minor-allele frequency. (This is very similar to the behavior of PLINK.) When doing PCA on intensities, missing values are set to zero – but even no-call genotypes have nonmissing intensities on Illumina arrays, so this is unlikely to have any effect in practice.

Value

a dataframe with as many rows as samples, in which the first columns are sample IDs and any associated metadata (as returned by samples(x)), followed by the first K PCs. Scaled eigenvalues (ie. percent of variance explained) are provided as attr(,"explained").

See Also

pca.plink() for using PLINK's (much faster and more powerful) implementation


andrewparkermorgan/argyle documentation built on May 10, 2019, 11:08 a.m.