[adegenet-commits] r1111 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Apr 12 16:17:53 CEST 2013
Author: jombart
Date: 2013-04-12 16:17:53 +0200 (Fri, 12 Apr 2013)
New Revision: 1111
Modified:
pkg/R/haploGen.R
Log:
Fixed haploGen bug -- see below:
Dear Haiyin,
sorry for the late reply, but I was in various meetings / workshop over the past days. This is a bug, thanks for reporting it. Please find attached a patch fixing it. It will be in adegenet's next release (1.3-8).
Best
Thibaut
--
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
St Mary?\226?\128?\153s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jombart at imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/
________________________________________
From: Chen, Haiyin [chen63 at llnl.gov]
Sent: 09 April 2013 06:22
To: Jombart, Thibaut
Subject: question on haploGen
Hi Dr. Jombart,
I am trying to use haploGen by following the example on seqTrack here:
http://www.inside-r.org/packages/cran/adegenet/docs/plotSeqTrack
But when I specified seq.length=1e4, I am getting a result with length 1e8. When I specified seq.length=1e3, I am getting sequences of length 1e6. It appears that the function is generating sequences that are squares of the specified length:
dat=haploGen(seq.length=56,mu.transi=1e-3,mu.transv=5e-4,repro=function( {sample(1:4,1)},gen.time=1,t.max=3)
> dim(dat$seq)
[1] 20 3136
> 56*56
[1] 3136
Furthermore, it appears dat$seq is 56 identical copies of a 56-bp sequence. Is this expected behavior?
Thanks for your help.
Haiyin
Modified: pkg/R/haploGen.R
===================================================================
--- pkg/R/haploGen.R 2013-04-10 09:16:28 UTC (rev 1110)
+++ pkg/R/haploGen.R 2013-04-12 14:17:53 UTC (rev 1111)
@@ -233,8 +233,7 @@
## PERFORM SIMULATIONS - NON SPATIAL CASE ##
if(!geo.sim){
## initialization
- res$seq <- as.matrix(seq.gen())
- res$seq <- matrix(rep(res$seq, ini.n), byrow=TRUE, nrow=ini.n)
+ res$seq <- matrix(rep(seq.gen(), ini.n), byrow=TRUE, nrow=ini.n)
class(res$seq) <- "DNAbin"
rownames(res$seq) <- 1:ini.n
res$dates[1:ini.n] <- rep(0,ini.n)
@@ -270,8 +269,7 @@
}
## initialization
- res$seq <- as.matrix(seq.gen())
- res$seq <- matrix(rep(res$seq, ini.n), byrow=TRUE, nrow=ini.n)
+ res$seq <- matrix(rep(seq.gen(), ini.n), byrow=TRUE, nrow=ini.n)
class(res$seq) <- "DNAbin"
rownames(res$seq) <- 1:ini.n
res$dates[1:ini.n] <- rep(0,ini.n)
More information about the adegenet-commits
mailing list