seidels / tidetree

A Bayesian phylogenetic framework to estimate single-cell trees and population dynamic parameters from genetic lineage tracing data
GNU General Public License v3.0
5 stars 0 forks source link

Could not find a proper state to initialize #6

Closed StephenStaklinski closed 4 months ago

StephenStaklinski commented 4 months ago

I have been using TideTree successfully, but noticed that quite a few datasets tend to give this error and I am having trouble locating the source. I have used a more informative starting tree from the Cassiopeia-Greedy maximum parsimony approach, but this does not resolve it. I have also toggled with priors and most other components of the model in the xml file without success. Can you give an indication of what features of the dataset may cause this error? Just for reference, I am running on datasets with 30-50 cells, 10 sites per cell, 50-75 total unique mutation states, and no dropouts (although I could also use guidance on appropriately modeling dropouts in this beast framework for future work).

Error message:

Start likelihood: -Infinity after 10 initialisation attempts P(posterior) = -Infinity (was -Infinity) P(prior) = -836.5626136666004 (was -836.5626136666004) P(birthDeathSamplingModel) = -1068.819501915077 (was -1068.819501915077) P(editRatePrior) = 230.89819172338792 (was 230.89819172338792) P(ClockPrior.c:LTv2_EBd32_cluster_1) = 0.0 (was 0.0) P(birthRatePrior) = -0.25970786608368224 (was -0.25970786608368224) P(deathRatePrior) = 1.618404391172097 (was 1.618404391172097) P(likelihood) = -Infinity (was -Infinity) P(treeLikelihood) = -Infinity (was -Infinity) java.lang.RuntimeException: Could not find a proper state to initialise. Perhaps try another seed. See http://www.beast2.org/2018/07/04/fatal-errors.html for other possible solutions. at beast.base.inference.MCMC.run(MCMC.java:328) at beastfx.app.beast.BeastMCMC.run(BeastMCMC.java:259) at beastfx.app.beast.BeastMain.main(BeastMain.java:465) at feast.app.FeastMain.main(FeastMain.java:92)

seidels commented 4 months ago

Hi @StephenStaklinski sorry for the slow reply! It seems that the tree likelihood is causing the error. You can see that because the P(likelihood) = -Infinity, which is why the initialisation fails.

So we have to dive into the components that feed in the tree likelihood. These are the starting tree, the editing model and the editing model parameters. Usually, I play around with the editHeight and editDuration in the starting tree class. For example, setting the editHeight very close to the rootHeight sometimes helps.

Generally, the idea with the starting state is just that under the model (i.e. the editing model and the tree) you should in principle be able to observe your data. So I also sometimes set the clock rate to what is needed to generate the average number of edits at the leaves after the editing duration.

If this doesn't help feel also free to send me the XML you are using and I can see if I can find the problem.

StephenStaklinski commented 4 months ago

Thank you for the suggestions! After looking more into the model implementation, I was able to solve the issue by realizing I had encoded one edit rate too few when the silencing rate is 0, since I only included edit rates for the edited and unedited states but not the lost state. Fixing this bug seemed to solve the issue.