Markov Jump on discrete state transitions

737 views
Skip to first unread message

Antonello Di Nardo

unread,
Feb 10, 2016, 5:07:03 AM2/10/16
to beast-users

Hi, Everyone!

I am currently running some BEAST analyses using discrete phylogeography on a large collection of sequences, for which I am estimating the number of transitions for each discrete trait using the Markov Jump procedure. However, I would like to have some clarification regarding the output provided by BEAST for the MJ location count. I have performed a uniformized run logging and saving the complete MJ history to file.

As I understood but correct me if I am wrong, the location.count parameter expressed in a branch is the mean of the transition counts recorded between parent and child nodes, which is calculated according to the location with max probability from the BSSVS. However, I found it difficult to understand the output of the log file, which return a format of MJ counts as {1, 8.562336, Trait1, Trait2}, which I am guessing that could record 1 MJ at time 8.562336 with transition Trait1 to Trait2.

Please, would you provide me more information about the MJ count output and how to better interpret that
?

Many thanks.
Cheers,

Antonello


P.S. just for the sake of reporting. It seems that the parsed procedure for the MJ count from BEAUTi to the .xml is broken: the run breaks with an error (tested using BEAST 1.8.0 to 1.8.2 and the latest build from github). It seems that the idref for the MJ location.count is not properly defined. As an exmaple, the following code produces an error:

    <!-- Likelihood for tree given discrete trait data                           -->
   
<markovJumpsTreeLikelihood id="location.treeLikelihood" stateTagName="location.states" useUniformization="true" saveCompleteHistory="true" logCompleteHistory="true">
       
<attributePatterns idref="location.pattern"/>
       
<treeModel idref="treeModel"/>
       
<siteModel idref="location.siteModel"/>
       
<generalSubstitutionModel idref="location.model"/>
       
<strictClockBranchRates idref="location.branchRates"/>

       
<!-- The root state frequencies                                              -->
       
<frequencyModel id="location.root.frequencyModel" normalize="true">
           
<generalDataType idref="location.dataType"/>
           
<frequencies>
               
<parameter id="location.root.frequencies" dimension="24"/>
           
</frequencies>
       
</frequencyModel>

       
<!-- START Ancestral state reconstruction                                    -->
       
<parameter id="count" value=" 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.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1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0"
/>

       
<!-- END Ancestral state reconstruction                                      -->

   
</markovJumpsTreeLikelihood>

   
<!-- END Discrete Traits Model                                               -->


Instead, BEAST run happily editing the idref to id="location.count". In addition, the vector parsed identifying the initial MJ count matrix is cut at the decimal place of a transition value (as above), alos producing BEAST to break the run. 

Antonello Di Nardo

unread,
Feb 15, 2016, 8:25:46 AM2/15/16
to beast-users
Hi!

just a follow up on my previous post.

I have tried to run the MJ discrete count reconstruction with the newly released BEAST 1.8.3, but unfortunately BEAST crash again with an error (here posted below - the initial warnings maybe be referred to other issues with this version). As already posted, it seems that the idref for the MJ count matrix is not properly defined (parameter id="count") and the initial count matrix is parsed with a value cut at the decimal place, which produces the error "matrix of wrong dimension". The run seems to work after editing the .xml with the proper definition of idref and values associated with the MJ count matrix

Please, could you provide me any feedback on this and on my previous queries about the MJ output?

Many thanks.

Cheers,

Antonello  


Failed to load parser: dr.inferencexml.trace.GeneralizedHarmonicMeanAnalysisParser

line
= dr.inferencexml.trace.GeneralizedHarmonicMeanAnalysisParser

Loading additional development parsers from development_parsers.properties, which is additional set of parsers only available for development version ...

WARNING
: parser - dr.inferencexml.model.DifferenceParameterParser in development_parsers.properties is duplicated, which is REPLACING the same parser loaded previously.

WARNING
: parser - dr.inferencexml.model.SumParameterParser in development_parsers.properties is duplicated, which is REPLACING the same parser loaded previously.

WARNING
: parser - dr.evomodelxml.operators.SubtreeJumpOperatorParser in development_parsers.properties is duplicated, which is REPLACING the same parser loaded previously.

WARNING
: parser - dr.app.beagle.multidimensionalscaling.MultiDimensionalScalingLikelihood in development_parsers.properties is duplicated, which is REPLACING the same parser loaded previously.
 
Failed to load parser: dr.evomodel.treelikelihood.RootDiscreteStateStatistic

line
= dr.evomodel.treelikelihood.RootDiscreteStateStatistic
 
Failed to load parser: dr.evomodel.epidemiology.casetocase.operators.InfectionBranchGibbsOperator

line
= dr.evomodel.epidemiology.casetocase.operators.InfectionBranchGibbsOperator

..........................................................................................

BEAST has terminated
with an error. Please select QUIT from the menu.

dr
.xml.XMLParseException: Error parsing '<markovJumpsTreeLikelihood>' element with id, 'location.treeLikelihood':

Markov Jumps register parameter count is of the wrong dimension

                at dr
.xml.AbstractXMLObjectParser.parseXMLObject(Unknown Source)

                at dr
.xml.XMLParser.convert(Unknown Source)

                at dr
.xml.XMLParser.convert(Unknown Source)

                at dr
.xml.XMLParser.parse(Unknown Source)

                at dr
.app.beast.BeastMain.<init>(Unknown Source)

                at dr
.app.beast.BeastMain.main(Unknown Source)

Feb 15, 2016 12:35:49 PM dr.app.beast.BeastMain <init>

SEVERE
: Parsing error - poorly formed BEAST file, seqData_BEAST.xml:

Error parsing '<markovJumpsTreeLikelihood>' element with id, 'location.treeLikelihood':

Markov Jumps register parameter count is of the wrong dimension

java
.lang.RuntimeException: Terminate

                at dr
.app.beast.BeastMain.<init>(Unknown Source)

                at dr
.app.beast.BeastMain.main(Unknown Source)
...

Philippe Lemey

unread,
Feb 15, 2016, 9:37:33 PM2/15/16
to beast...@googlegroups.com
Dear Antonello,
Thanks for reporting this — we’ll look into it. Regarding your question about the branch annotation: {1, 8.562336, Trait1, Trait2}
This means that there is a jump at site 1 (there is of course only one site for discrete traits, but this can be useful for nucleotide or codon substitutions as well), at time 8.562336 (before the present) from Trait1 to Trait2.
Best,
Philippe

--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at https://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/d/optout.

Antonello Di Nardo

unread,
Feb 16, 2016, 5:21:01 AM2/16/16
to beast-users
Hi Philippe,


This means that the output provides the timings without the node/branch associated to each event. So, the easy way to extract the posterior probability and node/branch associated to each event should be to traverse the tree.

Thanks for your help!
Cheers,

Antonello
 

Philippe Lemey

unread,
Feb 16, 2016, 7:19:14 AM2/16/16
to beast...@googlegroups.com
This means that the output provides the timings without the node/branch associated to each event. So, the easy way to extract the posterior probability and node/branch associated to each event should be to traverse the tree.

Indeed, one option for this would be the annotatedTreeReader.r function, written by Marc Suchard, in the OutbreakTools package

Best,
P.

Antonello Di Nardo

unread,
Feb 16, 2016, 7:31:39 AM2/16/16
to beast...@googlegroups.com

Great, thanks!

Antonello

yuhan

unread,
May 23, 2016, 12:36:09 PM5/23/16
to beast-users
Hi,

I have the same problem when I'm attempt to run Markov Jumps,The xml file was generated with Beauti v1.8.3,but it always appear an error. I did not find the solution for that, Here is an error:

BEAST has terminated with an error. Please select QUIT from the menu.
dr.xml.XMLParseException: Error parsing '<logTree>' element with id, 'treeFileLog':
Trait named, location.count, not found for MarkovJumpsBeagleTreeLikelihood(treeLikelihood[location.treeLikelihood])
at dr.xml.AbstractXMLObjectParser.parseXMLObject(Unknown Source)
at dr.xml.XMLParser.convert(Unknown Source)
at dr.xml.XMLParser.convert(Unknown Source)
at dr.xml.XMLParser.convert(Unknown Source)
at dr.xml.XMLParser.parse(Unknown Source)
at dr.app.beast.BeastMain.<init>(Unknown Source)
at dr.app.beast.BeastMain.main(Unknown Source)
May 23, 2016 9:40:29 PM dr.app.beast.BeastMain <init>
SEVERE: Parsing error - poorly formed BEAST file, E.xml:
Error parsing '<logTree>' element with id, 'treeFileLog':
Trait named, location.count, not found for MarkovJumpsBeagleTreeLikelihood(treeLikelihood[location.treeLikelihood])
java.lang.RuntimeException: Terminate
at dr.app.beast.BeastMain.<init>(Unknown Source)
at dr.app.beast.BeastMain.main(Unknown Source)

Is it parameters problem?anyone can help me?

Thanks,

Yuhan

在 2016年2月10日星期三 UTC+8下午6:07:03,Antonello Di Nardo写道:

Justin

unread,
May 24, 2016, 12:34:42 PM5/24/16
to beast-users
There's a bug in Beauti. To solve this open your XML file in a text editor (i.e. TextWrangler or Notepad++)

under the MarkovJumpsTreelikelihood block you will find

<parameter id="count"

Change this to 

<parameter id="location.count"

J

yuhan

unread,
May 24, 2016, 9:40:32 PM5/24/16
to beast-users
Dear Justin,
Thank you for your friendly help,it began to run,I am very excitement.

many thanks!

Yuhan

在 2016年5月25日星期三 UTC+8上午12:34:42,Justin写道:
Reply all
Reply to author
Forward
0 new messages