Jombart, Thibaut t.jombart at imperial.ac.uk
Fri Dec 12 17:17:15 CET 2014

```Thanks Zhian for jumping in and helping.

As a side note, genind2genpop can compute average spatial coordinates of the populations for you, if the geographic coordinates are in a matrix in the @other of your genind object, and if this matrix has exactly one row per individual. See ?genind2genpop, you basically need "process.other=TRUE".

Cheers
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: 12 December 2014 16:09

Hello,

To run a mantel test, the matrices need to be the same size. Dgen in this case, is the distance between populations (not samples). If you have an xy coordinate for each sample, then Dgeo will be much larger than Dgen. If you want to do a mantel test utilizing these distances, you have two options:

1. Calculate Dgen as an individual-based distance.
2. Find the average geographic coordinate for each population and construct Dgeo from those coordinates.

Hope that helps,
Zhian

> Date: Fri, 12 Dec 2014 05:16:01 +0000
> Subject: [adegenet-forum] question regarding error for mantel.randtest
> Message-ID:
>       <DM2PR01MB495FAB95BF97211709422BAF9600 at DM2PR01MB495.prod.exchangelabs.com>
>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello,
>
> I would like to test isolation by distance in my dataset and have tried the following code:
>
> toto <- genind2genpop(genfile,miss="0")
> Dgen <- dist.genpop(toto,method=2)
> Dgeo <- dist(genfile\$other\$xy, method="euclidean")
> object.size(Dgen)
> object.size(Dgeo)
> ibd <- mantel.randtest(Dgen,Dgeo)
> ibd
>
> The data file (genfile) is in a GenAlEx format. However, I get the following error; I think it is related to the size of matrices for Dgen and Dgeo but I am unsure why the sizes would be off, is there something wrong with the code above (I got it from the adegenet tutorials)?
>
>> Error in mantel.rtest(Dgen, Dgeo) : Non convenient dimension
>
> Thank you for your help.
>
> Sunita Y.
> Ph.D. Student
> Univ. of Cincinnati, OH
>
>
> ------------------------------
>
> _______________________________________________