[adegenet-forum] seploc resets ploidy information to diploid
Jombart, Thibaut
t.jombart at imperial.ac.uk
Fri Jun 28 12:26:34 CEST 2013
Dear Zhian,
many thanks for spotting this! I'll make the change straight away, and the next release of adegenet will incorporate it. Meanwhile, the fixed devel version will be available from sourceforge:
https://sourceforge.net/projects/adegenet/?source=directory
Best
Thibaut
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Zhian Kamvar [zkamvar at gmail.com]
Sent: 26 June 2013 23:05
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] seploc resets ploidy information to diploid
Hello,
I was working on some analyses dealing with polyploids, and I noticed that seploc resets the ploidy information of each locus to diploid, regardless of initial ploidy. For a simplified example, here's your example from the adegenet-basics.pdf:
> temp <- lapply(1:30, function(i) sample(1:9, 4, replace=TRUE))
> temp <- sapply(temp, paste, collapse="")
> temp <- matrix(temp, nrow=10, dimnames=list(paste("ind",1:10), paste("loc",1:3)))
> obj <- df2genind(temp, ploidy=4, sep="")
> objloc <- seploc(obj)
> sapply(objloc, ploidy)
loc 1 loc 2 loc 3
2 2 2
> ploidy(obj)
[1] 4
I went into the adegent source code and found where the trouble was. It's on line 99 of "handling.R":
kX <- lapply(kX, genind, pop=x at pop, prevcall=prevcall)
To preserve ploidy, I think this line should be:
kX <- lapply(kX, genind, pop=x at pop, prevcall=prevcall, ploidy = x at ploidy)
Can this be implemented in the next version of adegenet?
Thanks,
Zhian N. Kamvar
More information about the adegenet-forum
mailing list