0

I've tried to perform a genetic distance analysis using ape and vegan. First of all I calculated genetic distances using ape:

data<-read.dna(file = "proof.txt", format = 'fasta')
D <- dist.dna(data, model ='TN93', as.matrix ='TRUE')

this code gives me a huge matrix with d = 0 in many cases. Then, I perform the mst as follows:

mst <-spantree(distances, toolong = 0.015) 

I chose toolong to select the max parwise distances = 0.015

But when I've tried to plot it, this error apeared:

error in FUN 8d, y):zero or negative distances between objects 1 and 2

Does anyone know how to choose the distances larger than "0" and >= than 0.015?

techraf
  • 64,883
  • 27
  • 193
  • 198
Mia Lua
  • 157
  • 1
  • 11

1 Answers1

0

Supply a configuration on which to plot the spanning tree.

The error message comes from function MASS::sammon() that is used to find a configuration of points if none is given, and that function does not accept zero distances. For instance, the following should work:

plot(mst, ord = cmdscale(as.dist(dist.dna)))
Jari Oksanen
  • 3,287
  • 1
  • 11
  • 15