Search in sources :

Example 1 with PloidyType

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);
}
Also used : Attribute(dr.util.Attribute) PartitionTreeModel(dr.app.beauti.options.PartitionTreeModel) PloidyType(dr.evolution.datatype.PloidyType)

Aggregations

PartitionTreeModel (dr.app.beauti.options.PartitionTreeModel)1 PloidyType (dr.evolution.datatype.PloidyType)1 Attribute (dr.util.Attribute)1