beast2 icon indicating copy to clipboard operation
beast2 copied to clipboard

Resume problem for monophyletic

Open walterxie opened this issue 10 months ago • 5 comments

It seems there is a bug to resume the XML containing monophyletic clade. The XML to replicate the problem is attached.

Run the XML first and then run beast -resume testP.xml. Check the log that the monophyletic(human-chimp) column was changed to 0 after resuming XML.

Screenshot 2024-04-05 at 3 30 35 PM

testP.log testP.xml.zip

walterxie avatar Apr 05 '24 02:04 walterxie

For a more complex XML using cancer data, we discovered the mrca.age(taxonset.tumour) had -1 after resuming. Not sure this is an additional issue or still the same issue caused by the "monophyletic" boolean value.

Screenshot 2024-04-05 at 4 08 50 PM

walterxie avatar Apr 05 '24 02:04 walterxie

I think the mrca = -1 is the side-effect. That is presumably the value returned when the monophyly can't be found. So I think it is something to do with the taxonset having the wrong node numbers and so both the monophyletic constraint and the MRCA are probably looking for the wrong set of taxa. Curious to find out what is going on here precisely.

alexeid avatar Apr 05 '24 03:04 alexeid

I forget to mention I manually changed the logger of MRCAPrior from the 1st line below into the 2nd one in order to diagnose the issue, because the 2nd line can log the monophyletic boolean value, and it was also used in the XML for cancer data analysis.

<log idref="human-chimp.prior"/>

<log spec='beast.base.evolution.tree.MRCAPrior' tree='@Tree.t:noncoding' taxonset='@human-chimp'/>

walterxie avatar Apr 05 '24 03:04 walterxie

When logging like that, the MRCAPrior in the log may not be updated, since it is not on a path between StateNodes and posterior. This appears to be a logging issue.

Currently, if you want to log a clade of interest, it should be defined as an MRCAPrior inside the prior without monophyly constraint and without node distribution, then add a logger referring to the MRCAPrior. This is what BEAUti would do automatically.

It is a bit curious that for the first run in the example XML, the logged MRCAPrior values are correct, but for the resumed part, it is not, so that is something that might be fixable.

rbouckaert avatar Apr 07 '24 19:04 rbouckaert

Adding

    	calculateLogP();

At line 390 of MRCAPrior fixes this particular issue.

rbouckaert avatar Apr 08 '24 00:04 rbouckaert