本文整理汇总了Java中dr.xml.XMLParser.ID属性的典型用法代码示例。如果您正苦于以下问题:Java XMLParser.ID属性的具体用法?Java XMLParser.ID怎么用?Java XMLParser.ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类dr.xml.XMLParser
的用法示例。
在下文中一共展示了XMLParser.ID属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModelAttributes
private Attribute[] getModelAttributes(HierarchicalPhylogeneticModel hpm) {
switch (hpm.getPriorType()){
case NORMAL_HPM_PRIOR:
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getModelName(hpm)),
};
case LOGNORMAL_HPM_PRIOR:
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getModelName(hpm)),
//new Attribute.Default<Boolean>(LogNormalDistributionModelParser.MEAN_IN_REAL_SPACE, false),
};
default:
}
throw new RuntimeException("Unimplemented HPM prior type");
}
示例2: getMeanPriorAttributes
private Attribute[] getMeanPriorAttributes(HierarchicalPhylogeneticModel hpm) {
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getMeanPriorName(hpm)),
new Attribute.Default<Double>(PriorParsers.MEAN, hpm.getConditionalParameterList().get(0).mean),
new Attribute.Default<Double>(PriorParsers.STDEV, hpm.getConditionalParameterList().get(0).stdev),
};
}
示例3: getPrecisionPriorAttributes
private Attribute[] getPrecisionPriorAttributes(HierarchicalPhylogeneticModel hpm) {
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getPrecisionPriorName(hpm)),
new Attribute.Default<Double>(PriorParsers.SHAPE, hpm.getConditionalParameterList().get(1).shape),
new Attribute.Default<Double>(PriorParsers.SCALE, hpm.getConditionalParameterList().get(1).scale),
new Attribute.Default<Double>(PriorParsers.OFFSET, 0.0),
};
}
示例4: writeTreeLikelihood
/**
* Write the tree likelihood XML block.
*
* @param id the id of the tree likelihood
* @param num the likelihood number
* @param partition the partition to write likelihood block for
* @param writer the writer
*/
private void writeTreeLikelihood(String tag, String id, int num, PartitionData partition, XMLWriter writer) {
PartitionSubstitutionModel substModel = partition.getPartitionSubstitutionModel();
PartitionTreeModel treeModel = partition.getPartitionTreeModel();
PartitionClockModel clockModel = partition.getPartitionClockModel();
writer.writeComment("Likelihood for tree given sequence data");
String prefix;
if (num > 0) {
prefix = partition.getPrefix() + substModel.getPrefixCodon(num);
} else {
prefix = partition.getPrefix();
}
String idString = prefix + id;
Attribute[] attributes;
if (tag.equals(MarkovJumpsTreeLikelihoodParser.MARKOV_JUMP_TREE_LIKELIHOOD)) {
AncestralStatesComponentOptions ancestralStatesOptions = (AncestralStatesComponentOptions) options
.getComponentOptions(AncestralStatesComponentOptions.class);
boolean saveCompleteHistory = ancestralStatesOptions.isCompleteHistoryLogging(partition);
attributes = new Attribute[]{
new Attribute.Default<String>(XMLParser.ID, idString),
new Attribute.Default<Boolean>(TreeLikelihoodParser.USE_AMBIGUITIES, substModel.isUseAmbiguitiesTreeLikelihood()),
new Attribute.Default<Boolean>(MarkovJumpsTreeLikelihoodParser.USE_UNIFORMIZATION, true),
new Attribute.Default<Integer>(MarkovJumpsTreeLikelihoodParser.NUMBER_OF_SIMULANTS, 1),
new Attribute.Default<String>(AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG_NAME, prefix + AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG),
new Attribute.Default<String>(MarkovJumpsTreeLikelihoodParser.SAVE_HISTORY, saveCompleteHistory ? "true" : "false"),
};
} else if (tag.equals(TreeLikelihoodParser.ANCESTRAL_TREE_LIKELIHOOD)) {
attributes = new Attribute[]{
new Attribute.Default<String>(XMLParser.ID, idString),
new Attribute.Default<Boolean>(TreeLikelihoodParser.USE_AMBIGUITIES, substModel.isUseAmbiguitiesTreeLikelihood()),
new Attribute.Default<String>(AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG_NAME, prefix + AncestralStateTreeLikelihoodParser.RECONSTRUCTION_TAG),
};
} else {
attributes = new Attribute[]{
new Attribute.Default<String>(XMLParser.ID, idString),
new Attribute.Default<Boolean>(TreeLikelihoodParser.USE_AMBIGUITIES, substModel.isUseAmbiguitiesTreeLikelihood())
};
}
writer.writeOpenTag(tag, attributes);
if (!options.samplePriorOnly) {
if (num > 0) {
writeCodonPatternsRef(prefix, num, substModel.getCodonPartitionCount(), writer);
} else {
writer.writeIDref(SitePatternsParser.PATTERNS, prefix + SitePatternsParser.PATTERNS);
}
} else {
// We just need to use the dummy alignment
writer.writeIDref(AlignmentParser.ALIGNMENT, partition.getAlignment().getId());
}
writer.writeIDref(TreeModel.TREE_MODEL, treeModel.getPrefix() + TreeModel.TREE_MODEL);
if (num > 0) {
writer.writeIDref(GammaSiteModel.SITE_MODEL, substModel.getPrefix(num) + SiteModel.SITE_MODEL);
} else {
writer.writeIDref(GammaSiteModel.SITE_MODEL, substModel.getPrefix() + SiteModel.SITE_MODEL);
}
ClockModelGenerator.writeBranchRatesModelRef(clockModel, writer);
generateInsertionPoint(ComponentGenerator.InsertionPoint.IN_TREE_LIKELIHOOD, partition, prefix, writer);
writer.writeCloseTag(tag);
}
示例5: writeOperatorSchedule
/**
* Write the operator schedule XML block.
*
* @param operators the list of operators
* @param writer the writer
*/
public void writeOperatorSchedule(List<Operator> operators, XMLWriter writer) {
Attribute[] operatorAttributes;
// certain models would benefit from a logarithm operator optimization
boolean shouldLogCool = false;
for (PartitionTreePrior partition : options.getPartitionTreePriors()) {
if (partition.getNodeHeightPrior() == TreePriorType.SKYGRID ||
partition.getNodeHeightPrior() == TreePriorType.GMRF_SKYRIDE) {
shouldLogCool = true;
break;
}
}
for (PartitionSubstitutionModel model : options.getPartitionSubstitutionModels()) {
if (model.getDataType().getType() == DataType.GENERAL ||
model.getDataType().getType() == DataType.CONTINUOUS) {
shouldLogCool = true;
break;
}
}
operatorAttributes = new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, "operators"),
new Attribute.Default<String>(SimpleOperatorScheduleParser.OPTIMIZATION_SCHEDULE,
(shouldLogCool ?
OperatorSchedule.OptimizationTransform.LOG.toString() :
OperatorSchedule.OptimizationTransform.DEFAULT.toString()))
};
writer.writeComment("Define operators");
writer.writeOpenTag(
SimpleOperatorScheduleParser.OPERATOR_SCHEDULE,
operatorAttributes
// new Attribute[]{new Attribute.Default<String>(XMLParser.ID, "operators")}
);
for (Operator operator : operators) {
if (operator.getWeight() > 0. && operator.isUsed()) {
writeOperator(operator, writer);
}
}
generateInsertionPoint(ComponentGenerator.InsertionPoint.IN_OPERATORS, writer); // Added for special operators
writer.writeCloseTag(SimpleOperatorScheduleParser.OPERATOR_SCHEDULE);
}
示例6: writeSubTree
private void writeSubTree(String treeId, String taxaId, Taxa taxa, PartitionTreeModel model, XMLWriter writer) {
Double height = options.taxonSetsHeights.get(taxa);
if (height == null) {
height = Double.NaN;
}
Attribute[] attributes = new Attribute[] {};
if (treeId != null) {
if (Double.isNaN(height)) {
attributes = new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, treeId)
};
} else {
attributes = new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, treeId),
new Attribute.Default<String>(CoalescentSimulatorParser.HEIGHT, "" + height)
};
}
} else {
if (!Double.isNaN(height)) {
attributes = new Attribute[] {
new Attribute.Default<String>(CoalescentSimulatorParser.HEIGHT, "" + height)
};
}
}
// construct a subtree
writer.writeOpenTag(
CoalescentSimulatorParser.COALESCENT_SIMULATOR,
attributes
);
List<Taxa> subsets = new ArrayList<Taxa>();
// Taxa remainingTaxa = new Taxa(taxa);
for (Taxa taxa2 : options.taxonSets) {
boolean sameTree = model.equals(options.taxonSetsTreeModel.get(taxa2));
boolean isMono = options.taxonSetsMono.get(taxa2);
boolean hasHeight = options.taxonSetsHeights.get(taxa2) != null;
boolean isSubset = taxa.containsAll(taxa2);
if (sameTree && (isMono || hasHeight) && taxa2 != taxa && isSubset) {
subsets.add(taxa2);
}
}
List<Taxa> toRemove = new ArrayList<Taxa>();
for (Taxa taxa3 : subsets) {
boolean isSubSubSet = false;
for (Taxa taxa4 : subsets) {
if (!taxa4.equals(taxa3) && taxa4.containsAll(taxa3)) {
isSubSubSet = true;
}
}
if (isSubSubSet) {
toRemove.add(taxa3);
}
}
subsets.removeAll(toRemove);
for (Taxa taxa5 : subsets) {
// remainingTaxa.removeTaxa(taxa5);
writeSubTree(null, null, taxa5, model, writer);
}
if (taxaId == null) {
writer.writeIDref(TaxaParser.TAXA, taxa.getId());
} else {
writer.writeIDref(TaxaParser.TAXA, taxaId);
}
writeInitialDemoModelRef(model, writer);
writer.writeCloseTag(CoalescentSimulatorParser.COALESCENT_SIMULATOR);
}
示例7: writeOperatorSchedule
/**
* Write the operator schedule XML block.
*
* @param operators the list of operators
* @param writer the writer
*/
public void writeOperatorSchedule(List<Operator> operators, XMLWriter writer) {
Attribute[] operatorAttributes;
// switch (options.coolingSchedule) {
// case SimpleOperatorSchedule.LOG_SCHEDULE:
// if (options.nodeHeightPrior == TreePriorType.GMRF_SKYRIDE) {
// TODO: multi-prior, currently simplify to share same prior case
if (options.isShareSameTreePrior() && options.getPartitionTreePriors().get(0).getNodeHeightPrior() == TreePriorType.GMRF_SKYRIDE) {
operatorAttributes = new Attribute[2];
operatorAttributes[1] = new Attribute.Default<String>(SimpleOperatorScheduleParser.OPTIMIZATION_SCHEDULE, SimpleOperatorSchedule.LOG_STRING);
} else {
// break;
// default:
operatorAttributes = new Attribute[1];
}
operatorAttributes[0] = new Attribute.Default<String>(XMLParser.ID, "operators");
writer.writeComment("Define operators");
writer.writeOpenTag(
SimpleOperatorScheduleParser.OPERATOR_SCHEDULE,
operatorAttributes
// new Attribute[]{new Attribute.Default<String>(XMLParser.ID, "operators")}
);
for (Operator operator : operators) {
if (operator.weight > 0. && operator.inUse) {
setModelPrefix(operator.getPrefix());
writeOperator(operator, writer);
}
}
generateInsertionPoint(ComponentGenerator.InsertionPoint.IN_OPERATORS, writer); // Added for special operators
writer.writeCloseTag(SimpleOperatorScheduleParser.OPERATOR_SCHEDULE);
}
示例8: getModelAttributes
private Attribute[] getModelAttributes(HierarchicalPhylogeneticModel hpm) {
switch (hpm.getPriorType()){
case NORMAL_HPM_PRIOR:
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getModelName(hpm)),
};
case LOGNORMAL_HPM_PRIOR:
return new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, getModelName(hpm)),
new Attribute.Default<Boolean>(LogNormalDistributionModelParser.MEAN_IN_REAL_SPACE, false),
};
default:
}
throw new RuntimeException("Unimplemented HPM prior type");
}
示例9: writeSubTree
private void writeSubTree(String treeId, String taxaId, Taxa taxa, PartitionTreeModel model, XMLWriter writer) {
Double height = options.taxonSetsHeights.get(taxa);
if (height == null) {
height = Double.NaN;
}
Attribute[] attributes = new Attribute[] {};
if (treeId != null) {
if (Double.isNaN(height)) {
attributes = new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, treeId)
};
} else {
attributes = new Attribute[] {
new Attribute.Default<String>(XMLParser.ID, treeId),
new Attribute.Default<String>(NewCoalescentSimulatorParser.HEIGHT, "" + height)
};
}
} else {
if (!Double.isNaN(height)) {
attributes = new Attribute[] {
new Attribute.Default<String>(NewCoalescentSimulatorParser.HEIGHT, "" + height)
};
}
}
// construct a subtree
writer.writeOpenTag(
NewCoalescentSimulatorParser.COALESCENT_SIMULATOR,
attributes
);
List<Taxa> subsets = new ArrayList<Taxa>();
// Taxa remainingTaxa = new Taxa(taxa);
for (Taxa taxa2 : options.taxonSets) {
boolean sameTree = model.equals(options.taxonSetsTreeModel.get(taxa2));
boolean isMono = options.taxonSetsMono.get(taxa2);
boolean hasHeight = options.taxonSetsHeights.get(taxa2) != null;
boolean isSubset = taxa.containsAll(taxa2);
if (sameTree && (isMono || hasHeight) && taxa2 != taxa && isSubset) {
subsets.add(taxa2);
}
}
List<Taxa> toRemove = new ArrayList<Taxa>();
for (Taxa taxa3 : subsets) {
boolean isSubSubSet = false;
for (Taxa taxa4 : subsets) {
if (!taxa4.equals(taxa3) && taxa4.containsAll(taxa3)) {
isSubSubSet = true;
}
}
if (isSubSubSet) {
toRemove.add(taxa3);
}
}
subsets.removeAll(toRemove);
for (Taxa taxa5 : subsets) {
// remainingTaxa.removeTaxa(taxa5);
writeSubTree(null, null, taxa5, model, writer);
}
if (taxaId != null) {
writer.writeIDref(TaxaParser.TAXA, taxa.getId());
} else {
writer.writeIDref(TaxaParser.TAXA, taxaId);
}
writeInitialDemoModelRef(model, writer);
writer.writeCloseTag(NewCoalescentSimulatorParser.COALESCENT_SIMULATOR);
}