I have a distance matrix generated by hierfstat, thusly, with a link to the fasta file here:
library(adegenet)
library(hierfstat)
snps <- fasta2DNAbin('test.fa', chunkSize = 50)
gi <- DNAbin2genind(snps)
# manually define the populations for passing to pairwise.fst
p <- c('Botswana', 'Botswana', 'Botswana', 'Botswana', 'France', 'France', 'Vietnam', 'Vietnam', 'Uganda', 'Uganda', 'Uganda', 'Uganda', 'Vietnam', 'Vietnam', 'Laos', 'Laos', 'Laos', 'Vietnam', 'Vietnam', 'Vietnam', 'Vietnam', 'Vietnam')
f <- pairwise.fst(gi, p, res.type = c('dist', 'matrix'))
as.matrix(f)
which produces
1 2 3 4 5
1 0 0.2189008 0.225567409 0.1821518 0.259409722
2 0.2189008 0 0.130736953 0.1648034 0.191050772
3 0.2255674 0.130737 0 0.1669077 0.006396789
4 0.1821518 0.1648034 0.166907683 0 0.203931457
5 0.2594097 0.1910508 0.006396789 0.2039315 0
Is it safe to assume that 1 = Botswana, 2 = France, 3 = Vietnam, 4 = Uganda and 5 = Laos? i.e. that the distance matrix rows/columns follow the order that each population first appeared in p
?
Is there a way to determine for certain, which row/column in the distance matrix corresponds to which population?