use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.
the class GibbsPruneAndRegraftParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
boolean pruned = true;
if (xo.hasAttribute("pruned")) {
pruned = xo.getBooleanAttribute("pruned");
}
return new GibbsPruneAndRegraft(treeModel, pruned, weight);
}
use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.
the class RateSampleOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
final boolean sampleAll = xo.getBooleanAttribute(SAMPLE_ALL);
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
RateEvolutionLikelihood rateEvolution = (RateEvolutionLikelihood) xo.getChild(RateEvolutionLikelihood.class);
RateSampleOperator operator = new RateSampleOperator(treeModel, sampleAll, rateEvolution);
operator.setWeight(weight);
return operator;
}
use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.
the class SubtreeJumpOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
CoercionMode mode = CoercionMode.DEFAULT;
if (xo.hasAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
if (xo.getBooleanAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
mode = CoercionMode.COERCION_ON;
} else {
mode = CoercionMode.COERCION_OFF;
}
}
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
// final double targetAcceptance = xo.getAttribute(TARGET_ACCEPTANCE, 0.234);
final double bias = xo.getAttribute("bias", 0.0);
final boolean arctanTransform = xo.getAttribute("arctanTransform", true);
if (Double.isInfinite(bias)) {
throw new XMLParseException("bias attribute must be not infinite. was " + bias + " for tree " + treeModel.getId());
}
SubtreeJumpOperator operator = new SubtreeJumpOperator(treeModel, weight, bias, arctanTransform, mode);
return operator;
}
use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.
the class SubtreeSlideOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
boolean swapRates = xo.getAttribute(SWAP_RATES, false);
boolean swapTraits = xo.getAttribute(SWAP_TRAITS, false);
boolean scaledDirichletBranches = xo.getAttribute(DIRICHLET_BRANCHES, false);
CoercionMode mode = CoercionMode.DEFAULT;
if (xo.hasAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
if (xo.getBooleanAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
mode = CoercionMode.COERCION_ON;
} else {
mode = CoercionMode.COERCION_OFF;
}
}
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
final double targetAcceptance = xo.getAttribute(TARGET_ACCEPTANCE, 0.234);
final double size = xo.getAttribute("size", 1.0);
if (Double.isInfinite(size) || size <= 0.0) {
throw new XMLParseException("size attribute must be positive and not infinite. was " + size + " for tree " + treeModel.getId());
}
final boolean gaussian = xo.getBooleanAttribute("gaussian");
SubtreeSlideOperator operator = new SubtreeSlideOperator(treeModel, weight, size, gaussian, swapRates, swapTraits, scaledDirichletBranches, mode);
operator.setTargetAcceptanceProbability(targetAcceptance);
return operator;
}
use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.
the class TreeBitMoveOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.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);
return new TreeBitMoveOperator(treeModel, trait1, trait2, weight);
}
Aggregations