Search in sources :

Example 1 with GammaSiteBMA

use of dr.oldevomodel.sitemodel.GammaSiteBMA in project beast-mcmc by beast-dev.

the class testGammaSiteBMA method testGammaSiteBMA.

public void testGammaSiteBMA() {
    for (Instance test : all) {
        SubstitutionModel substModel = test.getSubstModel();
        Parameter mu = new Parameter.Default(test.getMu());
        Parameter logitInvar = new Parameter.Default(test.getLogitInvar());
        Parameter logShape = new Parameter.Default(test.getLogShape());
        int catCount = test.getCategoryCount();
        Variable<Integer> modelChoose = test.getModelChoose();
        GammaSiteBMA gammaSiteBMA = new GammaSiteBMA(substModel, mu, logitInvar, logShape, catCount, modelChoose);
        double[] catRates = gammaSiteBMA.getCategoryRates();
        double[] expectedCatRates = test.getCategoryRates();
        for (int i = 0; i < catRates.length; i++) {
            assertEquals(catRates[i], expectedCatRates[i], 8e-10);
        }
        double[] catProps = gammaSiteBMA.getCategoryProportions();
        double[] expectedCatProps = test.getCategoryProportions();
        for (int i = 0; i < catProps.length; i++) {
            assertEquals(catProps[i], expectedCatProps[i], 1e-10);
        }
    }
}
Also used : GammaSiteBMA(dr.oldevomodel.sitemodel.GammaSiteBMA) Parameter(dr.inference.model.Parameter) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel)

Example 2 with GammaSiteBMA

use of dr.oldevomodel.sitemodel.GammaSiteBMA in project beast-mcmc by beast-dev.

the class GammaSiteBMAParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SubstitutionModel substitutionModel = (SubstitutionModel) xo.getElementFirstChild(SUBSTITUTION_MODEL);
    Parameter muParam = (Parameter) xo.getElementFirstChild(MUTATION_RATE);
    Parameter logitInvar = (Parameter) xo.getElementFirstChild(LOGIT_PROPORTION_INVARIANT);
    final XMLObject cxo = xo.getChild(LOG_GAMMA_SHAPE);
    Parameter logShape = (Parameter) cxo.getChild(Parameter.class);
    int catCount = cxo.getIntegerAttribute(GAMMA_CATEGORIES);
    Variable<Integer> modelChoose = (Variable<Integer>) xo.getElementFirstChild(MODEL_CHOOSE);
    return new GammaSiteBMA(substitutionModel, muParam, logitInvar, logShape, catCount, modelChoose);
}
Also used : GammaSiteBMA(dr.oldevomodel.sitemodel.GammaSiteBMA) Variable(dr.inference.model.Variable) Parameter(dr.inference.model.Parameter) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel)

Aggregations

Parameter (dr.inference.model.Parameter)2 GammaSiteBMA (dr.oldevomodel.sitemodel.GammaSiteBMA)2 SubstitutionModel (dr.oldevomodel.substmodel.SubstitutionModel)2 Variable (dr.inference.model.Variable)1