[adegenet-commits] r845 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 9 14:37:54 CET 2011


Author: jombart
Date: 2011-03-09 14:37:54 +0100 (Wed, 09 Mar 2011)
New Revision: 845

Modified:
   pkg/R/SNPbin.R
   pkg/man/find.clusters.Rd
   pkg/man/genlight.Rd
   pkg/man/read.PLINK.Rd
Log:
Added chromosome and position as slots.
Accessors/replacement methods are OK.
find.cluster needs more work to allow dudi arg in all methods;
need for a find.cluster for genlight objects.


Modified: pkg/R/SNPbin.R
===================================================================
--- pkg/R/SNPbin.R	2011-03-09 10:53:33 UTC (rev 844)
+++ pkg/R/SNPbin.R	2011-03-09 13:37:54 UTC (rev 845)
@@ -668,12 +668,21 @@
 
 
 ## chromosome
+setGeneric("chromosome", function(x, ...) standardGeneric("chromosome"))
+setGeneric("chromosome<-", function(x, value) standardGeneric("chromosome<-"))
+setGeneric("chr", function(x,...) standardGeneric("chr"))
+setGeneric("chr<-", function(x, value) standardGeneric("chr<-"))
+
 setMethod("chromosome","genlight", function(x,...){
     if(length(x at chromosome)==0) return(NULL)
     return(x at chromosome)
 })
 
+setMethod("chr","genlight", function(x,...){
+    return(chromosome(x))
+})
 
+
 setReplaceMethod("chromosome","genlight",function(x,value) {
     if(is.null(value)){
         slot(x, "chromosome", check=TRUE) <- value
@@ -684,9 +693,17 @@
     return(x)
 })
 
+setReplaceMethod("chr","genlight",function(x,value) {
+    chromosome(x) <- value
+    return(x)
+})
 
 
+
 ## position
+setGeneric("position", function(x, ...) standardGeneric("position"))
+setGeneric("position<-", function(x, value) standardGeneric("position<-"))
+
 setMethod("position","genlight", function(x,...){
     if(length(x at position)==0) return(NULL)
     return(x at position)

Modified: pkg/man/find.clusters.Rd
===================================================================
--- pkg/man/find.clusters.Rd	2011-03-09 10:53:33 UTC (rev 844)
+++ pkg/man/find.clusters.Rd	2011-03-09 13:37:54 UTC (rev 845)
@@ -28,7 +28,7 @@
               n.clust=NULL, stat=c("BIC","AIC", "WSS"),
               choose.n.clust=TRUE,criterion=c("diffNgroup", "min","goesup", "smoothNgoesup", "goodfit"),
               max.n.clust=round(nrow(x)/10), n.iter=1e5, n.start=10,
-              center=TRUE, scale=TRUE, \ldots)
+              center=TRUE, scale=TRUE, \ldots, dudi=NULL)
 
 \method{find.clusters}{matrix}(x, \ldots)
 
@@ -99,6 +99,10 @@
   \item{\ldots}{further arguments to be passed to other functions. For
     \code{find.clusters.matrix}, arguments are to match those of the
     \code{data.frame} method.}
+  \item{dudi}{optionally, a multivariate analysis with the class
+    \code{dudi} (from the ade4 package). If provided, prior PCA will be
+    ignored, and this object will be used as a prior step for variable
+    orthogonalisation.}
 }
 \details{
   === ON THE SELECTION OF K ===\cr

Modified: pkg/man/genlight.Rd
===================================================================
--- pkg/man/genlight.Rd	2011-03-09 10:53:33 UTC (rev 844)
+++ pkg/man/genlight.Rd	2011-03-09 13:37:54 UTC (rev 845)
@@ -19,6 +19,18 @@
 \alias{indNames<-,genlight-method}
 \alias{alleles,genlight-method}
 \alias{alleles<-,genlight-method}
+\alias{chromosome}
+\alias{chromosome<-}
+\alias{chromosome,genlight-method}
+\alias{chromosome<-,genlight-method}
+\alias{chr}
+\alias{chr<-}
+\alias{chr,genlight-method}
+\alias{chr<-,genlight-method}
+\alias{position}
+\alias{position<-}
+\alias{position,genlight-method}
+\alias{position<-,genlight-method}
 \alias{pop,genlight-method}
 \alias{pop<-,genlight-method}
 \alias{NA.posi}
@@ -78,8 +90,14 @@
     \item{\code{loc.names}}{an optional vector of characters giving the labels
       of the SNPs.}
     \item{\code{loc.all}}{an optional vector of characters indicating
-    the alleles of each SNP; for each SNP, alleles must be coded by two
-    letters separated by '/', e.g. 'a/t' is valid, but 'a  t' or 'a |t' are not.}
+      the alleles of each SNP; for each SNP, alleles must be coded by two
+      letters separated by '/', e.g. 'a/t' is valid, but 'a  t' or 'a |t'
+      are not.}
+    \item{\code{chromosome}}{an optional factor indicating the
+      chromosome to which each SNP belongs.}
+    \item{\code{position}}{an optional vector of integers indicating the
+      position of the SNPs.}
+    \item{\code{other}}{an optional list storing miscellaneous information.}
   }
 }
 \section{Slots}{
@@ -118,28 +136,37 @@
       supported arguments.}
     \item{show}{\code{signature(x = "genlight")}: printing of the
       object.}
+    
     \item{$}{\code{signature(x = "genlight")}: similar to the @ operator;
       used to access the content of slots of the object.}
     \item{$<-}{\code{signature(x = "genlight")}: similar to the @ operator;
       used to replace the content of slots of the object.}
+    
     \item{nInd}{\code{signature(x = "genlight")}: returns the number of
       individuals in the object.}
     \item{nLoc}{\code{signature(x = "genlight")}: returns the number of
       SNPs in the object.}
+    
     \item{names}{\code{signature(x = "genlight")}: returns the names of
       the slots of the object.}
-    \item{ploidy}{\code{signature(x = "genlight")}: returns the ploidy of
-      the genotypes.}
-    \item{NA.posi}{\code{signature(x = "genlight")}: returns the indices
-      of missing values (NAs) as a list with one vector of integer for each individual.}
+    
     \item{indNames}{\code{signature(x = "genlight")}: returns the names of
       the individuals, if provided when the object was contructed.}
     \item{indNames<-}{\code{signature(x = "genlight")}: sets the names of
-      the individuals using a character vector of length \code{nInd(x)}.}
+      the individuals using a character vector of length
+      \code{nInd(x)}.}
+    
     \item{locNames}{\code{signature(x = "genlight")}: returns the names of
       the loci, if provided when the object was contructed.}
     \item{locNames<-}{\code{signature(x = "genlight")}: sets the names of
       the SNPs using a character vector of length \code{nLoc(x)}.}
+    
+    \item{ploidy}{\code{signature(x = "genlight")}: returns the ploidy of
+      the genotypes.}
+    
+    \item{NA.posi}{\code{signature(x = "genlight")}: returns the indices
+      of missing values (NAs) as a list with one vector of integer for each individual.}
+
     \item{alleles}{\code{signature(x = "genlight")}: returns the names
       of the alleles of each SNPs, if provided when the object was
       contructed.}
@@ -147,15 +174,36 @@
       of the alleles of each SNPs using a character vector of length
       \code{nLoc(x)}; for each SNP, two alleles must be provided,
       separated by a "/", e.g. 'a/t', 'c/a', etc.}
+    
+    \item{chromosome}{\code{signature(x = "genlight")}: returns a factor
+      indicating the chromosome of each SNPs, or NULL if the information
+      is missing.}
+    \item{chromosome<-}{\code{signature(x = "genlight")}: sets the
+      chromosome to which SNPs belong using a factor of length
+      \code{nLoc(x)}.}
+    
+    \item{chr}{\code{signature(x = "genlight")}: shortcut for
+      \code{chromosome}.}
+    \item{chr<-}{\code{signature(x = "genlight")}: shortcut for
+      \code{chromosome<-}.}
+    
+    \item{position}{\code{signature(x = "genlight")}: returns an integer
+      vector indicating the position of each SNPs, or NULL if the
+      information is missing.}
+    \item{position<-}{\code{signature(x = "genlight")}: sets the
+      positions of the SNPs using an integer vector of length
+      \code{nLoc(x)}.}
+    
     \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{pop}{\code{signature(x = "genlight")}: returns the content of
+    \item{other}{\code{signature(x = "genlight")}: returns the content of
       the slot \code{@other}.}
-    \item{pop<-}{\code{signature(x = "genlight")}: sets the content of
+    \item{other<-}{\code{signature(x = "genlight")}: sets the content of
       the slot \code{@other}.}
+    
     \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
@@ -165,6 +213,7 @@
       \code{genlight} object into a list of genotypes coded as vector of
       integers (numbers of second allele). The S4 method 'as' can be
       used as well (e.g. as(x, "list")).}
+    
     \item{cbind}{\code{signature(x = "genlight")}: merges several
       \linkS4class{genlight} objects by column, i.e. regroups data of
       identical individuals genotyped for different SNPs.}

Modified: pkg/man/read.PLINK.Rd
===================================================================
--- pkg/man/read.PLINK.Rd	2011-03-09 10:53:33 UTC (rev 844)
+++ pkg/man/read.PLINK.Rd	2011-03-09 13:37:54 UTC (rev 845)
@@ -104,7 +104,7 @@
   \code{snpMatrix}.
 }
 \author{Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
-\examples{
+% \examples{
 
-}
+% }
 \keyword{manip}



More information about the adegenet-commits mailing list