本文整理汇总了Java中dr.evolution.datatype.Codons.getStateCount方法的典型用法代码示例。如果您正苦于以下问题:Java Codons.getStateCount方法的具体用法?Java Codons.getStateCount怎么用?Java Codons.getStateCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dr.evolution.datatype.Codons
的用法示例。
在下文中一共展示了Codons.getStateCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCodonSimulation
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
public void testCodonSimulation() {
Parameter kappa = new Parameter.Default(1, 2.0);
Parameter omega = new Parameter.Default(1, 5.0); // Expect many more non-syn changes
Codons codons = Codons.UNIVERSAL;
int stateCount = codons.getStateCount();
double[] p = new double[stateCount];
for (int i = 0; i < stateCount; i++) {
p[i] = 1.0 / (double) stateCount;
}
Parameter pi = new Parameter.Default(p);
FrequencyModel f = new FrequencyModel(codons, pi);
GY94CodonModel codonModel = new GY94CodonModel(codons, omega, kappa, f);
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(codonModel);
BranchRateModel branchRateModel = new DefaultBranchRateModel();
double analyticResult = TreeUtils.getTreeLength(tree, tree.getRoot()) * mu.getParameterValue(0);
int nSites = 100;
double[] synRegMatrix = CodonLabeling.getRegisterMatrix(CodonLabeling.SYN, codons, false); // use base 61
double[] nonSynRegMatrix = CodonLabeling.getRegisterMatrix(CodonLabeling.NON_SYN, codons, false); // use base 61
runSimulation(tree, siteModel, branchRateModel, nSites,
new double[][] {synRegMatrix, nonSynRegMatrix}, analyticResult);
}
示例2: expandToBase64
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
private byte[] expandToBase64(Codons codonDataType, byte[] in) {
final int stateCount = codonDataType.getStateCount();
byte[] intermediateOut = new byte[64 * 64];
int index = 0;
for (int i = 0; i < stateCount; i++) {
for (int j = i + 1; j < stateCount; j++) {
intermediateOut[codonDataType.getCanonicalState(i) * 64
+ codonDataType.getCanonicalState(j)] = in[index];
index++;
}
}
byte[] out = new byte[(64 * 63) / 2];
index = 0;
for (int i = 0; i < 64; i++) {
for (int j = i + 1; j < 64; j++) {
out[index] = intermediateOut[i * 64 + j];
index++;
}
}
return out;
}
示例3: MG94CodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
public MG94CodonModel(Codons codonDataType, Parameter alphaParameter, Parameter betaParameter,
FrequencyModel freqModel) {
this(codonDataType, alphaParameter, betaParameter, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}
示例4: testCodonSimulation
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
public void testCodonSimulation() {
Parameter kappa = new Parameter.Default(1, 2.0);
Parameter omega = new Parameter.Default(1, 5.0); // Expect many more non-syn changes
Codons codons = Codons.UNIVERSAL;
int stateCount = codons.getStateCount();
double[] p = new double[stateCount];
for (int i = 0; i < stateCount; i++) {
p[i] = 1.0 / (double) stateCount;
}
Parameter pi = new Parameter.Default(p);
FrequencyModel f = new FrequencyModel(codons, pi);
GY94CodonModel codonModel = new GY94CodonModel(codons, omega, kappa, f);
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(codonModel);
BranchRateModel branchRateModel = new DefaultBranchRateModel();
double analyticResult = Tree.Utils.getTreeLength(tree, tree.getRoot()) * mu.getParameterValue(0);
int nSites = 100;
double[] synRegMatrix = CodonLabeling.getRegisterMatrix(CodonLabeling.SYN, codons, false); // use base 61
double[] nonSynRegMatrix = CodonLabeling.getRegisterMatrix(CodonLabeling.NON_SYN, codons, false); // use base 61
runSimulation(tree, siteModel, branchRateModel, nSites,
new double[][] {synRegMatrix, nonSynRegMatrix}, analyticResult);
}
示例5: MG94HKYCodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
public MG94HKYCodonModel(Codons codonDataType, Parameter alphaParameter, Parameter betaParameter, Parameter kappaParameter,
FrequencyModel freqModel) {
this(codonDataType, alphaParameter, betaParameter, kappaParameter, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}
示例6: GY94CodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
public GY94CodonModel(Codons codonDataType, Parameter omegaParameter, Parameter kappaParameter,
FrequencyModel freqModel) {
this(codonDataType, omegaParameter, kappaParameter, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}
示例7: EmpiricalCodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
/**
* constructors
*
* @param codonDataType Data type as Codons.UNIVERSAL
* @param omegaParam Parameter: Omega
* @param kappaParam Parameter: Kappa (multidimensional)
* @param mntParam Parameter: Multi-nt
* @param rMat Initial rate matrix and frequencies
* @param freqModel Frequency model
*/
public EmpiricalCodonModel(Codons codonDataType,
Parameter omegaParam,
Parameter kappaParam,
Parameter mntParam,
EmpiricalRateMatrixReader rMat,
FrequencyModel freqModel) {
this(codonDataType, omegaParam, kappaParam, mntParam, rMat, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}
示例8: EmpiricalCodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
/**
* constructors
*
* @param codonDataType Data type as Codons.UNIVERSAL
* @param omegaParam Parameter: Omega
* @param kappaParam Parameter: Kappa (multidimensional)
* @param mntParam Parameter: Multi-nt
* @param rMat Initial rate matrix and frequencies
* @param freqModel Frequency model
*/
public EmpiricalCodonModel(Codons codonDataType,
Parameter omegaParam,
Parameter kappaParam,
Parameter mntParam,
EmpiricalRateMatrix rMat,
FrequencyModel freqModel) {
this(codonDataType, omegaParam, kappaParam, mntParam, rMat, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}
示例9: PCACodonModel
import dr.evolution.datatype.Codons; //导入方法依赖的package包/类
/**
* constructors
*
* @param codonDataType Data type as Codons.UNIVERSAL
* @param pcaType Rate matrix with PCs, means, scale factors
* @param pcaDimensionParameter Scalars for PCs
* @param freqModel Frequency model
*/
public PCACodonModel(Codons codonDataType, AbstractPCARateMatrix pcaType, Parameter pcaDimensionParameter,
FrequencyModel freqModel) {
this(codonDataType, pcaType, pcaDimensionParameter, freqModel,
new DefaultEigenSystem(codonDataType.getStateCount()));
}