parallel
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, parallel = require("parallel"),
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.parallel
to be installed
(see details); this option cannot be used alongside useCparallel
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
)parallel
allows for parallelizing some computations on
multiple cores, which can decrease drastically computational time. Lastly, note that using compiled C code (useC=TRUE
)is an
alternative for speeding up computations, but cannot be used together
with the parallel 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