use of dr.evolution.datatype.TwoStateCovarion in project beast-mcmc by beast-dev.
the class TwoStateCovarionModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Parameter alphaParameter;
Parameter switchingRateParameter;
XMLObject cxo = xo.getChild(AbstractCovarionDNAModel.FREQUENCIES);
FrequencyModel freqModel = (FrequencyModel) cxo.getChild(FrequencyModel.class);
// fancy new datatype courtesy of Helen
TwoStateCovarion dataType = TwoStateCovarion.INSTANCE;
cxo = xo.getChild(ALPHA);
alphaParameter = (Parameter) cxo.getChild(Parameter.class);
// alpha must be positive and less than 1.0 because the fast rate is normalized to 1.0
alphaParameter.addBounds(new Parameter.DefaultBounds(1.0, 0.0, 1));
cxo = xo.getChild(SWITCHING_RATE);
switchingRateParameter = (Parameter) cxo.getChild(Parameter.class);
if (dataType != freqModel.getDataType()) {
throw new XMLParseException("Data type of " + getParserName() + " element does not match that of its frequencyModel.");
}
TwoStateCovarionModel model = new TwoStateCovarionModel(dataType, freqModel, alphaParameter, switchingRateParameter);
System.out.println(model);
return model;
}
Aggregations