Search in sources :

Example 26 with FlexibleTree

use of dr.evolution.tree.FlexibleTree in project beast-mcmc by beast-dev.

the class TempestFrame method writeTimeTreeFile.

protected void writeTimeTreeFile(PrintStream ps) throws IOException {
    FlexibleTree tree = new FlexibleTree(tempestPanel.getTreeAsViewed());
    Regression r = tempestPanel.getTemporalRooting().getRootToTipRegression(tempestPanel.getTreeAsViewed());
    for (int i = 0; i < tree.getInternalNodeCount(); i++) {
        NodeRef node = tree.getInternalNode(i);
        double height = tree.getNodeHeight(node);
        tree.setNodeHeight(node, height / r.getGradient());
    }
    TreeUtils.setHeightsFromDates(tree);
    NexusExporter nexusExporter = new NexusExporter(new PrintStream(ps));
    nexusExporter.exportTree(tree);
}
Also used : NodeRef(dr.evolution.tree.NodeRef) NexusExporter(dr.app.tools.NexusExporter) FlexibleTree(dr.evolution.tree.FlexibleTree) Regression(dr.stats.Regression)

Example 27 with FlexibleTree

use of dr.evolution.tree.FlexibleTree in project beast-mcmc by beast-dev.

the class WithinCaseCoalescent method debugTreelet.

public void debugTreelet(Tree treelet, String fileName) {
    try {
        FlexibleTree treeCopy = new FlexibleTree(treelet);
        for (int j = 0; j < treeCopy.getNodeCount(); j++) {
            FlexibleNode node = (FlexibleNode) treeCopy.getNode(j);
            node.setAttribute("Number", node.getNumber());
        }
        NexusExporter testTreesOut = new NexusExporter(new PrintStream(fileName));
        testTreesOut.exportTree(treeCopy);
    } catch (IOException ignored) {
        System.out.println("IOException");
    }
}
Also used : NexusExporter(dr.app.tools.NexusExporter) PrintStream(java.io.PrintStream) FlexibleTree(dr.evolution.tree.FlexibleTree) FlexibleNode(dr.evolution.tree.FlexibleNode) IOException(java.io.IOException)

Aggregations

FlexibleTree (dr.evolution.tree.FlexibleTree)27 FlexibleNode (dr.evolution.tree.FlexibleNode)12 Tree (dr.evolution.tree.Tree)8 NodeRef (dr.evolution.tree.NodeRef)7 EOFException (java.io.EOFException)6 NexusExporter (dr.app.tools.NexusExporter)5 NewickImporter (dr.evolution.io.NewickImporter)3 TreeModel (dr.evomodel.tree.TreeModel)3 IOException (java.io.IOException)3 PrintStream (java.io.PrintStream)3 ArrayList (java.util.ArrayList)3 Importer (dr.evolution.io.Importer)2 NexusImporter (dr.evolution.io.NexusImporter)2 Regression (dr.stats.Regression)2 HashMap (java.util.HashMap)2 TreeExporter (dr.evolution.io.TreeExporter)1 TreeImporter (dr.evolution.io.TreeImporter)1 MutableTree (dr.evolution.tree.MutableTree)1 ExchangeOperator (dr.evomodel.operators.ExchangeOperator)1 ImportancePruneAndRegraft (dr.evomodel.operators.ImportancePruneAndRegraft)1