use of dr.evomodel.operators.TreeBitRandomWalkOperator in project beast-mcmc by beast-dev.
the class TreeBitRandomWalkOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
DefaultTreeModel treeModel = (DefaultTreeModel) xo.getChild(DefaultTreeModel.class);
String trait1 = null;
String trait2 = null;
if (xo.hasAttribute(INDICTATOR_TRAIT))
trait1 = xo.getStringAttribute(INDICTATOR_TRAIT);
if (xo.hasAttribute(TRAIT2))
trait2 = xo.getStringAttribute(TRAIT2);
int k = xo.getAttribute("k", 1);
boolean swapTrait2 = xo.getAttribute(SWAP_TRAIT2, true);
return new TreeBitRandomWalkOperator(treeModel, trait1, trait2, weight, k, swapTrait2);
}
use of dr.evomodel.operators.TreeBitRandomWalkOperator in project beast-mcmc by beast-dev.
the class RLYModelTest method testTreeBitRandomWalk.
public void testTreeBitRandomWalk() {
DefaultTreeModel treeModel = new DefaultTreeModel("treeModel", tree);
Parameter I = treeModel.createNodeTraitsParameter(birthRateIndicator, new double[] { 1 });
Parameter b = treeModel.createNodeTraitsParameter(birthRate, new double[] { 1 });
OperatorSchedule schedule = new SimpleOperatorSchedule();
TreeBitRandomWalkOperator tbrw = new TreeBitRandomWalkOperator(treeModel, birthRateIndicator, birthRate, 1.0, 4, true);
BitFlipOperator bfo = new BitFlipOperator(I, 1.0, true);
schedule.addOperator(tbrw);
schedule.addOperator(bfo);
randomLocalYuleTester(treeModel, I, b, schedule);
}
Aggregations