use of dr.evomodel.branchratemodel.ContinuousBranchRates in project beast-mcmc by beast-dev.
the class ContinuousBranchRatesParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
final boolean normalize = xo.getAttribute(NORMALIZE, false);
final double normalizeBranchRateTo = xo.getAttribute(NORMALIZE_BRANCH_RATE_TO, Double.NaN);
TreeModel tree = (TreeModel) xo.getChild(TreeModel.class);
ParametricDistributionModel distributionModel = (ParametricDistributionModel) xo.getElementFirstChild(DISTRIBUTION);
Parameter rateQuantilesParameter;
if (xo.hasChildNamed(RATE_QUANTILES)) {
rateQuantilesParameter = (Parameter) xo.getElementFirstChild(RATE_QUANTILES);
} else {
rateQuantilesParameter = (Parameter) xo.getElementFirstChild(RATE_CATEGORY_QUANTILES);
}
Logger.getLogger("dr.evomodel").info("Using continuous relaxed clock model.");
Logger.getLogger("dr.evomodel").info(" parametric model = " + distributionModel.getModelName());
Logger.getLogger("dr.evomodel").info(" rate categories = " + rateQuantilesParameter.getDimension());
if (normalize) {
Logger.getLogger("dr.evomodel").info(" mean rate is normalized to " + normalizeBranchRateTo);
}
if (xo.hasAttribute(SINGLE_ROOT_RATE)) {
Logger.getLogger("dr.evomodel").warning(" WARNING: single root rate is not implemented!");
}
return new ContinuousBranchRates(tree, rateQuantilesParameter, distributionModel, normalize, normalizeBranchRateTo);
}
Aggregations