use of dr.evomodel.substmodel.ProductChainFrequencyModel in project beast-mcmc by beast-dev.
the class ProductChainFrequencyModelTest method testFrequencyModel.
public void testFrequencyModel() {
FrequencyModel firstPosition = new FrequencyModel(Nucleotides.INSTANCE, freq1);
FrequencyModel secondPosition = new FrequencyModel(Nucleotides.INSTANCE, freq2);
FrequencyModel thirdPosition = new FrequencyModel(Nucleotides.INSTANCE, freq3);
List<FrequencyModel> freqModels = new ArrayList<FrequencyModel>(3);
freqModels.add(firstPosition);
freqModels.add(secondPosition);
freqModels.add(thirdPosition);
ProductChainFrequencyModel pcFreqModel = new ProductChainFrequencyModel("freq", freqModels);
double[] freqs = pcFreqModel.getFrequencies();
System.out.println("Freq.length = " + freqs.length);
int pos1 = 2;
int pos2 = 1;
int pos3 = 3;
int index = computeIndex(pos1, pos2, pos3);
System.out.println("Entry: " + new Vector(pcFreqModel.decomposeEntry(index)));
System.out.println("Freq = " + freqs[index]);
System.out.println("Freq = " + computeFreq(pos1, pos2, pos3));
assertEquals(computeFreq(pos1, pos2, pos3), freqs[index]);
}
Aggregations