richfitz / diversitree

diversitree: comparative phylogenetic analyses of diversification
http://www.zoology.ubc.ca/prog/diversitree
30 stars 9 forks source link

Fix bug with optimizing birth-death models using only branching times #34

Closed jonchang closed 3 years ago

jonchang commented 3 years ago

The documentation suggests that one can optimize a vector of branching times by only passing times = to make.bd or make.yule. However, there are a few bugs that prevent this.

> make.bd(times = 1:3, sampling.f = 0.5)
Error in make.cache.bd(tree, sampling.f, unresolved, times, control) : 
  argument "tree" is missing, with no default

This is fixed by changing the prototypes of make.bd and make.yule.

If we try to pass tree = NULL:

> make.bd(tree = NULL, times = 1:3, sampling.f = 0.5)
Error in check.unresolved.bd(tree, unresolved) : 
  Cannot just specify times when using unresolved clades

This is fixed by adding a guard to see if unresolved = NULL.

jonchang commented 3 years ago

Build passing: https://app.travis-ci.com/github/jonchang/diversitree/builds/234290761