neherlab / treetime

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

TreeTimeUnknownError: Error: Unexpected behavior detected in multiply function when determining peak of function with y-values '[]'. #270

Closed bacterpang closed 1 month ago

bacterpang commented 6 months ago

treetime_issue.tar.gz Hi, I ran TreeTime with 8 different combination of parameters and got normal outputs from 4 of them but failed to do so in the left ones.

For the 4 failed, I got the error messages, which were same as the issue title.

For the 4 that I got normal outputs, the root-to-tip plots did not seem to show a linary regression.

I attached all the files I used and also included the feedback of TreeTime which was name as "slurm-241207.out" .

Could anybody help me with this problem?

Thanks a lot!

rneher commented 6 months ago

thanks a lot for raising this. This like comes down to numerical problems in the marginal time-tree estimation. You are using very long genomes and the this probably triggers some problems in the calculation convolution integrals. if you use a smaller sequence length (like 1000), it might run without problems (also the 4 runs that completed look very odd with lots of negative branch lengths).

bacterpang commented 6 months ago

@rneher Thanks a lot for the comment.
Yes, it's a very large dataset, which contained the SNPs alignment from more than 1000 genomes. Could you please give me some suggestions to solve this problem? Many thanks.

rneher commented 6 months ago

If you don't need confidence intervals, you can simply do

treetime --tree vib_only_rooted.nwk  --sequence-length 2211525 --dates vib_only_genome_year.csv --name-column genome --date-column year --time-marginal never --keep-polytomies  --keep-root  --outdir dating.out_noconf --clock-rate 0.0004 --clock-std-dev 0.0001

This produces sensible output very quickly. The marginal inference needed for confidence estimation seems to struggle with your tree and the case when run without alignment.

bacterpang commented 6 months ago

@rneher Thank you very much for your suggestion. I will try that. Have a nice weekend!

bacterpang commented 6 months ago

@rneher Hi, Richard. I just ran TreeTime with the parameters you provided and it looked quite sensible. I still have 2 questions. The first is how did you decided the values of the clock rate and --clock-std-dev? The second is what I should do if I need the confidence intervals? Should I run TreeTime with the alignment? If so, how can I keep the root I wanted to keep? Lots of questions, thanks for you patience.

bacterpang commented 6 months ago

@rneher

Hi, Richard. I just ran TreeTime with the parameters you provided and it looked quite sensible. I still have 2 questions. The first is how did you decided the values of the clock rate and --clock-std-dev? The second is what I should do if I need the confidence intervals? Should I run TreeTime with the alignment? If so, how can I keep the root I wanted to keep? Lots of questions, thanks for your patience.

rneher commented 1 month ago

sorry about the late reply. I think I gleaned these values from the root-to-tip regression. I didn't do anything fancy.

The confidence interval estimation doesn't work very reliably for your use case of very large datasets. I don't have a good solution for you -- sorry.