neherlab / treetime

Maximum likelihood inference of time stamped phylogenies and ancestral reconstruction
MIT License
224 stars 55 forks source link

fix: regularize mutation rate calculation #255

Closed rneher closed 1 year ago

rneher commented 1 year ago

The GTR inference was failing when there were no mutations on the tree, i.e. the entire alignment consisted of identical sequences. In that case, there is not data to estimate a model. But the pseudo-count in the GTR inference should in principle then simply result in a flat JC-type model. However, the rate calculation wasn't properly regularized with pseudocounts and ended up being zero, leading to a division by 0 and subsequent NaN type errors.

fixes: https://github.com/neherlab/treetime/issues/253