Hi all,
I am attempting to sample ancestral states for a sequence of
morphological characters (binary) evolving under a lewisMk
model, with some unknown states.
I can run the analysis just fine until I add the ancestral
state reconstruction code.
The key bits of XML here are:
[...defining the character evolution model...]
<lewisMk id="lewis_un_2_Model">
<frequencies>
<FrequencyModel idref="morph_2_Model"/>
</frequencies>
</lewisMk>
[...define the likelihood of that data on the tree...]
<ancestralTreeLikelihood id="morph.un2.treeLikelihood"
useAmbiguities="true" stateTagName="morph.un2.states">
<patterns idref="morph_un2.patterns"/>
<treeModel idref="treeModel"/>
<siteModel idref="morph_un2.siteModel"/>
<discretizedBranchRates idref="branchRates"/>
<lewisMk idref="lewis_un_2_Model"/>
</ancestralTreeLikelihood>
[...log the ancestral states...]
<!-- START Ancestral state reconstruction -->
<trait name="morph.un2.states" tag="morph.un2.state">
<ancestralTreeLikelihood idref="morph.un2.treeLikelihood"/>
</trait>
<!-- END Ancestral state reconstruction -->
Problems that arise:
1. When I run this on BEAST 1.7.3 WITHOUT Beagle, I get:
======================
[...]
TreeLikelihood(treeModel) using Java general likelihood core
Using ambiguities in tree likelihood.
With 223 unique site patterns.
Branch rate model used: discretizedBranchRates
Ancestral reconstruction using ambiguities is currently not
support without BEAGLE
[crash]
======================
2. But when I run WITH Beagle turned on, I get:
=============================
[...]
Using discretized relaxed clock model.
over sampling = 1
parametric model = logNormalDistributionModel
rate categories = 70
Creating state frequenciesParsing error - poorly formed
BEAST file,
v13a_BDserial_onlyGreatApes_noDNA_add_tip_sampling4.xml:
The '<lewisMk>' element with id, 'lewis_un_2_Model', is
incorrectly constructed.
The following was expected:
Exactly one ELEMENT of name frequencies REQUIRED containing
Exactly one ELEMENT of type FrequencyModel REQUIRED
model 'null': Initial frequencies = {0.5, 0.5}
Creating state frequencies model 'null': Initial frequencies
= {0.33333, 0.33333, 0.33333}
Creating state frequencies model 'null': Initial frequencies
= {0.25, 0.25, 0.25, 0.25}
Creating state frequencies model 'null': Initial frequencies
= {0.2, 0.2, 0.2, 0.2, 0.2}
BEAST has terminated with an error. Please select QUIT from
the menu.
=============================
The second error occurs despite the fact that the lewisMk
model is specified just as required (see above) and the
identical XML works fine in non-state-reconstruction analyses.
It looks like the problem is also noted on CIPRES:
http://www.phylo.org/index.php/help/error_messages/#beastbeagle
3. Just for kicks I also tried running ancestral state
reconstruction with beagle off, AND changing to
"useAmbiguities=false". This gave a hard crash:
=============================
Branch rate model used: discretizedBranchRates
Creating swap operator for parameter branchRates.categories
(weight=10.0)
Likelihood computation is using an auto sizing thread pool.
Creating the MCMC chain:
chainLength=100000000
autoOptimize=true
autoOptimize delayed for 1000000 steps
# BEAST v1.7.3, rr5146
# Generated Mon Aug 20 19:25:37 PDT 2012 [seed=1345515937166]
state Posterior Prior Likelihood Root Height
Rate
0 -3316.5324 -313.3966 -3003.1358 32.95
1.00000 -
Exception in thread "Thread-2" java.lang.RuntimeException:
Reconstruction not implemented for multiple categories yet.
at
dr.evomodel.treelikelihood.AncestralStateTreeLikelihood.traverseSample(Unknown
Source)
at
dr.evomodel.treelikelihood.AncestralStateTreeLikelihood.traverseSample(Unknown
Source)
at
dr.evomodel.treelikelihood.AncestralStateTreeLikelihood.redrawAncestralStates(Unknown
Source)
at
dr.evomodel.treelikelihood.AncestralStateTreeLikelihood.getStatesForNode(Unknown
Source)
at
dr.evomodel.treelikelihood.AncestralStateTreeLikelihood$1.getTraitString(Unknown
Source)
at
dr.evomodelxml.tree.TreeLoggerParser$2.getTraitString(Unknown Source)
at dr.evolution.tree.Tree$Utils.writeTreeTraits(Unknown Source)
at dr.evolution.tree.Tree$Utils.newick(Unknown Source)
at dr.evolution.tree.Tree$Utils.newick(Unknown Source)
at dr.evolution.tree.Tree$Utils.newick(Unknown Source)
at dr.evolution.tree.Tree$Utils.newick(Unknown Source)
at dr.evolution.tree.Tree$Utils.newick(Unknown Source)
at dr.evomodel.tree.TreeLogger.log(Unknown Source)
at dr.inference.mcmc.MCMC$1.currentState(Unknown Source)
at
dr.inference.markovchain.MarkovChain.fireCurrentModel(Unknown Source)
at dr.inference.markovchain.MarkovChain.runChain(Unknown Source)
at dr.inference.mcmc.MCMC.chain(Unknown Source)
at dr.inference.mcmc.MCMC.run(Unknown Source)
at java.lang.Thread.run(Thread.java:680)
=============================
...which may be due to having ambiguities in the data but
saying "useAmbiguities=false" anway.
The above problems may just be "stuff that hasn't been
implemented yet", but I figured I should summarize my
findings to help the google-ability of this issue for
others, and/or to find out/hope that the wonderful BEAST
developers have something in the works to cover this.
(Or maybe I missed something obvious.)
Cheers!
Nick