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

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • Please consider subscribing to my channel by hitting the "Subscribe" button. It is absolutely free and there are no charges. But if you like what I am doing and you do want to support my channel, consider making a voluntary donation at / joshbanta . It helps me to deliver more content and to keep this channel active.
    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:
    www.nature.com...
    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:
    • How to install R and R...
    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:
    • Install Ubuntu on Virt...
    The instructions for Mac computers are here (from 0:00 to 5:37):
    • How to Install Windows...
    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!).
    Windows: • Ubuntu 20.04 virtual m...
    Mac: • Ubuntu 20.04 virtual m...

КОМЕНТАРІ • 16

  • @nimanthiabeyrathna1609
    @nimanthiabeyrathna1609 2 роки тому +1

    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!

  • @AbidAli-wr6dz
    @AbidAli-wr6dz 10 місяців тому

    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!

  • @lizetteavila3548
    @lizetteavila3548 Рік тому

    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

  • @murilosilveirayoutube
    @murilosilveirayoutube 2 роки тому +1

    Obrigado pelo conteúdo!

  • @thulasir9448
    @thulasir9448 Рік тому

    Dear sir,
    While running mantel test, I got an error message like " xy.mantel

  • @nimanthiabeyrathna1609
    @nimanthiabeyrathna1609 2 роки тому +1

    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 !

    • @DrJBanta
      @DrJBanta  2 роки тому +2

      Dear Nimanthi, the coordinate system shouldn't matter. Try using the geography file from my tutorial and literally copying and pasting your coordinates on top of it.

    • @catarinadebettencourteavil7703
      @catarinadebettencourteavil7703 2 роки тому

      @@DrJBanta Dear Professor Banta,
      I had the same problem. The problem seems to be in the csv. I have tried your suggestion and it still did not work.
      The error "Error in cor(as.vector(xdis), ydis, method = method, use = use) : missing observations in cov/cor" appears. I will to read more about it and if I find a solution I will write here in the comments.
      Thank you so much for all these tutorials.
      Best wishes

    • @DrJBanta
      @DrJBanta  2 роки тому

      @@catarinadebettencourteavil7703 Dear Catarina, what errors are you getting? Are you sure that you have the packages geodist, ape, and vegan installed? Highlight those lines of code, one at a time, to be sure. Those are lines 3, 4, and 5. Be sure to highlight each of those lines without highlighting the ## symbols, and then hit run. The next issue could be that you did not properly set the working directory. Did you set the working directory to the folder where you have the csv files? Please keep in mind that the files cannot be in subfolders. They have to be exactly in the folder that you set as your working directory. I hope this helps. I have tried running the script on my Mac, Windows 10, and Linux machines and it has been working. Best of luck. -Josh

    • @eek1452
      @eek1452 Рік тому

      @@catarinadebettencourteavil7703 could you solve it? thanks ... I got only NaN results in x.dist

  • @eek1452
    @eek1452 Рік тому

    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

  • @nicolephoebevalenzuela1322
    @nicolephoebevalenzuela1322 4 місяці тому

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

    • @DrJBanta
      @DrJBanta  4 місяці тому

      No, you must run lines 11 - 13. Also, your data must be in FASTA format for this tutorial anyway. Best, Josh

    • @nicolephoebevalenzuela1322
      @nicolephoebevalenzuela1322 3 місяці тому

      @@DrJBanta Thank you that helped a lot! However when I ran the code using my own files it resulted in this error Error in cor(as.vector(xdis), ydis, method = method, use = use) : missing observations in cov/cor. I tried to look for any missing values but couldn't find anything out of the ordinary.

    • @DrJBanta
      @DrJBanta  3 місяці тому

      @@nicolephoebevalenzuela1322 Dear Nicole, were you able to get the tutorial to run using the same data? Have you compared your data to the sample data? Best, Josh

  • @alexandreviniciusdelimamar4380
    @alexandreviniciusdelimamar4380 10 місяців тому

    tks!