Search in sources :

Example 31 with GammaSiteRateModel

use of dr.evomodel.siteratemodel.GammaSiteRateModel in project beast-mcmc by beast-dev.

the class VariableBranchCompleteHistorySimulatorTest method testHKYVariableSimulation.

public void testHKYVariableSimulation() {
    System.out.println("Starting HKY variable branch simulation");
    Parameter kappa = new Parameter.Default(1, 2.0);
    double[] pi = { 0.45, 0.05, 0.25, 0.25 };
    Parameter freqs = new Parameter.Default(pi);
    FrequencyModel f = new FrequencyModel(Nucleotides.INSTANCE, freqs);
    HKY hky = new HKY(kappa, f);
    int stateCount = hky.getDataType().getStateCount();
    Parameter mu = new Parameter.Default(1, 0.5);
    Parameter alpha = new Parameter.Default(1, 0.5);
    GammaSiteRateModel siteModel = new GammaSiteRateModel("gammaModel", mu, alpha, 4, null);
    siteModel.setSubstitutionModel(hky);
    BranchRateModel branchRateModel = new DefaultBranchRateModel();
    double analyticResult = TreeUtils.getTreeLength(tree, tree.getRoot()) * mu.getParameterValue(0);
    int nSites = 200;
    double[] register1 = new double[stateCount * stateCount];
    double[] register2 = new double[stateCount * stateCount];
    // Count all jumps
    MarkovJumpsCore.fillRegistrationMatrix(register1, stateCount);
    // Move some jumps from 1 to 2
    register1[1 * stateCount + 2] = 0;
    register2[1 * stateCount + 2] = 1;
    register1[1 * stateCount + 3] = 0;
    register2[1 * stateCount + 3] = 1;
    register1[2 * stateCount + 3] = 0;
    register2[2 * stateCount + 3] = 1;
    double[] branchValues = { 10.0, 10.0, 10.0, 10.0, 10.0 };
    Parameter branchValuesParam = new Parameter.Default(branchValues);
    runSimulation(N, tree, siteModel, branchRateModel, nSites, new double[][] { register1, register2 }, analyticResult, kappa, branchValuesParam);
}
Also used : FrequencyModel(dr.evomodel.substmodel.FrequencyModel) BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) DefaultBranchRateModel(dr.evomodel.branchratemodel.DefaultBranchRateModel) HKY(dr.evomodel.substmodel.nucleotide.HKY) Parameter(dr.inference.model.Parameter) GammaSiteRateModel(dr.evomodel.siteratemodel.GammaSiteRateModel) DefaultBranchRateModel(dr.evomodel.branchratemodel.DefaultBranchRateModel)

Aggregations

GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)31 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)26 Parameter (dr.inference.model.Parameter)25 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)23 TreeModel (dr.evomodel.tree.TreeModel)20 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)18 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)18 ArrayList (java.util.ArrayList)14 HKY (dr.evomodel.substmodel.nucleotide.HKY)13 BranchModel (dr.evomodel.branchmodel.BranchModel)12 Partition (dr.app.beagle.tools.Partition)11 BeagleSequenceSimulator (dr.app.beagle.tools.BeagleSequenceSimulator)10 Tree (dr.evolution.tree.Tree)10 NewickImporter (dr.evolution.io.NewickImporter)9 SubstitutionModel (dr.evomodel.substmodel.SubstitutionModel)9 BeagleTreeLikelihood (dr.evomodel.treelikelihood.BeagleTreeLikelihood)8 PatternList (dr.evolution.alignment.PatternList)7 SimpleAlignment (dr.evolution.alignment.SimpleAlignment)7 ImportException (dr.evolution.io.Importer.ImportException)7 IOException (java.io.IOException)7