<p><strong>Update</strong> I looked into modern use of Mantel's test and it will not accept categorical variables. I now remember the null hypothesis of Mantel's ... the association is random between the matrices, i.e. no genetic structure. Therefore <em>p &lt; 0.05</em> excluding degrees of freedom (so in practice its smaller).</p>
<p>The options are:</p>
<ol>
<li><em>Fst</em> implementing that is easy but interpreting is complicated because it's about what constitutes genetic structure</li>
</ol>
<ul>
<li>this can be done in Arlequin <a href="https://www.youtube.com/watch?v=U2fj3pfPUlE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=U2fj3pfPUlE</a> as a tutorial</li>
<li>Fstat is the more <a href="https://www2.unil.ch/popgen/softwares/fstat.htm" rel="nofollow noreferrer">famous package</a>, but notably old</li>
</ul>
<ol start="2">
<li>General linear modelling;</li>
<li>Machine learning for example random forest, SVM etc ...</li>
</ol>
<p>I would use points 1 and point 3, 2 is old school now. I would use point 1 to datamine the ML.</p>
<p>The key to Fst is that 0.2 comprises population structure for complicated reasons. Implementing ML is not trivial but is the trendiest analysis going. It is not simply implementation its checking and verifying the associations and avoiding overtraining, which would be the major criticism.</p>
<p>The ML would permits the genetic structure to be predicted across broad geographic regions and those predictions are tested and used to reformulate the model. However, you'd need significant expertise in ML (and coding).</p>
<hr />
<p>The technical word for this is <strong>allopatry</strong> and if that doesn't mean much, please do read on the subject because that is central to the theory behind the calculations you are performing. There is a HUGE bank of theory on the subject and is the central alternative to Darwinian selection, yep it's that big. So this is not a passing calculation but a fundamental calculation at the heart of the model of speciation of the organisms within your study. What you want to show is your species does not demonstrate allopatry but niche selection. Ultimately this may not be precisely decipherable (depends on the geographic distances).</p>
<p>Very briefly the analysis to perform now is the <strong>Mantel's test</strong>. This should be within the Arlequin package. Mantel's test will assess if there is a 'cline' in your data, i.e. an association with gene frequency and geographic distance - in an allele frequency package (genetic distance of point mutation otherwise).</p>
<p>Geological data versus geographic distance ... Mantel's test will cover both calculations, however I think that a simple numerical code will be needed for categorical data. I'd need to check that carefully, because I get that wrong the calculation with be wrong. Basically you need to tell the matrix correlation test that this categorical data being tested.</p>
<p>The next level of analysis in allele frequency calculations involves plotting the pairwise (not global) <em>Fst</em> against against geographic distance and geological type - if the association in Mantel's test is not linear. If the association is linear the Mantel's will be positive, i.e. null hypothesis will be accept, <em>p</em> &gt; 0.05.</p>
<p>I'll check the location of the calculations in various packages later (not necessarily today). I need to check the categorical variable for Mantel's - I've never done that calculation so am not sure.</p>
<p><strong>What you are looking for is Mantel's to reject geographic distance and accept geological data type. That would be a decisive and very publishable result.</strong>  <em>Fst</em> will be the fall-back to shift between the hypotheses.</p>
<p>If you have loads of SNPs there are phylogenetic tree solutions based on modelling point mutation. The next layer of biophylo-geographic analysis involves packages within the Beast framework. I'm sure that would work here because the number of mutations would be low, also this is really just geographic distance rather than niche. If you've loads of SNPs this would be a good analysis to perform however, but for intraspecifies mtDNA particularly involving <em>cox</em>1 I personally wouldn't think it would be informative. It is perfectly doable though.</p>
<hr />
<p>A positive Mantel's test is a rare result, but generally allopatry is very common so it is a VERY strong null hypothesis for the data. What I am trying to say is you can't just reject allopatry without testing it. ... well you can but not if you want to publish in e.g. Molecular Ecology.</p>
<p>Good luck with the study and again I'll update the post later. It looks really good and is more than interesting.</p>

CC BY-SA 4.0
2022-12-30T17:48:07.783Z
I forgot to mention in my original post that I did run a mantel's test, and in fact it's results are what prompted me to check geographical data in the first place. For two of my 4 species there was no correlation between genetic and geographical distance (p value>0.05) , so my thought process is that diversity comes from other geological factors.
Nickmofoe
CC BY-SA 4.0
2022-12-30T19:09:48.037Z
I did the test in R using the packages ape vegan and geodist, due to not wanting to complicate things even more with arlequin. I am pretty sure the p value needs to be above 0.005 for it to be significant but I might be wrong.
Nickmofoe
CC BY-SA 4.0
2022-12-30T19:20:29.417Z
@Nickmofoe I've answered the question, as far as I practically can.
M__
CC BY-SA 4.0
2022-12-30T14:58:55.097Z
2022-12-30T19:23:02.563Z
2022-12-30T19:23:02.563Z
M__
<p>So I have ran SAMOVA and made calculations regarding haplotype diversity and nucleotide diversity of several populations. I have also made raster data regarding geographical data like slope, ruggedness etc. Is there a program/package that allows me to combine these to types of data into a map, so I can study if there is a correlation between these indexes and the diversity?</p>

<phylogenetics><geo><populations>
Is there a way I can combine geological data with population genetics data?
# Is there a way I can combine geological data with population genetics data?

(Asked by: username_0 on 2022-12-30)

So I have ran SAMOVA and made calculations regarding haplotype diversity and nucleotide diversity of several populations. I have also made raster data regarding geographical data like slope, ruggedness etc. Is there a program/package that allows me to combine these to types of data into a map, so I can study if there is a correlation between these indexes and the diversity?

**Tags:** phylogenetics, geo, populations

---

## 1 answers

### Answer by username_1 on 2022-12-30. Score: 1 | Accepted answer

**Update** I looked into modern use of Mantel's test and it will not accept categorical variables. I now remember the null hypothesis of Mantel's ... the association is random between the matrices, i.e. no genetic structure. Therefore *p < 0.05* excluding degrees of freedom (so in practice its smaller).

The options are:

1. *Fst* implementing that is easy but interpreting is complicated because it's about what constitutes genetic structure

* this can be done in Arlequin <https://www.youtube.com/watch?v=U2fj3pfPUlE> as a tutorial
* Fstat is the more [famous package](https://www2.unil.ch/popgen/softwares/fstat.htm), but notably old

2. General linear modelling;
3. Machine learning for example random forest, SVM etc ...

I would use points 1 and point 3, 2 is old school now. I would use point 1 to datamine the ML.

The key to Fst is that 0.2 comprises population structure for complicated reasons. Implementing ML is not trivial but is the trendiest analysis going. It is not simply implementation its checking and verifying the associations and avoiding overtraining, which would be the major criticism.

The ML would permits the genetic structure to be predicted across broad geographic regions and those predictions are tested and used to reformulate the model. However, you'd need significant expertise in ML (and coding).

---

The technical word for this is **allopatry** and if that doesn't mean much, please do read on the subject because that is central to the theory behind the calculations you are performing. There is a HUGE bank of theory on the subject and is the central alternative to Darwinian selection, yep it's that big. So this is not a passing calculation but a fundamental calculation at the heart of the model of speciation of the organisms within your study. What you want to show is your species does not demonstrate allopatry but niche selection. Ultimately this may not be precisely decipherable (depends on the geographic distances).

Very briefly the analysis to perform now is the **Mantel's test**. This should be within the Arlequin package. Mantel's test will assess if there is a 'cline' in your data, i.e. an association with gene frequency and geographic distance - in an allele frequency package (genetic distance of point mutation otherwise).

Geological data versus geographic distance ... Mantel's test will cover both calculations, however I think that a simple numerical code will be needed for categorical data. I'd need to check that carefully, because I get that wrong the calculation with be wrong. Basically you need to tell the matrix correlation test that this categorical data being tested.

The next level of analysis in allele frequency calculations involves plotting the pairwise (not global) *Fst* against against geographic distance and geological type - if the association in Mantel's test is not linear. If the association is linear the Mantel's will be positive, i.e. null hypothesis will be accept, *p* > 0.05.

I'll check the location of the calculations in various packages later (not necessarily today). I need to check the categorical variable for Mantel's - I've never done that calculation so am not sure.

**What you are looking for is Mantel's to reject geographic distance and accept geological data type. That would be a decisive and very publishable result.** *Fst* will be the fall-back to shift between the hypotheses.

If you have loads of SNPs there are phylogenetic tree solutions based on modelling point mutation. The next layer of biophylo-geographic analysis involves packages within the Beast framework. I'm sure that would work here because the number of mutations would be low, also this is really just geographic distance rather than niche. If you've loads of SNPs this would be a good analysis to perform however, but for intraspecifies mtDNA particularly involving *cox*1 I personally wouldn't think it would be informative. It is perfectly doable though.

---

A positive Mantel's test is a rare result, but generally allopatry is very common so it is a VERY strong null hypothesis for the data. What I am trying to say is you can't just reject allopatry without testing it. ... well you can but not if you want to publish in e.g. Molecular Ecology.

Good luck with the study and again I'll update the post later. It looks really good and is more than interesting.

> **Comments:**
> **username_0**: I forgot to mention in my original post that I did run a mantel's test, and in fact it's results are what prompted me to check geographical data in the first place. For two of my 4 species there was no correlation between genetic and geographical distance (p value>0.05) , so my thought process is that diversity comes from other geological factors.  
> **username_0**: I did the test in R using the packages ape vegan and geodist, due to not wanting to complicate things even more with arlequin. I am pretty sure the p value needs to be above 0.005 for it to be significant but I might be wrong.  
> **username_1**: @Nickmofoe I've answered the question, as far as I practically can.  

---

