[adegenet-forum] seploc resets ploidy information to diploid
Zhian Kamvar
zkamvar at gmail.com
Thu Jun 27 00:05:43 CEST 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20130626/09cb192f/attachment.html>
More information about the adegenet-forum
mailing list