Search in sources :

Example 1 with ContinuousBranchRates

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);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) ParametricDistributionModel(dr.inference.distribution.ParametricDistributionModel) Parameter(dr.inference.model.Parameter) ContinuousBranchRates(dr.evomodel.branchratemodel.ContinuousBranchRates)

Aggregations

ContinuousBranchRates (dr.evomodel.branchratemodel.ContinuousBranchRates)1 TreeModel (dr.evomodel.tree.TreeModel)1 ParametricDistributionModel (dr.inference.distribution.ParametricDistributionModel)1 Parameter (dr.inference.model.Parameter)1