[adegenet-commits] r518 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 18 14:01:36 CET 2009


Author: jombart
Date: 2009-12-18 14:01:35 +0100 (Fri, 18 Dec 2009)
New Revision: 518

Modified:
   pkg/R/haploPop.R
Log:
fixed bug when initializing simulations with an object.


Modified: pkg/R/haploPop.R
===================================================================
--- pkg/R/haploPop.R	2009-12-17 16:09:20 UTC (rev 517)
+++ pkg/R/haploPop.R	2009-12-18 13:01:35 UTC (rev 518)
@@ -186,9 +186,10 @@
 
     ## INITIATE SIMULATIONS ##
     ## INITIALIZE FROM SCRATCH
+    vecS <- max.pop.size() # susceptibles
+
     if(is.null(ini.obj)){
         ##vecS <- max.pop.size() -  n.snp.ini # susceptibles
-        vecS <- max.pop.size() # susceptibles
         if(is.null(ini.haplo)) {
             haplo.ini <- sample(SNP.POOL, n.snp.ini, replace=TRUE)
         } else {
@@ -202,7 +203,7 @@
         listAges[[1]] <- rep(0, ini.pop.size)
     } else { ## INITIALIZE WITH PROVIDED OBJECT
         if(!inherits(ini.obj, "haploPop")) stop("x is not a haploPop object")
-        vecS <- ini.obj$S
+        ##vecS <- ini.obj$S
         ANCES <- attr(ini.obj, "ances")
         listPop <- ini.obj$pop
         listAges <- ini.obj$ages
@@ -755,9 +756,11 @@
 
     ## INITIATE SIMULATIONS ##
     ## INITIALIZE FROM SCRATCH
+    vecS <- max.pop.size() # susceptibles
+
     if(is.null(ini.obj)){
         ## vecS <- max.pop.size() -  n.snp.ini # susceptibles
-        vecS <- max.pop.size() # susceptibles
+
         if(is.null(ini.haplo)) {
             haplo.ini <- sample(SNP.POOL, n.snp.ini, replace=TRUE)
         } else {
@@ -770,7 +773,7 @@
         listAges[[1]] <- rep(0, ini.pop.size)
     } else { ## INITIALIZE WITH PROVIDED OBJECT
         if(!inherits(ini.obj, "haploPop")) stop("x is not a haploPopDiv object")
-        vecS <- ini.obj$S
+        ## vecS <- ini.obj$S
         ANCES <- attr(ini.obj, "ances")
         listPop <- ini.obj$pop
         listAges <- ini.obj$ages



More information about the adegenet-commits mailing list