How to perform a Mantel test comparing genetic to geographic distances using R (don't use Arlequin!)

preview_player
Показать описание

This tutorial shows you how to perform a Mantel test to compare the genetic distances to the geographic distances for a group of specimens. You can learn more about these Mantel tests, and what they are for, here:

I also have other tutorials for using Arlequin, but I don't recommend Arlequin for these genetic versus geographic Mantel tests. This is because it is too hard to get the formatting set up. You can do it much more easily in R.

This tutorial uses Rstudio under Ubuntu Linux version 20.04.

This tutorial assumes you already have R and Rstudio installed. See my tutorial for installing those software:

This tutorial assumes you are using Ubuntu Linux version 20.04 as your operating system. If you do not have a computer running Ubuntu, fear not. You can install Ubuntu as a virtual machine within your current operating system. It is all free.
The instructions for Windows computers are here:
The instructions for Mac computers are here (from 0:00 to 5:37):

FYI:
I have made a Linux virtual machine that is pre-configured with population genetics and ecological niche modeling programs. I have made videos explaining how to hook up this virtual machine within your Mac or Windows computer, so that you can start using the pre-configured software without having to install any of them (and even without having to install Ubuntu Linux!).

Рекомендации по теме
Комментарии
Автор

Dear Josh,
I was able to perform this successfully. Earlier in my file I had 10 individual from one place with the same GPS coordinate, because they were collected from the same location. and I had 16 populations like that sharing 16 GPS locations in each population. Later in my file I used only one individual from one location and copied & pasted data over your file. It worked for me.
Thanks for the Tutorial!

nimanthiabeyrathna
Автор

Dear Josh,
thank you so much for your tutorials!
I wanted to know wich model do you use to calculate the genetic distances?

JettrockNroll
Автор

I'm exploring the process of conducting a partial Mantel test to investigate both Isolation by Distance (IBD) and Isolation by Environment (IBE). I'm particularly interested in identifying potential river barriers affecting gene flow and considering them as a control group. Could you please provide guidance on how to prepare the input files required for running these tests? Your insights would be greatly appreciated.
Thank you!

AbidAli-wrdz
Автор

Dear Josh, I got a p- value of 0.268 for my SNPs data therefore, I think don´t have IBD, but I have a dobout, could I plot the results of mantel? Can you help me, please? Thanks

lizetteavila
Автор

Dear sir,
While running mantel test, I got an error message like " xy.mantel <- mantel(x.dist.matrix, y.dist.matrix)
Error in cor(as.vector(xdis), ydis, method = method, use = use) :
missing observations in cov/cor"
I set the working directory as the same folder where the .csv file is saved, and the file is not in a sub folder. The packages geodist, ape, and vegan were installed as per shown in your tutorial.

Could you please help me to solve this problem?

thulasir
Автор

T__T Error in cor(as.vector(xdis), ydis, method = method, use = use) :
missing observations in cov/cor

I got only NaN results in x.dist

eek
Автор

Hi Josh,
I tried doing this, But just wanted to know which format is your Lon and Lat data are? My file is not recognized in R. Please let me know. Thanks !

nimanthiabeyrathna
Автор

What if the sequence file is already in fasta format? Is it alright to skip line 11-13?

nicolephoebevalenzuela