use of dr.evomodel.coalescent.VariableSkylineLikelihood in project beast-mcmc by beast-dev.
the class VariableSkylineLikelihoodParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
XMLObject cxo = xo.getChild(POPULATION_SIZES);
Parameter param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(INDICATOR_PARAMETER);
Parameter param2 = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(CoalescentLikelihoodParser.POPULATION_TREE);
TreeModel treeModel = (TreeModel) cxo.getChild(TreeModel.class);
VariableSkylineLikelihood.Type type = VariableSkylineLikelihood.Type.STEPWISE;
if (xo.hasAttribute(TYPE)) {
final String s = xo.getStringAttribute(TYPE);
if (s.equalsIgnoreCase(STEPWISE)) {
type = VariableSkylineLikelihood.Type.STEPWISE;
} else if (s.equalsIgnoreCase(LINEAR)) {
type = VariableSkylineLikelihood.Type.LINEAR;
} else if (s.equalsIgnoreCase(EXPONENTIAL)) {
type = VariableSkylineLikelihood.Type.EXPONENTIAL;
} else {
throw new XMLParseException("Unknown Bayesian Skyline type: " + s);
}
}
boolean logSpace = xo.getBooleanAttribute(LOG_SPACE);
Logger.getLogger("dr.evomodel").info("Variable skyline plot: " + type.toString() + " control points");
return new VariableSkylineLikelihood(treeModel, param, param2, type, logSpace);
}
Aggregations