liamrevell / phytools

GNU General Public License v3.0
207 stars 56 forks source link

Error in describe.simmap #92

Closed takaW496 closed 2 years ago

takaW496 commented 3 years ago

Hi, thank you for the development and maintenance of phytools. We use make.simmap function in our analysis pipeline and functions nicely in most cases. However, in a handful cases, describe.simmap returned summaries with the unexpected number of columns in some lists. I confirmed this behaviour with phytools version 0.7.80 and R version 4.0.2. The R image file with a multiSimmap object is attached for reproducibility. I would appreciate if you could take a look and give me any suggestions. Thank you. phytools_summary.RData.zip

> intron_summary = phytools::describe.simmap(intron_mtrees, plot = FALSE)
> phytools::describe.simmap(intron_mtrees)
100 trees with a mapped discrete character with states:
 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 

Error in colMeans(x$count) : 
  'x' must be an array of at least two dimensions
takaW496 commented 3 years ago

From my last post, it was not clear how intron_mtrees was created, so I attached input files and my code to reproduce the situation including the make.simmap() process. error_example.zip

The attached contains smaller dataset than the previous one for simplicity. This code threw an error at the last step due to unexpected data format in intron_summary$tips and intron_summary$ace that were generated by intron_summary = summary(intron_mtrees, plot=FALSE). describe.simmap(intron_mtrees) also fails with the same error message as the previous post. I would appreciate if you could take a look this error. Thank you.

liamrevell commented 2 years ago

This happened because the summary method didn't anticipate that all the nodes could have PP of 1.0 of being in a single state, as in these data. It's now fixed on GitHub and will be in the next CRAN update.