multicore package is available,
glPca uses multiple-core ressources for more efficient
computations. glPca returns lists with the class glPca
(see 'value').
Other functions are defined for objects of this class:
- print: prints the content of a glPca object.
- scatter: produces scatterplots of principal components,
with a screeplot of eigenvalues as inset.
- loadingplot: plots the loadings of the analysis for one given
axis, using an adapted version of the generic function loadingplot.glPca(x, center = TRUE, scale = FALSE, nf = NULL, loadings = TRUE,
alleleAsUnit = FALSE, useC = TRUE, multicore = require("multicore"),
n.cores = NULL, returnDotProd=FALSE, matDotProd=NULL)## S3 method for class 'glPca':
print(x, \dots)
## S3 method for class 'glPca':
scatter(x, xax = 1, yax = 2, posi = "bottomleft", bg = "white",
ratio = 0.3, label = rownames(x$scores), clabel = 1, xlim = NULL,
ylim = NULL, grid = TRUE, addaxes = TRUE, origin = c(0, 0),
include.origin = TRUE, sub = "", csub = 1, possub = "bottomleft",
cgrid = 1, pixmap = NULL, contour = NULL, area = NULL, ...)
## S3 method for class 'glPca':
loadingplot(x, at=NULL, threshold=NULL, axis=1,
fac=NULL, byfac=FALSE, lab=rownames(x$loadings), cex.lab=0.7, cex.fac=1,
lab.jitter=0, main="Loading plot", xlab="SNP positions",
ylab="Contributions", srt = 90, adj = c(0, 0.5), ...)
glPca, a print, scatter, and loadingplot, a glPca
object.multicore to be installed
(see details); this option cannot be used alongside usemulticore is TRUE, the number of cores to be
used in the computations; if NULL, then the maximum number of cores
available on the computer is used.integers specifying which principal components
should be shown in x and y axes.glPca results. See add.scatter documentation in the
ade4 package for more details.s.class; see ?s.label for more informationfac.glPca is a list with the following
components:scatter return the matched call.
- loadingplot returns information about the most contributing
SNPs (see loadingplot.default)multicore allows for parallelizing some computations on
multiple cores, which decreases drastically computational time. To use this functionality, you need to have the last version of the
multicore package installed. To install it, type:
install.packages("multicore",,"http://rforge.net/",type="source")
DO NOT use the version on CRAN, which is slightly outdated.
Lastly, note that using compiled C code (useC=TRUE)is an
alternative for speeding up computations, but cannot be used together
with the multicore option.
genlight : class of object for storing massive binary
SNP data. - glSim: a simple simulator for
- glPlot: plotting
- dapc: Discriminant Analysis of Principal Components.
## simulate a toy dataset
x <- glSim(50,4e3, 50, ploidy=2)
x
plot(x)
## perform PCA
pca1 <- glPca(x, nf=2)
## plot eigenvalues
barplot(pca1$eig, main="eigenvalues", col=heat.colors(length(pca1$eig)))
## basic plot
scatter(pca1, ratio=.2)
## plot showing groups
s.class(pca1$scores, pop(x), col=colors()[c(131,134)])
add.scatter.eig(pca1$eig,2,1,2)Run the code above in your browser using DataLab