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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 18 12:05:19 CEST 2010


Author: jombart
Date: 2010-05-18 12:05:19 +0200 (Tue, 18 May 2010)
New Revision: 632

Modified:
   pkg/R/haploGen.R
   pkg/man/haploGen.Rd
Log:
corrected a few minor bugs in new version of haplogen; finished doc example


Modified: pkg/R/haploGen.R
===================================================================
--- pkg/R/haploGen.R	2010-05-18 09:55:09 UTC (rev 631)
+++ pkg/R/haploGen.R	2010-05-18 10:05:19 UTC (rev 632)
@@ -8,7 +8,7 @@
 ## mean.gen.time, sd.gen.time: average time for transmission and its standard deviation (normal dist)
 ## mean.repro, sd.repro: average number of transmissions and its standard deviation (normal dist)
 ##
-haploGen <- function(seq.length=1000, mu=0.0001, t.max=20,
+haploGen <- function(seq.length=10000, mu=0.0001, t.max=20,
                      gen.time=function(){round(rnorm(1,5,1))},
                      repro=function(){round(rnorm(1,2,1))}, max.nb.haplo=1e3,
                      geo.sim=TRUE, grid.size=5, lambda.xy=0.5,
@@ -405,6 +405,7 @@
     x.dates <- as.POSIXct(x)
     seq.length <- ncol(x$seq)
     myX <- myX * seq.length
+    myX <- as.matrix(myX)
     prevCall <- as.list(x$call)
     if(is.null(prevCall$mu)){
         mu0 <- 0.0001

Modified: pkg/man/haploGen.Rd
===================================================================
--- pkg/man/haploGen.Rd	2010-05-18 09:55:09 UTC (rev 631)
+++ pkg/man/haploGen.Rd	2010-05-18 10:05:19 UTC (rev 632)
@@ -34,7 +34,7 @@
   \code{haploGen} objects.
 }
 \usage{
-haploGen(seq.length=1000, mu=0.0001, t.max=20,
+haploGen(seq.length=10000, mu=0.0001, t.max=20,
               gen.time=function(){round(rnorm(1,5,1))},
               repro=function(){round(rnorm(1,2,1))}, max.nb.haplo=1e3,
               geo.sim=TRUE, grid.size=5, lambda.xy=0.5,
@@ -163,11 +163,15 @@
 }
 \examples{
 if(require(ape)){
+## PERFORM SIMULATIONS
 x <- haploGen(repro=2)
 x
+
+## PLOT SPATIAL SPREAD
 plotHaploGen(x, bg="white")
 title("Spatial dispersion of the haplotypes")
 
+## PLOT GENEALOGY
 if(require(graph) & require(Rgraphviz)){
 g=as(x, "graphNEL")
 g
@@ -175,5 +179,9 @@
 }
 
 
+## USE SEQTRACK RECONSTRUCTION
+x.recons <- seqTrack(x)
+mean(x.recons$ances==x$ances, na.rm=TRUE) # proportion of correct reconstructions
+
 }
 }
\ No newline at end of file



More information about the adegenet-commits mailing list