[adegenet-commits] r779 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 25 19:07:17 CET 2011
Author: jombart
Date: 2011-01-25 19:07:17 +0100 (Tue, 25 Jan 2011)
New Revision: 779
Added:
pkg/man/glPca.Rd
Modified:
pkg/R/glFunctions.R
pkg/man/genlight.Rd
pkg/man/loadingplot.Rd
Log:
lots of documentation
Modified: pkg/R/glFunctions.R
===================================================================
--- pkg/R/glFunctions.R 2011-01-25 16:12:39 UTC (rev 778)
+++ pkg/R/glFunctions.R 2011-01-25 18:07:17 UTC (rev 779)
@@ -387,7 +387,7 @@
#####################
loadingplot.glPca <- function(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 position", ylab="Contribution", srt=90, adj=c(0,0.5), ... ){
+ main="Loading plot", xlab="SNP positions", ylab="Contributions", srt=90, adj=c(0,0.5), ... ){
if(is.null(x$loadings)){
warning("This object does not contain loadings. Re-run the analysis, specifying 'loadings=TRUE'.")
Modified: pkg/man/genlight.Rd
===================================================================
--- pkg/man/genlight.Rd 2011-01-25 16:12:39 UTC (rev 778)
+++ pkg/man/genlight.Rd 2011-01-25 18:07:17 UTC (rev 779)
@@ -14,6 +14,9 @@
\alias{ploidy,genlight-method}
\alias{locNames,genlight-method}
\alias{indNames,genlight-method}
+\alias{alleles,genlight-method}
+\alias{pop,genlight-method}
+\alias{pop<-,genlight-method}
\alias{as,genlight,matrix-method}
\alias{coerce,genlight,matrix-method}
\alias{as.matrix.genlight}
@@ -118,6 +121,14 @@
the individuals, if provided when the object was contructed.}
\item{locNames}{\code{signature(x = "genlight")}: returns the names of
the loci, if provided when the object was contructed.}
+ \item{alleles}{\code{signature(x = "genlight")}: returns the names
+ of the alleles of each SNPs, if provided when the object was
+ contructed.}
+ \item{pop}{\code{signature(x = "genlight")}: returns a factor
+ indicating the population of each individual, if provided when the
+ object was contructed.}
+ \item{pop<-}{\code{signature(x = "genlight")}: sets the population
+ of each individual using a factor of length \code{nInd(x)}.}
\item{as.matrix}{\code{signature(x = "genlight")}: converts a
\code{genlight} object into a matrix of integers, with individuals
in rows and SNPs in columns. The S4 method 'as' can be used as
Added: pkg/man/glPca.Rd
===================================================================
--- pkg/man/glPca.Rd (rev 0)
+++ pkg/man/glPca.Rd 2011-01-25 18:07:17 UTC (rev 779)
@@ -0,0 +1,142 @@
+\encoding{UTF-8}
+\name{glPca}
+\alias{glPca}
+\alias{print.glPca}
+\alias{scatter.glPca}
+\alias{loadingplot.glPca}
+
+\title{Principal Component Analysis for genlight objects}
+\description{
+ These functions implement Principal Component Analysis (PCA) for
+ massive SNP datasets stored as \linkS4class{genlight} object. This
+ implementation has the advantage of never representing to complete data
+ matrix, therefore making huge economies in terms of rapid access
+ memory (RAM). When the \code{multicore} package is available,
+ \code{glPca} uses multiple-core ressources for more efficient
+ computations. \code{glPca} returns lists with the class \code{glPca}
+ (see 'value').
+
+ Other functions are defined for objects of this class:
+
+ - \code{print}: prints the content of a \code{glPca} object.
+
+ - \code{scatter}: produces scatterplots of principal components,
+ with a screeplot of eigenvalues as inset.
+
+ - \code{loadingplot}: plots the loadings of the analysis for one given
+ axis, using an adapted version of the generic function \code{loadingplot}.
+}
+\usage{
+glPca(x, center = TRUE, scale = FALSE, nf = NULL, loadings = TRUE,
+ multicore = require("multicore"), n.cores = NULL)
+
+\method{print}{glPca}(x, \dots)
+
+\method{summary}{glPca}(object, \dots)
+
+\method{scatter}{glPca}(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, \dots)
+
+\method{loadingplot}{glPca}(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), \dots)
+
+}
+\arguments{
+ \item{x}{for \code{glPca}, a \linkS4class{genlight} object; for
+ \code{print}, \code{scatter}, and \code{loadingplot}, a \code{glPca}
+ object.}
+ \item{center}{a logical indicating whether the numbers of alleles
+ should be centered; defaults to TRUE}
+ \item{scale}{a logical indicating whether the numbers of alleles
+ should be scaled; defaults to FALSE}
+ \item{nf}{an integer indicating the number of principal components to
+ be retained; if NULL, a screeplot of eigenvalues will be displayed
+ and the user will be asked for a number of retained axes.}
+ \item{loadings}{a logical indicating whether loadings of the alleles
+ should be computed (TRUE, default), or not (FALSE). Vectors of
+ loadings are not always useful, and can take a large amount of
+ RAM when millions of SNPs are considered.}
+ \item{multicore}{a logical indicating whether multiple cores -if available- should be
+ used for the computations (TRUE, default), or not (FALSE); requires
+ the package \code{multicore} to be installed (see details).}
+ \item{n.cores}{if \code{multicore} 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.}
+ \item{\dots}{further arguments to be passed to other functions.}
+
+ \item{xax,yax}{\code{integers} specifying which principal components
+ should be shown in x and y axes. }
+ \item{posi,bg,ratio}{arguments used to customize the inset in scatterplots
+ of \code{glPca} results. See \code{\link[ade4]{add.scatter}} documentation in the
+ ade4 package for more details.}
+ \item{label,clabel,xlim,ylim,grid,addaxes,origin,include.origin,sub,csub,possub,cgrid,pixmap,contour,area}{
+ arguments passed to \code{\link[ade4]{s.class}}; see \code{?s.label} for more information}
+ \item{at}{an optional numeric vector giving the abscissa at which
+ loadings are plotted. Useful when variates are SNPs with a known
+ position in an alignement.}
+ \item{threshold}{a threshold value above which values of x are
+ identified. By default, this is the third quartile of x.}
+ \item{axis}{an integer indicating the column of x to be plotted; used
+ only if x is a matrix-like object.}
+ \item{fac}{a factor defining groups of SNPs.}
+ \item{byfac}{a logical stating whether loadings should be averaged by
+ groups of SNPs, as defined by \code{fac}.}
+ \item{lab}{a character vector giving the labels used to annotate
+ values above the threshold.}
+ \item{cex.lab}{a numeric value indicating the size of annotations.}
+ \item{cex.fac}{a numeric value indicating the size of annotations for
+ groups of observations.}
+ \item{lab.jitter}{a numeric value indicating the factor of
+ randomisation for the position of annotations. Set to 0 (by default)
+ implies no randomisation.}
+ \item{main}{the main title of the figure.}
+ \item{xlab}{the title of the x axis.}
+ \item{ylab}{the title of the y axis.}
+ \item{srt}{rotation of the labels; see ?text.}
+ \item{adj}{adjustment of the labels; see ?text.}
+}
+\details{
+ === Using multiple cores ===
+ Most recent machines have one or several processors with multiple
+ cores. R processes usually use one single core. The package
+ \code{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
+ \code{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.
+}
+\value{
+ === glPca objects ===\cr
+ The class \code{glPca} is a list with the following
+ components:\cr
+ \item{call}{the matched call.}
+ \item{eig}{a numeric vector of eigenvalues.}
+ \item{scores}{a matrix of principal components, containing the
+ coordinates of each individual (in row) on each principal axis (in column).}
+ \item{loadings}{(optional) a matrix of loadings, containing the loadings of each
+ SNP (in row) for each principal axis (in column).}
+
+
+ === other outputs ===\cr
+ Other functions have different outputs:\cr
+ - \code{scatter} return the matched call.\cr
+ - \code{loadingplot} returns information about the most contributing
+ SNPs (see \code{\link{loadingplot.default}})
+}
+
+\seealso{
+ - \code{\link{genlight}}: class of object for storing massive binary
+ SNP data.
+
+ - \code{\link{dapc}}: Discriminant Analysis of Principal Components.
+
+}
+\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
+\keyword{multivariate}
\ No newline at end of file
Modified: pkg/man/loadingplot.Rd
===================================================================
--- pkg/man/loadingplot.Rd 2011-01-25 16:12:39 UTC (rev 778)
+++ pkg/man/loadingplot.Rd 2011-01-25 18:07:17 UTC (rev 779)
@@ -11,10 +11,12 @@
variable (loadings) in a given analysis.
}
\usage{
-loadingplot(x, at=NULL, threshold=quantile(x,0.75), axis=1, fac=NULL, byfac=FALSE,
- lab=names(x), cex.lab=0.7, cex.fac=1, lab.jitter=0,
- main="Loading plot", xlab="Variables", ylab="Loadings",\dots)
+loadingplot(x, \dots)
+\method{loadingplot}{default}(x, at=NULL, threshold=quantile(x,0.75), axis=1, fac=NULL, byfac=FALSE,
+ lab=rownames(x), cex.lab=0.7, cex.fac=1, lab.jitter=0,
+ main="Loading plot", xlab="Variables", ylab="Loadings", srt = 0, adj = NULL, \dots)
+
}
\arguments{
\item{x}{either a vector with numeric values to be plotted, or a
@@ -41,6 +43,8 @@
\item{main}{the main title of the figure.}
\item{xlab}{the title of the x axis.}
\item{ylab}{the title of the y axis.}
+ \item{srt}{rotation of the labels; see ?text.}
+ \item{adj}{adjustment of the labels; see ?text.}
\item{\dots}{further arguments to be passed to the plot function.}
}
\value{
More information about the adegenet-commits
mailing list