[adegenet-forum] adegenet-forum Digest, Vol 76, Issue 7
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".
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
To: adegenet-forum at lists.r-forge.r-project.org
Subject: Re: [adegenet-forum] adegenet-forum Digest, Vol 76, Issue 7
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,
> Date: Fri, 12 Dec 2014 05:16:01 +0000
> From: "Yadav-Pauletti, Sunita (yadavps)" <yadavps at mail.uc.edu>
> To: "adegenet-forum at lists.r-forge.r-project.org"
> <adegenet-forum at lists.r-forge.r-project.org>
> Subject: [adegenet-forum] question regarding error for mantel.randtest
> <DM2PR01MB495FAB95BF97211709422BAF9600 at DM2PR01MB495.prod.exchangelabs.com>
> Content-Type: text/plain; charset="us-ascii"
> I would like to test isolation by distance in my dataset and have tried the following code:
> genfile <- read.genalex(filepath, ploidy=2, geo=TRUE, region=FALSE) #read file
> toto <- genind2genpop(genfile,miss="0")
> Dgen <- dist.genpop(toto,method=2)
> Dgeo <- dist(genfile$other$xy, method="euclidean")
> ibd <- mantel.randtest(Dgen,Dgeo)
> 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
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> End of adegenet-forum Digest, Vol 76, Issue 7
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
More information about the adegenet-forum