use of dr.evomodel.coalescent.BNPRSamplingLikelihood in project beast-mcmc by beast-dev.
the class BNPRSamplingLikelihoodParser method parseXMLObject.
// ************************************************************************
// AbstractXMLObjectParser implementation
// ************************************************************************
@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
XMLObject cxo = xo.getChild(MODEL);
DemographicModel demoModel = (DemographicModel) cxo.getChild(DemographicModel.class);
cxo = xo.getChild(BETAS);
Parameter betas = (Parameter) cxo.getChild(Parameter.class);
// May need to adapt to multiple trees, a la CoalescentLikelihoodParser
cxo = xo.getChild(POPULATION_TREE);
TreeModel tree = (TreeModel) cxo.getChild(TreeModel.class);
double[] epochWidths = null;
if (xo.hasChildNamed(EPOCH_WIDTHS)) {
cxo = xo.getChild(EPOCH_WIDTHS);
epochWidths = cxo.getDoubleArrayAttribute(WIDTHS);
}
MatrixParameter covariates = null;
if (xo.hasChildNamed(COVARIATES)) {
cxo = xo.getChild(COVARIATES);
covariates = (MatrixParameter) cxo.getChild(MatrixParameter.class);
}
MatrixParameter powerCovariates = null;
if (xo.hasChildNamed(POWER_COVARIATES)) {
cxo = xo.getChild(POWER_COVARIATES);
powerCovariates = (MatrixParameter) cxo.getChild(MatrixParameter.class);
}
Parameter powerBetas = null;
if (xo.hasChildNamed(POWER_BETAS)) {
cxo = xo.getChild(POWER_BETAS);
powerBetas = (Parameter) cxo.getChild(Parameter.class);
}
return new BNPRSamplingLikelihood(tree, betas, demoModel, epochWidths, covariates, powerCovariates, powerBetas);
}
Aggregations