neherlab / treetime

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

Question about branch length in mugration #271

Open Tonny-zhou opened 8 months ago

Tonny-zhou commented 8 months ago

Hello TreeTime team,

I've been using TreeTime to reconstruct ancestral states across different branches of a phylogenetic tree, and I've encountered an issue that I wanted to bring to your attention. It appears that when the input tree has branch lengths smaller than 1E-5 (I'm not entirely sure about the exact threshold), the branch lengths in the output annotate.nexus file are rounded to 0. For example, a branch length of 4.3E-6 seems to be rounded down to 0.

I suspect this might be due to rounding or precision limitations in the way TreeTime handles small numerical values. I'm concerned about how this might affect both the reconstruction process and the visualization of the results. Small branch lengths being rounded to 0 could potentially obscure meaningful evolutionary relationships and timescales in the tree.

Could you please advise on whether this rounding behavior might impact the ancestral state reconstruction process? Additionally, would scaling up the branch lengths in the input tree by a fixed multiplier be a recommended workaround for this issue? For instance, multiplying all branch lengths by 10^6 to shift the scale and avoid the small number rounding.

I appreciate your guidance on this matter and any suggestions you might have for handling small branch lengths in TreeTime.

Thank you for your time and for developing such a valuable tool.

Best regards, Tonny

rneher commented 3 months ago

In some modes, TreeTime collapses branches that are not supported. But the output should generally have either 6 or 8 digits precision, depending on the length of the genome being used. In the mugration step, there is typically no genome and this might be restrict the precision to 6 digits. I have increased precision a bit. Hopefully this fixes your problem.