hoehna / TESS

2 stars 1 forks source link

CoMET error: Error in if (max.progress >= 1) { : missing value where TRUE/FALSE needed #2

Open jamie-thompson opened 1 year ago

jamie-thompson commented 1 year ago

I was following the tutorial "Phylogeny Simulation and Diversification Rate Analysis with TESS" and it was going well until a point at which it stopped, returning the error "Error in if (max.progress >= 1) { : missing value where TRUE/FALSE needed"

kopperud commented 1 year ago

Did you install TESS via CRAN, or the github version? They have diverged a bit. Also which part of the tutorial did not work? Can you provide an example how how to reproduce the error?

jamie-thompson commented 1 year ago

Hi, I installed it from CRAN. Which one would you recommend? Sorry about lack of precision... The command below seems to be the problem, but only with the large trees I've analysed (>10000 and >23,000 sps), not with the smaller trees.

tess.analysis(tree, empiricalHyperPriors = TRUE, samplingProbability = samplingFraction, numExpectedRateChanges = numExpectedRateChanges, numExpectedMassExtinctions = numExpectedMassExtinctions, pMassExtinctionPriorShape1 = pMassExtinctionPriorShape1, pMassExtinctionPriorShape2 = pMassExtinctionPriorShape2, MAX_ITERATIONS = 10000, dir = "Run1_comet_hyperpriors")

kopperud commented 1 year ago

I ran this code on a pretty large dataset (11k taxa), using the version of TESS that is on CRAN. It worked without errors. Any chance you can provide the data and more of your script to reproduce the error?

#install.packages("TESS")
library(TESS)
library(ape)

## borrowed from phytools
force.ultrametric<-function(tree){
  h<-diag(vcv(tree))
  d<-max(h)-h
  ii<-sapply(1:Ntip(tree),function(x,y) which(y==x), y=tree$edge[,2])
  tree$edge.length[ii]<-tree$edge.length[ii]+d
  return(tree)
}

## download from https://fishtreeoflife.org/downloads/actinopt_12k_treePL.tre.xz
fishtree <- read.tree("~/Downloads/actinopt_12k_treePL.tre")
fishtree <- force.ultrametric(fishtree)

samplingFraction <- 0.67
numExpectedRateChanges <- 10
numExpectedMassExtinctions <- 1
expectedSurvivalProbability <- 0.05
pMassExtinctionPriorShape2 <- 100
pMassExtinctionPriorShape1 <- - pMassExtinctionPriorShape2 *
  expectedSurvivalProbability /
  (expectedSurvivalProbability - 1)

tess.analysis(fishtree, 
              empiricalHyperPriors = TRUE, 
              samplingProbability = samplingFraction,
              numExpectedRateChanges = numExpectedRateChanges, 
              numExpectedMassExtinctions = numExpectedMassExtinctions, 
              pMassExtinctionPriorShape1 = pMassExtinctionPriorShape1, 
              pMassExtinctionPriorShape2 = pMassExtinctionPriorShape2, 
              MAX_ITERATIONS = 10000,
              dir = "Run1_comet_hyperpriors")
jamie-thompson commented 1 year ago

Thanks for that code, it has worked so far on a tree of 60,000 species. I reinstalled TESS, perhaps I hadn't installed it using CRAN like I thought. Apologies

jamie-thompson commented 1 year ago

additionally, are these generally good starting parameters? I am especially interested in how to effectively set "pMassExtinctionPriorShape2", and whether this should change if my "expectedSurvivalProbability" is 0.25 rather than 0.05.

jamie-thompson commented 1 year ago

I am still receiving the error "Error in if (max.progress >= 1) { : missing value where TRUE/FALSE needed", when running this code. but not in every replicate. what does this mean?

sanderdebacker commented 5 months ago

but not in every replicate. what does this mean?

I've installed it through CRAN and also get this error at random. Sometimes it works, sometimes it doesn't. I work in a conda environment and deactivating and reactivating the environment is the only action that consistently makes the analysis succeed...

jamie-thompson commented 3 months ago

Yeah I still get this error at random sometimes. It just does not like some trees. If I play around with formatting and re-reading it back in, or try different machines, the error doesn't go away very often.