[adegenet-commits] r970 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 10 12:24:20 CET 2011


Author: jombart
Date: 2011-11-10 12:24:20 +0100 (Thu, 10 Nov 2011)
New Revision: 970

Modified:
   pkg/DESCRIPTION
   pkg/R/fstat.R
   pkg/man/adegenet.package.Rd
   pkg/man/fstat.Rd
Log:
Final changes.


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2011-11-10 10:41:01 UTC (rev 969)
+++ pkg/DESCRIPTION	2011-11-10 11:24:20 UTC (rev 970)
@@ -1,6 +1,6 @@
 Package: adegenet
 Version: 1.3-2
-Date: 2011/09/01
+Date: 2011/11/11
 Title: adegenet: an R package for the exploratory analysis of genetic and genomic data.
 Author:  Thibaut Jombart <t.jombart at imperial.ac.uk>
   with contributions of: Ismail Ahmed <ismail.ahmed at inserm.fr>, Peter Solymos

Modified: pkg/R/fstat.R
===================================================================
--- pkg/R/fstat.R	2011-11-10 10:41:01 UTC (rev 969)
+++ pkg/R/fstat.R	2011-11-10 11:24:20 UTC (rev 970)
@@ -1,35 +1,32 @@
-#################
-# fstat function
-#################
-#
-# Wrapper for fst estimator from hierfstat package
-#
-fstat <- function(x, pop=NULL, fstonly=FALSE){
-    cat("\nSorry, hierfstat package has been disabled - this function will be restored in a future release.\n")
-    return(invisible())
-    ## ## misc checks
-    ## if(!is.genind(x)) stop("x is not a valid genind object")
-    ## if(!require(hierfstat)) stop("hierfstat package is required. Please install it.")
-    ## if(x at ploidy != as.integer(2)) stop("not implemented for non-diploid genotypes")
-    ## checkType(x)
+## #################
+## # fstat function
+## #################
+## #
+## # Wrapper for fst estimator from hierfstat package
+## #
+## fstat <- function(x, pop=NULL, fstonly=FALSE){
+##     cat("\nSorry, hierfstat package has been disabled - this function will be restored in a future release.\n")
+##     return(invisible())
+##     ## ## misc checks
+##     ## if(!is.genind(x)) stop("x is not a valid genind object")
+##     ## if(!require(hierfstat)) stop("hierfstat package is required. Please install it.")
+##     ## if(x at ploidy != as.integer(2)) stop("not implemented for non-diploid genotypes")
+##     ## checkType(x)
 
-    ## if(is.null(pop)) pop <- x at pop
-    ## if(is.null(pop)) stop("no pop factor provided")
-    ## if(length(pop)!=nrow(x at tab)) stop("pop has a wrong length.")
+##     ## if(is.null(pop)) pop <- x at pop
+##     ## if(is.null(pop)) stop("no pop factor provided")
+##     ## if(length(pop)!=nrow(x at tab)) stop("pop has a wrong length.")
 
-    ## ## computations
-    ## dat <- genind2hierfstat(x)[,-1]
-    ## res <- varcomp.glob(levels=data.frame(pop), loci=dat)$F
+##     ## ## computations
+##     ## dat <- genind2hierfstat(x)[,-1]
+##     ## res <- varcomp.glob(levels=data.frame(pop), loci=dat)$F
 
-    ## if(fstonly) {res <- res[1,1]}
-    ## return(res)
-}
+##     ## if(fstonly) {res <- res[1,1]}
+##     ## return(res)
+## }
 
 
 
-
-
-
 ###############
 ## pairwise.fst
 ###############

Modified: pkg/man/adegenet.package.Rd
===================================================================
--- pkg/man/adegenet.package.Rd	2011-11-10 10:41:01 UTC (rev 969)
+++ pkg/man/adegenet.package.Rd	2011-11-10 11:24:20 UTC (rev 970)
@@ -78,7 +78,10 @@
    alleles. This covers formats from many softwares like GENETIX or
    STRUCTURE. For this, see \code{\link{genind2df}}.\cr
 
+   Also note that the \code{pegas} package imports \linkS4class{genind}
+   objects using the function \code{as.loci}.
 
+   
    === MANIPULATING DATA ===\cr
    Several functions allow one to manipulate \linkS4class{genind} or
    \linkS4class{genpop} objects\cr
@@ -188,7 +191,7 @@
     Package: \tab adegenet\cr
     Type: \tab Package\cr
     Version: \tab 1.3-2\cr
-    Date: \tab 2011-09-01 \cr
+    Date: \tab 2011-11-11 \cr
     License: \tab GPL (>=2)
   } 
 }
@@ -226,8 +229,8 @@
 \seealso{
   adegenet is related to several packages, in particular:\cr
   - \code{ade4} for multivariate analysis\cr
+  - \code{pegas} for population genetics tools\cr
   - \code{ape} for phylogenetics and DNA data handling\cr
-  - \code{pegas} for population genetics tools\cr
   - \code{seqinr} for handling nucleic and proteic sequences\cr
 }
 

Modified: pkg/man/fstat.Rd
===================================================================
--- pkg/man/fstat.Rd	2011-11-10 10:41:01 UTC (rev 969)
+++ pkg/man/fstat.Rd	2011-11-10 11:24:20 UTC (rev 970)
@@ -1,7 +1,6 @@
 \encoding{UTF-8}
 \name{F statistics}
 \alias{fstat}
-\alias{Fst}
 \alias{FST}
 \alias{fst}
 \alias{pairwise.fst}
@@ -10,34 +9,29 @@
   \code{pairwise.fst} computes Nei's pairwise Fst between all pairs of
   populations using a \linkS4class{genind} object. Heretozygosities are
   weighted by group sizes (see details).
-  
-  The former function \code{fstat} was a wrapper for \code{varcomp.glob}
-  from the package \code{hierfstat}. Unfortunately, this package was
-  removed from CRAN due to maintaining issues. For a replacement, see
-  the function \code{Fst} in the \code{pagas} package.!
+
+  The function \code{fstat} is no longer available as the package
+  \code{hierfstat} has been removed from CRAN. For Fst, Fis and Fit, use
+  the function \code{Fst} from the \code{pagas} package (see example).
 }
 \usage{
 pairwise.fst(x, pop=NULL, res.type=c("dist","matrix"), truenames=TRUE)
-
-fstat(x, pop=NULL, fstonly=FALSE)
 }
 \arguments{
   \item{x}{an object of class \linkS4class{genind}.}
   \item{pop}{a factor giving the 'population' of each individual. If NULL,
     pop is seeked from \code{pop(x)}. Note that the term population refers in
     fact to any grouping of individuals'.}
-  \item{fstonly}{a logical stating whether only the Fst value should be
-    returned (TRUE) instead of all F statistics (FALSE, default).}
   \item{res.type}{the type of result to be returned: a \code{dist} object, or a
     symmetric matrix}
   \item{truenames}{a logical indicating whether true labels (as opposed
     to generic labels) should be used to name the output.}
 }
 \value{
-  A vector, a matrix, or a dist object containing F statistics.}
-\seealso{\code{\link{Hs}}%, \code{\link[hierfstat]{varcomp.glob}},
- % \code{\link{gstat.randtest}}
+  A vector, a matrix, or a dist object containing F statistics.
 }
+\seealso{\code{\link{Hs}}
+}
 \references{
   Nei, M. (1973) Analysis of gene diversity in subdivided
   populations. Proc Natl Acad Sci USA, 70: 3321-3323
@@ -58,5 +52,19 @@
 mat.fst <- pairwise.fst(nancycats, res.type="matrix")
 mat.fst
 }
+
+## Fst, Fis, Fit
+if(require(pegas)){
+data(nancycats)
+
+## conversion to pegas's format
+as.loci(nancycats)
+
+## use Fst from pegas
+fsttab <- Fst(as.loci(nancycats))
+
+## average over loci
+apply(fsttab, 2, mean)
 }
+}
 \keyword{multivariate}
\ No newline at end of file



More information about the adegenet-commits mailing list