0
votes

I have a fst value (molecular distance indices) between population (which is not calculate from molecular data, original raw data is misiing) but I have got environmental data and location (including lon and lat) I would like to use Mantel test (r is better)to conduct correlation of these distance matrix. However, I cannot got packages go through and it seems problem is on fst table I made a csv table as below

1 2 3 4 5 6

0.0282 0 0.0266 0.5122 0.4784 0.5553

0.057 0.0266 0 0.4426 0.4042 0.5448

0.318 0.5122 0.4426 0 0.4527 0.6017

0.3412 0.4784 0.4042 0.4527 0 0.4171

0.4462 0.5553 0.5448 0.6017 0.4171 0

And I use the code to import or calculate the dist matrix

library(ade4)
setwd(choose.dir())
df = read.table("hynobins_climate.csv", header= T,sep=",")
station.dists <- dist(cbind(df$lon, df$lat))
#This works fine for calculation of geo distance

fst=read.table("mtFst.csv",header=T)
mantel.rtest(station.dists, fst, nrepet = 9999)

It returns error message : Error in mantel.rtest(station.dists, fst, nrepet = 9999) : Object of class 'dist' expected

How could I conduct my mantel test while I only have calculated fst instead of raw data (and I can conduct suite packages to generate molecular distance matrix.

1

1 Answers

1
votes

My final solution is "to create a matrix by my self"

cbind(c(0,0.024,    0.0414, 0.9565, 0.9802, 1),c(0.024,0,0.0403,0.9515,0.9766,0.9979),c(0.414,0.403,0,0.9396,0.9643,0.9928)........
fst[upper.tri(fst,diag=TRUE)] <- NA
fst<-as.dist(fst)

Then it works~!