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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 29 00:18:25 CET 2010


Author: jombart
Date: 2010-11-29 00:18:24 +0100 (Mon, 29 Nov 2010)
New Revision: 726

Modified:
   pkg/R/genind2genpop.R
   pkg/R/inbreeding.R
   pkg/man/inbreeding.Rd
Log:
Documented inbreeding ML function. Corrected a tiny little bug in genind2genpop when one pop.


Modified: pkg/R/genind2genpop.R
===================================================================
--- pkg/R/genind2genpop.R	2010-11-24 17:31:03 UTC (rev 725)
+++ pkg/R/genind2genpop.R	2010-11-28 23:18:24 UTC (rev 726)
@@ -23,11 +23,11 @@
     pop <- as.character(pop)
     pop <- factor(pop, levels=unique(pop))
   } else {
-    pop <- x at pop
+    pop <- pop(x)
     # keep levels in order of appearance
-    pop <- as.character(pop)
-    pop <- factor(pop, levels=unique(pop))
-    if(!is.null(x at pop.names)) levels(pop) <- x at pop.names # restore real names
+    ##pop <- as.character(pop)
+    ##pop <- factor(pop, levels=unique(pop))
+    ##if(!is.null(x at pop.names)) levels(pop) <- x at pop.names # restore real names
   }
 
   # make generic pop labels, store real pop names
@@ -51,6 +51,7 @@
     lab.col <- names(tabcount)
     tabcount <- matrix(tabcount,nrow=1)
     colnames(tabcount) <- lab.col
+    rownames(tabcount) <- levels(pop)[1]
   }
 
   ## make final object

Modified: pkg/R/inbreeding.R
===================================================================
--- pkg/R/inbreeding.R	2010-11-24 17:31:03 UTC (rev 725)
+++ pkg/R/inbreeding.R	2010-11-28 23:18:24 UTC (rev 726)
@@ -89,7 +89,7 @@
 ###############
 ## inbreeding.ml
 ###############
-inbreeding.ml <- function(x, pop=NULL, truenames=TRUE, res.type=c("sample","function"), N=500, M=N*10, ...){
+inbreeding.ml <- function(x, pop=NULL, truenames=TRUE, res.type=c("sample","function"), N=200, M=N*10){
     ## CHECKS ##
     if(!is.genind(x)) stop("x is not a valid genind object")
     checkType(x)

Modified: pkg/man/inbreeding.Rd
===================================================================
--- pkg/man/inbreeding.Rd	2010-11-24 17:31:03 UTC (rev 725)
+++ pkg/man/inbreeding.Rd	2010-11-28 23:18:24 UTC (rev 726)
@@ -34,6 +34,9 @@
   of inbreeding coefficient values.
 }
 \seealso{
+  \code{\link{inbreeding.ml}}: a maximum-likelihood estimation of
+  inbreeding.
+  
   \code{\link{Hs}}, \code{\link[hierfstat]{varcomp.glob}},
   \code{\link{gstat.randtest}}
 }
@@ -49,9 +52,16 @@
   homozygote, and 0 otherwise. For one locus, Balloux's inbreeding coefficient is
   defined as:
 
-  \eqn{  \frac{h - \sum_i p_i^2}{ \sum_i p_i^2 (1- \sum_i p_i^2)} } \cr
+  \eqn{  \frac{h - \sum_i p_i^2}{ \sum_i p_i^2 (1- \sum_i p_i^2)} }
 
-  For multi-locus genotypes, inbreeding values are averaged over the loci.
+  For multi-locus genotypes, inbreeding values are averaged over the
+  loci.
+
+  Important note: to estimate F, the probability of being homozygote at
+  a locus an individual has to be inferred from a single
+  observation. This can results in inaccuracy of the estimation of F,
+  and possible negative values. To circumvent such issues, use the
+  maximum-likelihood estimation of F (\code{\link{inbreeding.ml}}).
 }
 \author{
   Implementation: Thibaut Jombart \email{t.jombart at imperial.ac.uk}\cr



More information about the adegenet-commits mailing list