Search in sources :

Example 21 with HKY

use of dr.evomodel.substmodel.nucleotide.HKY 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)

Example 22 with HKY

use of dr.evomodel.substmodel.nucleotide.HKY in project beast-mcmc by beast-dev.

the class UniformizedStateHistoryTest method setUp.

public void setUp() {
    MathUtils.setSeed(666);
    Parameter kappa = new Parameter.Default(1, 2.0);
    double[] pi = { 0.45, 0.05, 0.30, 0.20 };
    Parameter freqs = new Parameter.Default(pi);
    FrequencyModel f = new FrequencyModel(Nucleotides.INSTANCE, freqs);
    hky = new HKY(kappa, f);
    stateCount = hky.getDataType().getStateCount();
    double[] lambda = new double[stateCount * stateCount];
    hky.getInfinitesimalMatrix(lambda);
    process = new SubordinatedProcess(lambda, stateCount);
}
Also used : FrequencyModel(dr.evomodel.substmodel.FrequencyModel) HKY(dr.evomodel.substmodel.nucleotide.HKY) Parameter(dr.inference.model.Parameter)

Aggregations

HKY (dr.evomodel.substmodel.nucleotide.HKY)22 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)21 Parameter (dr.inference.model.Parameter)17 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)13 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)12 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)11 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)9 TreeModel (dr.evomodel.tree.TreeModel)9 BranchModel (dr.evomodel.branchmodel.BranchModel)7 ArrayList (java.util.ArrayList)7 BeagleSequenceSimulator (dr.app.beagle.tools.BeagleSequenceSimulator)6 Partition (dr.app.beagle.tools.Partition)6 NewickImporter (dr.evolution.io.NewickImporter)6 Tree (dr.evolution.tree.Tree)6 SimpleAlignment (dr.evolution.alignment.SimpleAlignment)4 ImportException (dr.evolution.io.Importer.ImportException)4 MarkovJumpsSubstitutionModel (dr.evomodel.substmodel.MarkovJumpsSubstitutionModel)4 Vector (dr.math.matrixAlgebra.Vector)4 IOException (java.io.IOException)4 SitePatterns (dr.evolution.alignment.SitePatterns)3