<div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>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:<br>
<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><span style="font-family:courier new,monospace">> temp <- lapply(1:30, function(i) sample(1:9, 4, replace=TRUE))</span><br>
<span style="font-family:courier new,monospace">> temp <- sapply(temp, paste, collapse="")</span><br><span style="font-family:courier new,monospace">> temp <- matrix(temp, nrow=10, dimnames=list(paste("ind",1:10), paste("loc",1:3)))</span><br>
<span style="font-family:courier new,monospace">> obj <- df2genind(temp, ploidy=4, sep="")</span><br><span style="font-family:courier new,monospace"></span></blockquote></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<span style="font-family:courier new,monospace">> objloc <- seploc(obj)</span><br><span style="font-family:courier new,monospace">> sapply(objloc, ploidy)</span><br><span style="font-family:courier new,monospace">loc 1 loc 2 loc 3</span><br>
<span style="font-family:courier new,monospace">    2     2     2</span><br><span style="font-family:courier new,monospace">> ploidy(obj)</span><br><span style="font-family:courier new,monospace">[1] 4</span><br><span style="font-family:courier new,monospace"></span></blockquote>
</div></div><span style="font-family:courier new,monospace"><br></span></div>I<span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif"> went into the adegent source code and found where the trouble was. It's on line 99 of "handling.R":<br>
</span></span><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif"><span style="font-family:courier new,monospace"><br></span></span></span><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif"><span style="font-family:courier new,monospace">kX <- lapply(kX, genind, pop=x@pop, prevcall=prevcall)</span></span></span><br>
</blockquote><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif"></span></span><blockquote><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif"></span></span></blockquote>
<div><div><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">To preserve ploidy, I think this line should be:<br><span style="font-family:courier new,monospace"><br></span></font></span><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif"><span style="font-family:courier new,monospace">kX <- lapply(kX, genind, pop=x@pop, prevcall=prevcall, ploidy = x@ploidy)</span></font></span><br>
<span style="font-family:courier new,monospace"></span></blockquote><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif"><br></font></span></div><div><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">Can this be implemented in the next version of adegenet?<br>
<br></font></span></div><div><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">Thanks,<br></font></span></div><div><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">Zhian N. Kamvar<br>
</font></span></div></div></div>