سؤال

I'm analysing protein data sets. I'm trying to build a tree with the package phangorn in R. When I construct it, I get negative edge lengths that sometimes makes difficult to proceed with the analysis (modelTest). Depending on the size of the dataset (more than 250 proteins), I can't perform a modelTest. Apparently there is a problem due to negative edge lengths. However, for shorter datasets I can perform a modelTest even though there are some negative edge lengths. I am runing it directly from my terminal.

library(phangorn)
dat = read.phyDat(file, format="fasta", type="AA")
tax <- read.table("organism_names.txt", sep="\t", row.names=1)
names(dat) <- tax[,1]
distance <- dist.ml(dat, model="WAG")
tree <- bionj(distance)
mt <- modelTest(dat, tree, model=c("WAG", "LG", "cpREV", "mtArt", "MtZoa", "mtREV24"),multicore=TRUE)

    Error: NA/NaN/Inf in foreign function call (arg 1)
    In addition: Warning message:
    In pml(tree, data) : negative edges length changed to 0!

Does somebody have any idea of what can I do?

cheers, Alba

هل كانت مفيدة؟

المحلول

As @Marc said, your example isn't really reproducible...

If the problem really is negative or zero branch lengths, you could try to make them a really small positive number, for instance:

tree$edge.length[which(tree$edge.length <= 0)] <- 0.0000001

Another tip is to subscribe to R-sig-phylo, a mail list about phylogenies in R. People there are really knowledgeable an usually respond pretty fast.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top