Search in sources :

Example 1 with CovarionGTR

use of dr.oldevomodel.substmodel.CovarionGTR in project beast-mcmc by beast-dev.

the class CovarionGTRParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(AbstractCovarionDNAModel.FREQUENCIES);
    FrequencyModel freqModel = (FrequencyModel) cxo.getChild(FrequencyModel.class);
    OldHiddenNucleotides dataType = (OldHiddenNucleotides) freqModel.getDataType();
    Parameter hiddenRates = (Parameter) xo.getElementFirstChild(AbstractCovarionDNAModel.HIDDEN_CLASS_RATES);
    Parameter switchingRates = (Parameter) xo.getElementFirstChild(AbstractCovarionDNAModel.SWITCHING_RATES);
    Parameter rateACParameter = null;
    if (xo.hasChildNamed(GTRParser.A_TO_C)) {
        rateACParameter = (Parameter) xo.getElementFirstChild(GTRParser.A_TO_C);
    }
    Parameter rateAGParameter = null;
    if (xo.hasChildNamed(GTRParser.A_TO_G)) {
        rateAGParameter = (Parameter) xo.getElementFirstChild(GTRParser.A_TO_G);
    }
    Parameter rateATParameter = null;
    if (xo.hasChildNamed(GTRParser.A_TO_T)) {
        rateATParameter = (Parameter) xo.getElementFirstChild(GTRParser.A_TO_T);
    }
    Parameter rateCGParameter = null;
    if (xo.hasChildNamed(GTRParser.C_TO_G)) {
        rateCGParameter = (Parameter) xo.getElementFirstChild(GTRParser.C_TO_G);
    }
    Parameter rateCTParameter = null;
    if (xo.hasChildNamed(GTRParser.C_TO_T)) {
        rateCTParameter = (Parameter) xo.getElementFirstChild(GTRParser.C_TO_T);
    }
    Parameter rateGTParameter = null;
    if (xo.hasChildNamed(GTRParser.G_TO_T)) {
        rateGTParameter = (Parameter) xo.getElementFirstChild(GTRParser.G_TO_T);
    }
    if (dataType != freqModel.getDataType()) {
        throw new XMLParseException("Data type of " + getParserName() + " element does not match that of its frequencyModel.");
    }
    return new CovarionGTR(dataType, hiddenRates, switchingRates, rateACParameter, rateAGParameter, rateATParameter, rateCGParameter, rateCTParameter, rateGTParameter, freqModel);
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) OldHiddenNucleotides(dr.evolution.datatype.OldHiddenNucleotides) Parameter(dr.inference.model.Parameter) CovarionGTR(dr.oldevomodel.substmodel.CovarionGTR)

Aggregations

OldHiddenNucleotides (dr.evolution.datatype.OldHiddenNucleotides)1 Parameter (dr.inference.model.Parameter)1 CovarionGTR (dr.oldevomodel.substmodel.CovarionGTR)1 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)1