[adegenet-commits] r598 - in pkg: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 15 20:01:47 CEST 2010
Author: jombart
Date: 2010-04-15 20:01:47 +0200 (Thu, 15 Apr 2010)
New Revision: 598
Modified:
pkg/DESCRIPTION
pkg/R/PCtest.R
pkg/R/sequences.R
pkg/man/HWE.Rd
pkg/man/adegenet.package.Rd
pkg/man/as-methods.Rd
pkg/man/colorplot.Rd
pkg/man/dapc.Rd
pkg/man/dist.genpop.Rd
pkg/man/fstat.Rd
pkg/man/genpop.Rd
pkg/man/gstat.randtest.Rd
pkg/man/monmonier.Rd
pkg/man/sequences.Rd
pkg/man/spca.Rd
Log:
such a massive pain in the....
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/DESCRIPTION 2010-04-15 18:01:47 UTC (rev 598)
@@ -5,7 +5,7 @@
Author: Thibaut Jombart <t.jombart at imperial.ac.uk>, with contributions from Peter Solymos and Francois Balloux <f.balloux at imperial.ac.uk>
Maintainer: Thibaut Jombart <t.jombart at imperial.ac.uk>
Suggests: ade4, genetics, hierfstat, spdep, tripack, ape, pegas, graph, RBGL
-Depends: methods
+Depends: methods, MASS
Description: Classes and functions for genetic data analysis within the multivariate framework.
License: GPL (>=2)
LazyLoad: yes
\ No newline at end of file
Modified: pkg/R/PCtest.R
===================================================================
--- pkg/R/PCtest.R 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/R/PCtest.R 2010-04-15 18:01:47 UTC (rev 598)
@@ -1,51 +1,51 @@
-pctest <- function(x, nperm=99, center=TRUE, scale=TRUE, method=c("sigma", "binom"), quiet=FALSE, plot=TRUE){
- ## check x
- if(!is.genind(x) & !is.genpop(x)){
- stop("x is not a genind or a genpop object")
- }
+## pctest <- function(x, nperm=99, center=TRUE, scale=TRUE, method=c("sigma", "binom"), quiet=FALSE, plot=TRUE){
+## ## check x
+## if(!is.genind(x) & !is.genpop(x)){
+## stop("x is not a genind or a genpop object")
+## }
- ## a few general variables
- N <- nrow(x at tab)
- P <- ncol(x at tab)
+## ## a few general variables
+## N <- nrow(x at tab)
+## P <- ncol(x at tab)
- ## make tables of allele frequencies
- X <- scaleGen(x, center=center, scale=scale, method=method, missing="mean")
- fac.loc <- factor(sub("[.][^.]*$","",colnames(X)))
- lX <- lapply(levels(fac.loc), function(id) X[,fac.loc==id,drop=FALSE])
+## ## make tables of allele frequencies
+## X <- scaleGen(x, center=center, scale=scale, method=method, missing="mean")
+## fac.loc <- factor(sub("[.][^.]*$","",colnames(X)))
+## lX <- lapply(levels(fac.loc), function(id) X[,fac.loc==id,drop=FALSE])
- ## auxil function to compute the first eigenvalue
- if(N > P){ # N > P
- f1 <- function(A){
- Z <- t(A) %*% A / N
- return(eigen(Z, symmetric=TRUE, only.values=TRUE)$values[1])
- }
- } else { #p <= n
- f1 <- function(A){
- Z <- A %*% t(A) / N
- return(eigen(Z, symmetric=TRUE, only.values=TRUE)$values[1])
- }
- }
+## ## auxil function to compute the first eigenvalue
+## if(N > P){ # N > P
+## f1 <- function(A){
+## Z <- t(A) %*% A / N
+## return(eigen(Z, symmetric=TRUE, only.values=TRUE)$values[1])
+## }
+## } else { #p <= n
+## f1 <- function(A){
+## Z <- A %*% t(A) / N
+## return(eigen(Z, symmetric=TRUE, only.values=TRUE)$values[1])
+## }
+## }
- ## Monte Carlo procedure
- makeOnePerm <- function(listX){
- return(as.matrix(data.frame(lapply(listX, function(e) e[sample(N),,drop=FALSE]))))
- }
+## ## Monte Carlo procedure
+## makeOnePerm <- function(listX){
+## return(as.matrix(data.frame(lapply(listX, function(e) e[sample(N),,drop=FALSE]))))
+## }
- if(quiet){
- sim <- sapply(1:nperm, function(i) f1(makeOnePerm(lX)))
- } else {
- cat("\n Computing", nperm, "simulated eigenvalues ")
- sim <- sapply(1:nperm, function(i) {cat(ifelse(i%%10==0, i, "."));return(f1(makeOnePerm(lX)))} )
- cat(" done.\n")
- }
- ini <- f1(X)
+## if(quiet){
+## sim <- sapply(1:nperm, function(i) f1(makeOnePerm(lX)))
+## } else {
+## cat("\n Computing", nperm, "simulated eigenvalues ")
+## sim <- sapply(1:nperm, function(i) {cat(ifelse(i%%10==0, i, "."));return(f1(makeOnePerm(lX)))} )
+## cat(" done.\n")
+## }
+## ini <- f1(X)
- ## return res
- myCall <- match.call()
- res <- as.randtest(sim=sim, obs=ini, alter="greater", call=myCall)
- if(plot) {
- plot(res, nclass=NULL, main="1st eigenvalue vs simulated eigenvalues (histogram)")
- }
- return(res)
-}
+## ## return res
+## myCall <- match.call()
+## res <- as.randtest(sim=sim, obs=ini, alter="greater", call=myCall)
+## if(plot) {
+## plot(res, nclass=NULL, main="1st eigenvalue vs simulated eigenvalues (histogram)")
+## }
+## return(res)
+## }
Modified: pkg/R/sequences.R
===================================================================
--- pkg/R/sequences.R 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/R/sequences.R 2010-04-15 18:01:47 UTC (rev 598)
@@ -75,56 +75,56 @@
-###############
-## transiProb
-###############
-##
-## proba/distance based on transition prob from one sequence to another
-## time is taken into account
-## output: matrix with term proba(rowIdx to colIdx)
-##
-transiProb <- function(x, mu, dates, result=c("prob","dist")){
- ## MISC CHECKS ##
- if(!inherits(x,"DNAbin")) stop("x is not a DNAbin object")
- if(!require(ape)) stop("The package ape is required.")
- result <- match.arg(result)
+## ###############
+## ## transiProb
+## ###############
+## ##
+## ## proba/distance based on transition prob from one sequence to another
+## ## time is taken into account
+## ## output: matrix with term proba(rowIdx to colIdx)
+## ##
+## transiProb <- function(x, mu, dates, result=c("prob","dist")){
+## ## MISC CHECKS ##
+## if(!inherits(x,"DNAbin")) stop("x is not a DNAbin object")
+## if(!require(ape)) stop("The package ape is required.")
+## result <- match.arg(result)
- ## COMPUTATIONS ##
+## ## COMPUTATIONS ##
- ## get numbers of differing nucleotides between sequences
- seq.length <- ncol(as.matrix(x))
- D <- as.matrix(dist.dna(x, model="raw")) * seq.length
- ## if(sum(D-round(D)) > 1e-10){ # make sure we've got integers there
- ## warning("Number of nucleotides are not all integers")
- ## }
- D <- round(D)
+## ## get numbers of differing nucleotides between sequences
+## seq.length <- ncol(as.matrix(x))
+## D <- as.matrix(dist.dna(x, model="raw")) * seq.length
+## ## if(sum(D-round(D)) > 1e-10){ # make sure we've got integers there
+## ## warning("Number of nucleotides are not all integers")
+## ## }
+## D <- round(D)
- ## compute matrix T (time between sequences)
- if(inherits(dates,"POSIXct")){ # dates in POSIXct format
- temp <- outer(dates, dates, difftime, unit="days")
- T <- -matrix(as.numeric(temp),ncol=length(dates))
- } else { # dates are numeric
- T <- -outer(dates, dates, "-")
- }
+## ## compute matrix T (time between sequences)
+## if(inherits(dates,"POSIXct")){ # dates in POSIXct format
+## temp <- outer(dates, dates, difftime, unit="days")
+## T <- -matrix(as.numeric(temp),ncol=length(dates))
+## } else { # dates are numeric
+## T <- -outer(dates, dates, "-")
+## }
- ## spot negative times
- toSetToNull <- T < 1e-15
+## ## spot negative times
+## toSetToNull <- T < 1e-15
- ## compute proba(no change @ a site) term
- mu <- mu/365 # express mu per day
- p1 <- exp(-T*mu) + (1-exp(-T*mu))/4
- p1[toSetToNull] <- 0
- res <- dbinom(D, size=seq.length, prob=(1-p1))
+## ## compute proba(no change @ a site) term
+## mu <- mu/365 # express mu per day
+## p1 <- exp(-T*mu) + (1-exp(-T*mu))/4
+## p1[toSetToNull] <- 0
+## res <- dbinom(D, size=seq.length, prob=(1-p1))
- ## PROCESS/RETURN RESULT
- if(result=="prob"){ # return probabilities
- res[toSetToNull] <- 0
- diag(res) <- 1
- } else { # return d = -log(proba)
- res <- -log(res)
- res[toSetToNull] <- 1e15
- diag(res) <- 0
- }
+## ## PROCESS/RETURN RESULT
+## if(result=="prob"){ # return probabilities
+## res[toSetToNull] <- 0
+## diag(res) <- 1
+## } else { # return d = -log(proba)
+## res <- -log(res)
+## res[toSetToNull] <- 1e15
+## diag(res) <- 0
+## }
- return(res)
-} # end transiProb
+## return(res)
+## } # end transiProb
Modified: pkg/man/HWE.Rd
===================================================================
--- pkg/man/HWE.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/HWE.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -48,7 +48,7 @@
In all cases, NA values are likely to appear in fixed loci, or
entirely non-typed loci.
}
-\seealso{\code{\link[pkg:genetics]{HWE.test}},\code{\link[pkg:stats]{chisq.test}}
+\seealso{\code{\link[genetics]{HWE.test}},\code{\link[stats]{chisq.test}}
}
\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
\examples{
Modified: pkg/man/adegenet.package.Rd
===================================================================
--- pkg/man/adegenet.package.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/adegenet.package.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -80,7 +80,7 @@
- \code{\link{HWE.test.genind}}: performs HWE test for all
populations and loci combinations \cr
- \code{\link{gstat.randtest}}: performs a Monte Carlo test of Goudet's G statistic, measuring
- population structure (based on \code{\link[pkg:hierfstat]{g.stat.glob}} package \code{hierfstat}).\cr
+ population structure (based on \code{\link[hierfstat]{g.stat.glob}} package \code{hierfstat}).\cr
- \code{\link{dist.genpop}}: computes 5 genetic distances among populations. \cr
- \code{\link{monmonier}}: implementation of the Monmonier algorithm,
used to seek genetic boundaries among individuals or populations. Optimized boundaries can be obtained using
Modified: pkg/man/as-methods.Rd
===================================================================
--- pkg/man/as-methods.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/as-methods.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -28,7 +28,7 @@
These S3 and S4 methods are used to coerce \linkS4class{genind} and
\linkS4class{genpop} objects to matrix-like objects. In most cases,
this is equivalent to calling the \code{@tab} slot. An exception to
- this is the convertion to \code{\link[pkg:ade4]{ktab}} objects used in the
+ this is the convertion to \code{\link[ade4]{ktab}} objects used in the
ade4 package as inputs for K-tables methods (e.g. Multiple Coinertia
Analysis).\cr
}
Modified: pkg/man/colorplot.Rd
===================================================================
--- pkg/man/colorplot.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/colorplot.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -17,19 +17,24 @@
\usage{
colorplot(\dots)
-\method{colorplot}{default}(xy, X, axes=1:ncol(X), add.plot=FALSE, defaultLevel=0, \dots)
+\method{colorplot}{default}(xy, X, axes=NULL, add.plot=FALSE, defaultLevel=0, transp=FALSE, alpha=.5, \dots)
}
\arguments{
\item{xy}{a numeric matrix with two columns (e.g. a matrix of spatial coordinates.}
\item{X}{a matrix-like containing numeric values that are translated
into the RGB system. Variables are considered to be in columns.}
\item{axes}{the index of the columns of X to be represented. Up to
- three axes can be chosen.}
+ three axes can be chosen. If null, up to the first three columns of
+ X are used.}
\item{add.plot}{a logical stating whether the colorplot should be
added to the existing plot (defaults to FALSE).}
\item{defaultLevel}{a numeric value between 0 and 1, giving the
default level in a color for which values are not specified. Used
whenever less than three axes are specified.}
+ \item{transp}{a logical stating whether the produced colors should be
+ transparent (TRUE) or not (FALSE, default).}
+ \item{alpha}{the alpha level for transparency, between 0 (fully
+ transparent) and 1 (not transparent); see \code{?rgb} for more details.}
\item{\dots}{further arguments to be passed to other methods. In
\code{colorplot.default}, these arguments are passed to plot/points
functions. See \code{?plot.default} and \code{?points}.}
Modified: pkg/man/dapc.Rd
===================================================================
--- pkg/man/dapc.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/dapc.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -56,7 +56,7 @@
col=rainbow(length(levels(x$grp))), posi="bottomleft", bg="grey",
ratio=0.3, csub=1.2, \ldots)
-\method{assignplot}{dapc}(x, only.grp=NULL, subset=NULL, cex.lab=.75, pch=3)
+assignplot(x, only.grp=NULL, subset=NULL, cex.lab=.75, pch=3)
}
\arguments{
\item{x}{\code{a data.frame}, \code{matrix}, or \code{\linkS4class{genind}}
@@ -88,7 +88,9 @@
minimal percentage of the total variance of the data to be expressed by the
retained axes of PCA.}
\item{\ldots}{further arguments to be passed to other functions. For
- \code{dapc.matrix}, arguments are to match those of \code{dapc.data.frame}.}
+ \code{dapc.matrix}, arguments are to match those of
+ \code{dapc.data.frame}.}
+\item{object}{a \code{dapc} object.}
\item{scale.method}{a \code{character} specifying the scaling method to be used
for allele frequencies, which must match "sigma" (usual estimate of standard
deviation) or "binom" (based on binomial distribution). See \code{\link{scaleGen}} for
Modified: pkg/man/dist.genpop.Rd
===================================================================
--- pkg/man/dist.genpop.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/dist.genpop.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -102,7 +102,7 @@
Former dist.genet code by Daniel Chessel \email{chessel at biomserv.univ-lyon1.fr}\cr
and documentation by Anne B. Dufour \email{dufour at biomserv.univ-lyon1.fr}
}
-\seealso{ \code{\link[pkg:ade4]{cailliez}},\code{\link[pkg:ade4]{dudi.pco}}
+\seealso{ \code{\link[ade4]{cailliez}},\code{\link[ade4]{dudi.pco}}
}
\examples{
if(require(ade4)){
Modified: pkg/man/fstat.Rd
===================================================================
--- pkg/man/fstat.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/fstat.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -18,7 +18,7 @@
returned (TRUE) instead of all F statistics (FALSE, default).}
}
\value{A matrix of F statistics.}
-\seealso{\code{\link[pkg:hierfstat]{varcomp.glob}},
+\seealso{\code{\link[hierfstat]{varcomp.glob}},
\code{\link{gstat.randtest}}
}
\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
Modified: pkg/man/genpop.Rd
===================================================================
--- pkg/man/genpop.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/genpop.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -49,7 +49,6 @@
genpop object, invisibly returning its content}
}
}
-\references{}
\seealso{\code{\link{as.genpop}}, \code{\link{is.genpop}},\code{\link{makefreq}}, \code{\link{genind}}, \code{\link{import2genind}}, \code{\link{read.genetix}}, \code{\link{read.genepop}}, \code{\link{read.fstat}}, \code{\link{na.replace}}
}
\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
Modified: pkg/man/gstat.randtest.Rd
===================================================================
--- pkg/man/gstat.randtest.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/gstat.randtest.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -43,10 +43,10 @@
}
\value{Returns an object of the class \code{randtest} (package \code{ade4}).
}
-\seealso{\code{\link[pkg:hierfstat]{g.stats.glob}},
+\seealso{\code{\link[hierfstat]{g.stats.glob}},
\code{\link{fstat}},
- \code{\link[pkg:hierfstat]{test.g}},\code{\link[pkg:hierfstat]{test.within}},
- \code{\link[pkg:hierfstat]{test.between}},\code{\link[pkg:ade4]{as.randtest}},
+ \code{\link[hierfstat]{test.g}},\code{\link[hierfstat]{test.within}},
+ \code{\link[hierfstat]{test.between}},\code{\link[ade4]{as.randtest}},
\code{\link{genind2hierfstat}}
}
\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
Modified: pkg/man/monmonier.Rd
===================================================================
--- pkg/man/monmonier.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/monmonier.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -120,7 +120,7 @@
\author{Thibaut Jombart \email{t.jombart at imperial.ac.uk}}
-\seealso{\code{\link{spca}},\code{\link[pkg:spdep]{nb}}}
+\seealso{\code{\link{spca}},\code{\link[spdep]{nb}}}
\examples{
if(require(spdep) & require(ade4)){
Modified: pkg/man/sequences.Rd
===================================================================
--- pkg/man/sequences.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/sequences.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -29,7 +29,7 @@
\seealso{\code{\link{import2genind}}, \code{\link{read.genetix}},
\code{\link{read.fstat}}, \code{\link{read.structure}},
- \code{\link{read.genepop}}, \code{\link[pkg:ape]{DNAbin}}.
+ \code{\link{read.genepop}}, \code{\link[ape]{DNAbin}}.
}
\author{Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
\examples{
Modified: pkg/man/spca.Rd
===================================================================
--- pkg/man/spca.Rd 2010-04-15 17:38:03 UTC (rev 597)
+++ pkg/man/spca.Rd 2010-04-15 18:01:47 UTC (rev 598)
@@ -175,9 +175,9 @@
\seealso{\code{\link{spcaIllus}}, a set of simulated data illustrating
the sPCA \cr
\code{\link{global.rtest}} and \code{\link{local.rtest}} \cr
- \code{\link{chooseCN}}, \code{\link[pkg:ade4]{multispati}},
- \code{\link[pkg:ade4]{multispati.randtest}}\cr
- \code{\link[pkg:PBSmapping]{convUL}}, from the package 'PBSmapping' to convert longitude/latitude to
+ \code{\link{chooseCN}}, \code{\link[ade4]{multispati}},
+ \code{\link[ade4]{multispati.randtest}}\cr
+ \code{\link[PBSmapping]{convUL}}, from the package 'PBSmapping' to convert longitude/latitude to
UTM coordinates.
}
\author{ Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
More information about the adegenet-commits
mailing list