[adegenet-commits] r133 - in pkg: R data man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 25 19:22:38 CEST 2008


Author: jombart
Date: 2008-06-25 19:22:38 +0200 (Wed, 25 Jun 2008)
New Revision: 133

Added:
   pkg/data/microbov.RData
   pkg/data/nancycats.RData
   pkg/data/sim2pop.RData
   pkg/data/spcaIllus.RData
   pkg/man/scale.Rd
Removed:
   pkg/data/microbov.rda
   pkg/data/nancycats.rda
   pkg/data/sim2pop.rda
   pkg/data/spcaIllus.rda
Modified:
   pkg/R/scale.R
   pkg/man/as.genind.Rd
   pkg/man/genind.Rd
Log:
Added the @ploidy slot in genind.
Added documentation for scaleGen


Modified: pkg/R/scale.R
===================================================================
--- pkg/R/scale.R	2008-06-25 16:36:11 UTC (rev 132)
+++ pkg/R/scale.R	2008-06-25 17:22:38 UTC (rev 133)
@@ -4,9 +4,15 @@
 setGeneric("scaleGen", function(x,...){standardGeneric("scaleGen")})
 
 setMethod("scaleGen", "genind", function(x, center=TRUE, scale=TRUE,
-                                      method=c("sigma", "binom"), truenames=TRUE){
+                                      method=c("sigma", "binom"), missing=c("NA","0","mean"), truenames=TRUE){
 
     method <- match.arg(method)
+    missing <- match.arg(missing)
+
+    ## handle "missing" arg
+    if(missing %in% c("0","mean")){
+        x <- na.replace(x,method=missing)
+    }
     
     ## handle specific cases
     if(scale & tolower(method)=="binom"){
@@ -36,10 +42,11 @@
 
 
 setMethod("scaleGen", "genpop", function(x, center=TRUE, scale=TRUE,
-                                      method=c("sigma", "binom"), missing=NA, truenames=TRUE){
+                                      method=c("sigma", "binom"),  missing=c("NA","0","mean"), truenames=TRUE){
 
     method <- match.arg(method)
-
+    missing <- match.arg(missing)
+    
     ## make allele frequencies here
     X <- makefreq(x,quiet=TRUE,missing=missing,truenames=truenames)$tab
 

Added: pkg/data/microbov.RData
===================================================================
(Binary files differ)


Property changes on: pkg/data/microbov.RData
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Deleted: pkg/data/microbov.rda
===================================================================
(Binary files differ)

Added: pkg/data/nancycats.RData
===================================================================
(Binary files differ)


Property changes on: pkg/data/nancycats.RData
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Deleted: pkg/data/nancycats.rda
===================================================================
(Binary files differ)

Added: pkg/data/sim2pop.RData
===================================================================
(Binary files differ)


Property changes on: pkg/data/sim2pop.RData
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Deleted: pkg/data/sim2pop.rda
===================================================================
(Binary files differ)

Added: pkg/data/spcaIllus.RData
===================================================================
(Binary files differ)


Property changes on: pkg/data/spcaIllus.RData
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Deleted: pkg/data/spcaIllus.rda
===================================================================
(Binary files differ)

Modified: pkg/man/as.genind.Rd
===================================================================
--- pkg/man/as.genind.Rd	2008-06-25 16:36:11 UTC (rev 132)
+++ pkg/man/as.genind.Rd	2008-06-25 17:22:38 UTC (rev 133)
@@ -20,8 +20,8 @@
 }
 
 \usage{
-genind(tab,pop=NULL,prevcall=NULL)
-as.genind(tab,pop=NULL,prevcall=NULL)
+genind(tab,pop=NULL,prevcall=NULL, ploidy=2)
+as.genind(tab,pop=NULL,prevcall=NULL, ploidy=2)
 is.genind(x)
 }
 
@@ -30,6 +30,8 @@
     allelic frequencies, i.e. like in a genind object}
   \item{pop}{a factor giving the population of each genotype in 'x'}
   \item{prevcall}{call of an object}
+  \item{ploidy}{an integer indicating the degree of ploidy of
+    the genotypes. Beware: 2 is not an integer, but as.integer(2) is.}
   \item{x}{an object}
 }
 \value{

Modified: pkg/man/genind.Rd
===================================================================
--- pkg/man/genind.Rd	2008-06-25 16:36:11 UTC (rev 132)
+++ pkg/man/genind.Rd	2008-06-25 17:22:38 UTC (rev 133)
@@ -16,22 +16,24 @@
   of \$.
 }
 \section{Slots}{
-         \describe{
+  \describe{
     \item{\code{tab}:}{matrix of genotypes -in rows- for all alleles -in
-    columns-. Values are frequency: '0' if the genotype does not have
-    the corresponding allele, '1' for an homozygote and 0.5 for an
-    heterozygte.Rows and columns are given generic names.}
+      columns-. Values are frequency: '0' if the genotype does not have
+      the corresponding allele, '1' for an homozygote and 0.5 for an
+      heterozygte.Rows and columns are given generic names.}
     \item{\code{loc.names}:}{character vector containing the real names of the loci}
     \item{\code{loc.fac}:}{locus factor for the columns of \code{tab}}
     \item{\code{loc.nall}:}{integer vector giving the number of alleles per locus}
     \item{\code{all.names}:}{list having one component per locus, each containing a character vector of alleles names}
     \item{\code{call}:}{the matched call}
     \item{\code{ind.names}:}{character vector containing the real names of the
-    individuals. Note that as Fstat does not store these names, objects
-    converted from .dat files will contain empty \code{ind.names}.}
+      individuals. Note that as Fstat does not store these names, objects
+      converted from .dat files will contain empty \code{ind.names}.}
+    \item{\code{ploidy}:}{ an integer indicating the degree of ploidy of
+      the genotypes. Beware: 2 is not an integer, but as.integer(2) is.}
     \item{\code{pop}:}{(optional) factor giving the population of each individual}
     \item{\code{pop.names}:}{(optional) vector giving the real names of the
-    populations}
+      populations}
     \item{\code{other}:}{(optional) a list containing other information}
   }
 }

Added: pkg/man/scale.Rd
===================================================================
--- pkg/man/scale.Rd	                        (rev 0)
+++ pkg/man/scale.Rd	2008-06-25 17:22:38 UTC (rev 133)
@@ -0,0 +1,53 @@
+\name{scaleGen-methods}
+\docType{methods}
+\alias{scaleGen}
+\alias{scaleGen-methods}
+\alias{scaleGen,genind-method}
+\alias{scaleGen,genpop-method}
+\title{ Compute scaled allele frequencies }
+\description{
+  The generic function \code{scaleGen} is an analogue to the
+  \code{scale} function, but is designed with further arguments giving
+  scaling options.\cr
+
+  Methods are defined for \linkS4class{genind} and \linkS4class{genpop}
+  objects.
+  Both return data.frames of scaled allele frequencies.
+}
+\usage{
+\S4method{scaleGen}{genind}(x, center=TRUE, scale=TRUE, method=c("sigma", "binom"), missing=c("NA","0","mean"),truenames=TRUE)
+\S4method{scaleGen}{genpop}(x, center=TRUE, scale=TRUE, method=c("sigma", "binom"), missing=c("NA","0","mean"),truenames=TRUE)
+}
+\arguments{
+  \item{x}{a \linkS4class{genind} and \linkS4class{genpop} object}
+  \item{center}{a logical stating whether alleles frequencies should be
+    centred to mean zero (default to TRUE). Alternatively, a vector of
+    numeric values, one per allele, can be supplied: these values will be
+    substracted from the allele frequencies.}
+  \item{scale}{a logical stating whether alleles frequencies should be
+    scaled (default to TRUE). Alternatively, a vector of
+    numeric values, one per allele, can be supplied: these values will be
+    substracted from the allele frequencies.}
+  \item{method}{a character indicating the method to be used. See details.}
+  \item{truenames}{a logical indicating whether true labels (as opposed
+    to generic labels) should be used to name the output.}
+ \item{missing}{a character giving the treatment for missing values. Can be "NA", "0" or "mean"}
+ }
+ \value{
+   A \linkS4class{genind} and \linkS4class{genpop} object.
+}
+\details{
+  The argument \code{method} is used as follows:\cr
+
+  - \code{sigma}: scaling is made using the usual standard deviation\cr
+
+  - \code{binom}: scaling is made using the theoretical variance of the
+  allele frequency. This can be used to avoid that frequencies close to
+  0.5 have a stronger variance that those close to 0 or 1.
+}
+\author{Thibaut Jombart \email{jombart at biomserv.univ-lyon1.fr} }
+\examples{
+
+}
+\keyword{methods}
+\keyword{manip}



More information about the adegenet-commits mailing list