use of dr.evolution.datatype.PloidyType in project beast-mcmc by beast-dev.
the class STARBEASTGenerator method writeGeneTrees.
private void writeGeneTrees(XMLWriter writer) {
writer.writeComment("Collection of Gene Trees");
writer.writeOpenTag(SpeciesBindingsParser.GENE_TREES, new Attribute[] { new Attribute.Default<String>(XMLParser.ID, SpeciesBindingsParser.GENE_TREES) });
boolean isSameAllPloidyType = true;
PloidyType checkSamePloidyType = options.getPartitionTreeModels().get(0).getPloidyType();
for (PartitionTreeModel model : options.getPartitionTreeModels()) {
if (checkSamePloidyType != model.getPloidyType()) {
isSameAllPloidyType = false;
break;
}
}
if (isSameAllPloidyType) {
// generate gene trees regarding each data partition
for (PartitionTreeModel model : options.getPartitionTreeModels()) {
writer.writeIDref(TreeModel.TREE_MODEL, model.getPrefix() + TreeModel.TREE_MODEL);
}
} else {
// give ploidy
for (PartitionTreeModel model : options.getPartitionTreeModels()) {
writer.writeOpenTag(SpeciesBindingsParser.GTREE, new Attribute[] { new Attribute.Default<String>(SpeciesBindingsParser.PLOIDY, Double.toString(model.getPloidyType().getValue())) });
writer.writeIDref(TreeModel.TREE_MODEL, model.getPrefix() + TreeModel.TREE_MODEL);
writer.writeCloseTag(SpeciesBindingsParser.GTREE);
}
}
writer.writeCloseTag(SpeciesBindingsParser.GENE_TREES);
}
Aggregations