[adegenet-forum] population distances of genlight object

Jombart, Thibaut t.jombart at imperial.ac.uk
Wed Dec 10 16:51:33 CET 2014

Hi there, 

this is no conversion routine from genlight to genpop, so no Reynolds distance. However, Reynolds' distance on SNP may be overly fancy and the basic Euclidean distance between allele frequencies should already do a decent job. To do this, you need to convert the genlight to a matrix of number of second alleles, compute allele frequencies by population, and then use 'dist'.

Here's an example using simulated data:
## simulate genlight
x= glSim(100, 1e3, pop.freq=c(.5,.5))
pop(x) = other(x)$ancestral.pops

## get allele freq for pop x locus
temp=apply(as.matrix(x),2, tapply, pop(x), function(e) mean(e)/ploidy(x)[1]) # assumes same ploidy for all individuals

## compute Euclidean distance


From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Gloria-Soria, Andrea [andrea.gloria-soria at yale.edu]
Sent: 09 December 2014 14:40
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] population distances of genlight object


I am trying to calculate the Reynold's distances between 4 populations of individuals with lots of SNPs (~150,000), I have the data as .vcf, plink, .stru files, and I have been reading them into adegenet as genlight objects (it seems that reading them as a genind object is not possible).

I also know that dist.genpop() can be used to calculate these distances when having a genpop object, but it seems that there is no command to convert a genlight to a genpop (is that true?).

Is there a way around it? or is there a way to get the Reynold's distances between the populations in any other way?

I appreciate your help,
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org

More information about the adegenet-forum mailing list