use of dr.oldevomodel.substmodel.GeneralF81Model in project beast-mcmc by beast-dev.
the class GeneralF81ModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
FrequencyModel freqModel = null;
if (xo.hasChildNamed(FREQUENCIES)) {
XMLObject cxo = xo.getChild(FREQUENCIES);
freqModel = (FrequencyModel) cxo.getChild(FrequencyModel.class);
}
Logger.getLogger("dr.evomodel").info(" General F81 Model from frequencyModel '" + freqModel.getId() + "' (stateCount=" + freqModel.getFrequencyCount() + ")");
return new GeneralF81Model(freqModel);
}
use of dr.oldevomodel.substmodel.GeneralF81Model in project beast-mcmc by beast-dev.
the class GeneralF81Test method testGF81.
public void testGF81() {
for (Instance test : all) {
double[] pi = test.getPi();
// Parameter freqs = new Parameter.Default(pi);
GeneralDataType gdt = new GeneralDataType(new String[] { "1", "2", "3", "4" });
FrequencyModel f = new FrequencyModel(gdt, pi);
GeneralF81Model generalF81Model = new GeneralF81Model(f);
double distance = test.getDistance();
double[] mat = new double[4 * 4];
generalF81Model.getTransitionProbabilities(distance, mat);
final double[] result = test.getExpectedResult();
for (int k = 0; k < mat.length; ++k) {
assertEquals(mat[k], result[k], 1e-10);
// System.out.print(" " + (mat[k] - result[k]));
}
}
}
Aggregations