[adegenet-forum] Resampling loci from a large genlight

David Dayan snook91901 at gmail.com
Thu Oct 22 18:34:55 CEST 2015

Hi all,

I'm looking to sample loci from a single population in a large genlight
object (13850 loci, 872 diploid individuals), and convert this genlight
information to a genind object (to use across other packages/adegenet

Simulated example (calculating He using the Hs() function from 100 sampled

> simdata<-glSim(10,500, ploidy=2)
> pop(simdata)<-rep(c("a","b"),5)
> Hs(df2genind(as.data.frame(seppop(simdata)$a[,sample(1:500,

This is problematic because the df2genind(as.data.frame(genlight)) method
doesn't seem to work for diploid data (see below).

> head(sim2sampled_genind at tab)

This produces a genind that stores data as binary and therefore cannot
represent my actual data (diploid + missing data).

I realize that starting from a genind object and using the @tab slot will
solve this, but resampling from a genind this size is exceptionally slow
and my ultimate goal is to work this script into a bootstrapping procedure:

So, (a) any advice on converting genlight to genind for diploid data? or
(b) is there a better way to sample loci for bootstrapping that is
computationally efficient/fast?


David Dayan
Rosenstiel School of Marine and Atmospheric Science
University of Miami
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20151022/459ae956/attachment.html>

More information about the adegenet-forum mailing list