Search in sources :

Example 1 with MutationDeathModel

use of beast.evolution.substitutionmodel.MutationDeathModel in project beast2 by CompEvol.

the class TreeLikelihoodTest method testSDolloLikelihood.

@Test
public void testSDolloLikelihood() throws Exception {
    UserDataType dataType = new UserDataType();
    dataType.initByName("states", 2, "codeMap", "0=1, 1=0, ?=0 1, -=0 1");
    Alignment data = new Alignment();
    Sequence German_ST = new Sequence("German_ST", BEASTTestCase.German_ST.dataInput.get());
    Sequence Dutch_List = new Sequence("Dutch_List", BEASTTestCase.Dutch_List.dataInput.get());
    ;
    Sequence English_ST = new Sequence("English_ST", BEASTTestCase.English_ST.dataInput.get());
    ;
    Sequence French = new Sequence("French", BEASTTestCase.French.dataInput.get());
    ;
    Sequence Italian = new Sequence("Italian", BEASTTestCase.Italian.dataInput.get());
    ;
    Sequence Spanish = new Sequence("Spanish", BEASTTestCase.Spanish.dataInput.get());
    ;
    data.initByName("sequence", German_ST, "sequence", Dutch_List, "sequence", English_ST, "sequence", French, "sequence", Italian, "sequence", Spanish, "userDataType", dataType);
    Tree tree = BEASTTestCase.getTree(data, "((English_ST:0.22743347188019544,(German_ST:0.10557648379843088,Dutch_List:0.10557648379843088):0.12185698808176457):1.5793160946109988,(Spanish:0.11078392189606047,(Italian:0.10119772534558173,French:0.10119772534558173):0.009586196550478737):1.6959656445951337)");
    RealParameter frequencies = new RealParameter("1 0");
    Frequencies freqs = new Frequencies();
    freqs.initByName("frequencies", frequencies);
    RealParameter deathprob = new RealParameter("1.7");
    MutationDeathModel SDollo = new MutationDeathModel();
    SDollo.initByName("deathprob", deathprob, "frequencies", freqs);
    SiteModel siteModel = new SiteModel();
    siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", SDollo);
    TreeLikelihood likelihood = newTreeLikelihood();
    likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
    double logP = 0;
    likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel, "useAmbiguities", true);
    logP = likelihood.calculateLogP();
    // beast1 xml gives -3551.6436
    assertEquals(logP, -3551.6436270344648, BEASTTestCase.PRECISION);
}
Also used : Alignment(beast.evolution.alignment.Alignment) UserDataType(beast.evolution.datatype.UserDataType) BeagleTreeLikelihood(beast.evolution.likelihood.BeagleTreeLikelihood) TreeLikelihood(beast.evolution.likelihood.TreeLikelihood) Tree(beast.evolution.tree.Tree) RealParameter(beast.core.parameter.RealParameter) MutationDeathModel(beast.evolution.substitutionmodel.MutationDeathModel) SiteModel(beast.evolution.sitemodel.SiteModel) Sequence(beast.evolution.alignment.Sequence) Frequencies(beast.evolution.substitutionmodel.Frequencies) UncertainAlignmentTest(test.beast.evolution.alignment.UncertainAlignmentTest) Test(org.junit.Test)

Aggregations

RealParameter (beast.core.parameter.RealParameter)1 Alignment (beast.evolution.alignment.Alignment)1 Sequence (beast.evolution.alignment.Sequence)1 UserDataType (beast.evolution.datatype.UserDataType)1 BeagleTreeLikelihood (beast.evolution.likelihood.BeagleTreeLikelihood)1 TreeLikelihood (beast.evolution.likelihood.TreeLikelihood)1 SiteModel (beast.evolution.sitemodel.SiteModel)1 Frequencies (beast.evolution.substitutionmodel.Frequencies)1 MutationDeathModel (beast.evolution.substitutionmodel.MutationDeathModel)1 Tree (beast.evolution.tree.Tree)1 Test (org.junit.Test)1 UncertainAlignmentTest (test.beast.evolution.alignment.UncertainAlignmentTest)1