Search in sources :

Example 1 with BNPRSamplingLikelihood

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);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) MatrixParameter(dr.inference.model.MatrixParameter) DemographicModel(dr.evomodel.coalescent.demographicmodel.DemographicModel) Parameter(dr.inference.model.Parameter) MatrixParameter(dr.inference.model.MatrixParameter) BNPRSamplingLikelihood(dr.evomodel.coalescent.BNPRSamplingLikelihood)

Aggregations

BNPRSamplingLikelihood (dr.evomodel.coalescent.BNPRSamplingLikelihood)1 DemographicModel (dr.evomodel.coalescent.demographicmodel.DemographicModel)1 TreeModel (dr.evomodel.tree.TreeModel)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Parameter (dr.inference.model.Parameter)1