本文整理汇总了Java中beast.evolution.alignment.Alignment.getSiteCount方法的典型用法代码示例。如果您正苦于以下问题:Java Alignment.getSiteCount方法的具体用法?Java Alignment.getSiteCount怎么用?Java Alignment.getSiteCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beast.evolution.alignment.Alignment
的用法示例。
在下文中一共展示了Alignment.getSiteCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: guessSizes
import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public Integer[] guessSizes(Alignment alignment_) {
Integer[] guessedSizes = new Integer[alignment_.getSiteCount()];
for (int site = 0; site < alignment_.getSiteCount(); ++site) {
guessedSizes[site] = 0;
for (int i : alignment_.getPattern(alignment_.getPatternIndex(site))) {
if (i >= guessedSizes[site]) {
guessedSizes[site] = i + 1;
}
}
}
return guessedSizes;
}
示例2: datatype0
import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
static public CompoundDataType datatype0() {
Alignment alignment0 = alignment0();
List<DataType> types = new ArrayList<DataType>();
Integer[] sizes = new Integer[alignment0.getSiteCount()];
DataType standard = new StandardData();
for (int i = 0; i < alignment0.getSiteCount(); ++i) {
types.add(standard);
sizes[i] = 2;
}
return new CompoundDataType(types, sizes, sizes);
}
示例3: alignmentToString
import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
String alignmentToString(Alignment data, int iTaxon) throws Exception {
int[] states = new int[data.getSiteCount()];
for (int i = 0; i < data.getSiteCount(); i++) {
int iPattern = data.getPatternIndex(i);
int[] sitePattern = data.getPattern(iPattern);
states[i] = sitePattern[iTaxon];
}
// for (int i = 0; i < data.getPatternCount(); i++) {
// int[] sitePattern = data.getPattern(i);
// states[i] = sitePattern[iTaxon];
// }
return data.getDataType().state2string(states);
}
示例4: setUpOperator
import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
/** set up relative weights and parameter input **/
private void setUpOperator() {
String weights = "";
List<RealParameter> parameters = operator.parameterInput.get();
parameters.clear();
double commonClockRate = -1;
boolean isAllClocksAreEqual = true;
try {
for (int i = 0; i < doc.alignments.size(); i++) {
Alignment data = doc.alignments.get(i);
int weight = data.getSiteCount();
BranchRateModel.Base clockModel = (BranchRateModel.Base) doc.clockModels.get(i);
RealParameter clockRate = clockModel.meanRateInput.get();
//clockRate.m_bIsEstimated.setValue(true, clockRate);
if (clockRate.isEstimatedInput.get()) {
if (commonClockRate < 0) {
commonClockRate = clockRate.valuesInput.get().get(0);
} else {
if (Math.abs(commonClockRate - clockRate.valuesInput.get().get(0)) > 1e-10) {
isAllClocksAreEqual = false;
}
}
weights += weight + " ";
parameters.add(clockRate);
}
//doc.autoSetClockRate = false;
}
if (!fixMeanRatesCheckBox.isSelected()) {
fixMeanRatesValidateLabel.setVisible(false);
return;
}
if (parameters.size() == 0) {
fixMeanRatesValidateLabel.setVisible(true);
fixMeanRatesValidateLabel.m_circleColor = Color.red;
fixMeanRatesValidateLabel.setToolTipText("The model is invalid: At least one clock rate should be estimated.");
return;
}
IntegerParameter weightParameter = new IntegerParameter(weights);
weightParameter.setID("weightparameter");
weightParameter.isEstimatedInput.setValue(false, weightParameter);
operator.parameterWeightsInput.setValue(weightParameter, operator);
if (!isAllClocksAreEqual) {
fixMeanRatesValidateLabel.setVisible(true);
fixMeanRatesValidateLabel.m_circleColor = Color.orange;
fixMeanRatesValidateLabel.setToolTipText("Not all clocks are equal. Are you sure this is what you want?");
} else if (parameters.size() == 1) {
fixMeanRatesValidateLabel.setVisible(true);
fixMeanRatesValidateLabel.m_circleColor = Color.orange;
fixMeanRatesValidateLabel.setToolTipText("At least 2 clock models should have their rate estimated");
} else if (parameters.size() < doc.alignments.size()) {
fixMeanRatesValidateLabel.setVisible(true);
fixMeanRatesValidateLabel.m_circleColor = Color.orange;
fixMeanRatesValidateLabel.setToolTipText("Not all partitions have their rate estimated");
} else {
fixMeanRatesValidateLabel.setVisible(false);
}
repaint();
//doc.autoSetClockRate = true;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例5: initAndValidate
import beast.evolution.alignment.Alignment; //导入方法依赖的package包/类
public void initAndValidate() {
super.initAndValidate();
alignments = alignmentsInput.get();
substModels = substModelsInput.get();
if(alignments.size() != substModels.size()){
throw new RuntimeException("The number of assignments ("+alignments.size()+") " +
"does not match up with the the number of models ("+substModels.size()+").");
}
ratePointers = ratePointersInput.get();
rateList = rateListInput.get();
dpValRate = dpValRateInput.get();
int rateCount = rateList.getDimension();
int alignmentCount = alignments.size();
siteModelMatrix = (HashMap<Integer, QuietSiteModel>[]) new HashMap[alignmentCount];
storedSiteModelMatrix = (HashMap<Integer, QuietSiteModel>[]) new HashMap[alignmentCount];
siteModelCount = (HashMap<Integer,Integer>[]) new HashMap[alignmentCount];
storedSiteModelCount = (HashMap<Integer,Integer>[]) new HashMap[alignmentCount];
int totalSiteCount = ratePointers.getDimension();
siteModelMap = new int[totalSiteCount];
storedSiteModelMap = new int[totalSiteCount];
alignmentRef = new int[totalSiteCount];
int k = 0;
for(int i = 0; i < alignmentCount; i++){
siteModelMatrix[i] = new HashMap<Integer,QuietSiteModel>();
siteModelCount[i] = new HashMap<Integer, Integer>();
Alignment alignment = alignments.get(i);
int siteCount = alignment.getSiteCount();
ArrayList<Integer> rateIndices = new ArrayList<Integer>();
for(int j = 0; j < siteCount; j++){
alignmentRef[k] = i;
//System.out.println("site: "+k+" "+alignmentRef[k]);
siteModelMap[k] = ratePointers.getParameter(k).getIDNumber();
int rateIndex = rateList.indexOf(ratePointers.getParameter(k));
if(!rateIndices.contains(rateIndex)){
rateIndices.add(rateIndex);
}
if(siteModelCount[i].containsKey(siteModelMap[k])){
siteModelCount[i].put(siteModelMap[k], siteModelCount[i].get(siteModelMap[k]) + 1);
}else{
siteModelCount[i].put(siteModelMap[k],1);
}
//System.out.println(i+" "+siteModelCount[i].get(siteModelMap[k]));
k++;
}
for(int j = 0; j < rateCount; j++){
if(rateIndices.contains(j)){
QuietRealParameter muParameter = rateList.getParameter(j);
QuietSiteModel siteModel = new QuietSiteModel(substModels.get(i),muParameter);
siteModelMatrix[i].put(muParameter.getIDNumber(),siteModel);
siteModels.add(siteModel);
}
}
}
}