[adegenet-commits] r514 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 8 16:09:19 CET 2009


Author: jombart
Date: 2009-12-08 16:09:19 +0100 (Tue, 08 Dec 2009)
New Revision: 514

Modified:
   pkg/R/haploPop.R
Log:
new possibility to track nb of mutations from root


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-12-07 17:50:18 UTC (rev 513)
+++ pkg/R/haploPop.R	2009-12-08 15:09:19 UTC (rev 514)
@@ -586,7 +586,7 @@
                         max.pop.size=function(){1e4}, max.nb.pop=30, ini.pop.size=10, regen=FALSE,
                         p.new.pop=function(){1e-4}, death.func=function(age){age>1},
                         quiet=FALSE, allow.reverse=TRUE,
-                        track=c("div", "distRoot", "freq"), root.haplo=NULL, samp.size=50) {
+                        track=c("div", "distRoot", "freq","nbMut"), root.haplo=NULL, samp.size=50) {
 
 
     ## SOME CHECKS
@@ -810,7 +810,7 @@
         } # end fRes
     }
 
-        ## function getting allele absolute frequencies
+    ## function getting allele absolute frequencies
     if(track=="freq"){
         fRes <- function(list.pop){
             res <- table(unlist(list.pop))
@@ -818,8 +818,16 @@
         } # end fRes
     }
 
+    ## function getting allele absolute frequencies
+    if(track=="nbMut"){
+        fRes <- function(list.pop){
+            return( length(unique(unlist(list.pop))) )
+        } # end fRes
 
+    }
 
+
+
     res <- list(div=list(), popSize=integer())
     res$div[[1]] <- fRes(listPop)
     res$popSize[1] <- sum(sapply(listPop, length))



More information about the adegenet-commits mailing list