Search in sources :

Example 1 with TwoStateCovarion

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;
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) TwoStateCovarionModel(dr.oldevomodel.substmodel.TwoStateCovarionModel) Parameter(dr.inference.model.Parameter) TwoStateCovarion(dr.evolution.datatype.TwoStateCovarion)

Aggregations

TwoStateCovarion (dr.evolution.datatype.TwoStateCovarion)1 Parameter (dr.inference.model.Parameter)1 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)1 TwoStateCovarionModel (dr.oldevomodel.substmodel.TwoStateCovarionModel)1