use of dr.evomodel.substmodel.codon.GY94CodonModel in project beast-mcmc by beast-dev.
the class RandomBranchModel method setup.
// END: Constructor
private void setup() {
DataType dataType = baseSubstitutionModel.getDataType();
FrequencyModel freqModel = baseSubstitutionModel.getFrequencyModel();
Parameter kappaParameter = new Parameter.Default("kappa", 1, baseSubstitutionModel.getKappa());
substitutionModels = new LinkedList<SubstitutionModel>();
branchAssignmentMap = new LinkedHashMap<NodeRef, Integer>();
int branchClass = 0;
for (NodeRef node : treeModel.getNodes()) {
if (!treeModel.isRoot(node)) {
double nodeHeight = treeModel.getNodeHeight(node);
double parentHeight = treeModel.getNodeHeight(treeModel.getParent(node));
double time = 0.5 * (parentHeight + nodeHeight);
double baseOmega = baseSubstitutionModel.getOmega();
double fixed = baseOmega * time;
//Math.exp((random.nextGaussian() * stdev + mean));
double epsilon = (Math.log(1 - random.nextDouble()) / (-rate));
double value = fixed + epsilon;
Parameter omegaParameter = new Parameter.Default("omega", 1, value);
GY94CodonModel gy94 = new GY94CodonModel((Codons) dataType, omegaParameter, kappaParameter, freqModel);
substitutionModels.add(gy94);
branchAssignmentMap.put(node, branchClass);
branchClass++;
}
//END: root check
}
// END: nodes loop
}
Aggregations