[adegenet-commits] r515 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 8 18:21:47 CET 2009


Author: jombart
Date: 2009-12-08 18:21:47 +0100 (Tue, 08 Dec 2009)
New Revision: 515

Modified:
   pkg/R/haploPop.R
Log:
minor fixes



Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-12-08 15:09:19 UTC (rev 514)
+++ pkg/R/haploPop.R	2009-12-08 17:21:47 UTC (rev 515)
@@ -821,6 +821,14 @@
     ## function getting allele absolute frequencies
     if(track=="nbMut"){
         fRes <- function(list.pop){
+            list.pop <- list(pop=list.pop) # kludge needed for sample.haploPop
+            class(list.pop) <- "haploPop" # kludge needed for sample.haploPop
+            N <- sum(sapply(list.pop$pop, length))
+            if(N<1) return(0)
+            if(N > samp.size){
+                list.pop <- sample.haploPop(list.pop, samp.size, keep.pop=FALSE)
+            }
+
             return( length(unique(unlist(list.pop))) )
         } # end fRes
 



More information about the adegenet-commits mailing list