Search in sources :

Example 6 with GeneralDataType

use of dr.evolution.datatype.GeneralDataType in project beast-mcmc by beast-dev.

the class GeneralSubstitutionModelTest method setUp.

public void setUp() throws Exception {
    super.setUp();
    MathUtils.setSeed(666);
    List<String> states = new ArrayList<String>();
    states.add("A");
    states.add("C");
    states.add("G");
    states.add("T");
    //states.addAll(Arrays.asList("A", "C", "G", "T"));
    dataType = new GeneralDataType(states);
    dataType.addAmbiguity("-", new String[] { "A", "C", "G", "T" });
    dataType.addAmbiguity("?", new String[] { "A", "C", "G", "T" });
    createAlignment(PRIMATES_TAXON_SEQUENCE, dataType);
    // popSize
    createRandomInitialTree(0.0001);
//        createSpecifiedTree("(((((chimp:0.010464222027296717,bonobo:0.010464222027296717):0.010716369046616688," +
//                "human:0.021180591073913405):0.010988083344422011,gorilla:0.032168674418335416):0.022421978632286572," +
//                "orangutan:0.05459065305062199):0.009576302472349953,siamang:0.06416695552297194);");
}
Also used : ArrayList(java.util.ArrayList) GeneralDataType(dr.evolution.datatype.GeneralDataType)

Example 7 with GeneralDataType

use of dr.evolution.datatype.GeneralDataType 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]));
        }
    }
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) GeneralF81Model(dr.oldevomodel.substmodel.GeneralF81Model) GeneralDataType(dr.evolution.datatype.GeneralDataType)

Aggregations

GeneralDataType (dr.evolution.datatype.GeneralDataType)7 ArrayList (java.util.ArrayList)3 DataType (dr.evolution.datatype.DataType)2 Parameter (dr.inference.model.Parameter)1 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)1 GeneralF81Model (dr.oldevomodel.substmodel.GeneralF81Model)1 Identifiable (dr.util.Identifiable)1