use of dr.evomodel.branchratemodel.shrinkage.AutoCorrelatedRatesWithBayesianBridge in project beast-mcmc by beast-dev.
the class AutoCorrelatedRatesBayesianBridgeParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
AutoCorrelatedBranchRatesDistribution ratesDistribution = (AutoCorrelatedBranchRatesDistribution) xo.getChild(AutoCorrelatedBranchRatesDistribution.class);
XMLObject globalXo = xo.getChild(GLOBAL_SCALE);
Parameter globalScale = (Parameter) globalXo.getChild(Parameter.class);
Parameter localScale = null;
if (xo.hasChildNamed(LOCAL_SCALE)) {
XMLObject localXo = xo.getChild(LOCAL_SCALE);
localScale = (Parameter) localXo.getChild(Parameter.class);
if (localScale.getDimension() != ratesDistribution.getDimension()) {
throw new XMLParseException("Local scale dimension (" + localScale.getDimension() + ") != rates dimension (" + ratesDistribution.getDimension() + ")");
}
}
XMLObject exponentXo = xo.getChild(EXPONENT);
Parameter exponent = (Parameter) exponentXo.getChild(Parameter.class);
Parameter slabWidth = ParameterParser.getOptionalParameter(xo, SLAB_WIDTH);
BayesianBridgeDistributionModel distributionModel = (localScale != null) ? new JointBayesianBridgeDistributionModel(globalScale, localScale, exponent, slabWidth, 1) : new MarginalBayesianBridgeDistributionModel(globalScale, exponent, 1);
return new AutoCorrelatedRatesWithBayesianBridge(ratesDistribution, distributionModel);
}
Aggregations