Written by Oscar Mira FILES R script: fourth_genetic_divers.R input file: lizards_SNP_input.str Excel table: Linear_regression_geography.xlsx You should only need the script and the input file (fourth_genetic_divers.R, and lizards_SNP_input.str respectively) Read the script carefully, and follow it up till the end. There is three points on the script in which you will use cat() to generate a file with your results, that file will appear in your working directory. In case you have any problem with that I provided you the files I generated with the same commands: ExpectedHeteroz_pop.txt PairFst.txt AlleleNumber_pp.txt There is an Excel file in which you can add the Fst values, heterozygosities, and Allelic richness values paste them in the grey areas of the table. there is two ways to deal with them: 1) You may paste the content of the file on excel, try first in an empty sheet it will all be pasted in the same column, but you should be able to separate it: select column with the data, click on the "Data" tab in excel Text to columns > Fixed width > Next delimit the columns and you should have it ready. Once properly separated in excel just paste the values in their corresponding position (areas of the excel file to be filled up are in grey) 2) Otherwise you can just type yourself the values in excel or paste one by one from the txt file in their place The more tricky data to input is the genetic distances as they are in matrix format, not in a list For example this first value PodMrcaru PodKopiste 0.08592786 is the Fst value between Pod Mrčaru and Pod Kopište (PK-PM and/or PM-PK) Once all the grey values are introduced you will see how the dots appear in the plots a regression line will appear with the R^2, this is the regression coefficient the closer to 1 the more strong is the correlation. Finally you have the coordinates from the islands, the idea was to use the Fst values to see the Isolation by Distance But as I was not sure about you calculating this by yourselves I already calculated the geographic distances EXTRA If you are curious click on the cell and then on the formula bar above (fx) you will see which values were used =SQRT(((E4-E5)^2)+((F4-F5)^2)) this is just an extension of Pythagoras' theorem https://www.bbc.co.uk/bitesize/guides/zq8x8mn/revision/3 Basically if you have a point/population A with coordinates Xa and Ya, and a point/population B with coordinates Xb and Yb their distance will be the hypotenuse of the distances between their X and Y coordinates: Square root of ( Xa - Xb)^2 + ( Ya - Yb )^2 ) Just paste the Fst values (genetic distances) corresponding to each pair geographic distance to see the correlation Then we discuss