Search in sources :

Example 21 with Tree

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

the class TreeMetricStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    TreeMetricStatistic.Method m = TreeMetricStatistic.Method.TOPOLOGY;
    if (xo.hasAttribute(METHOD)) {
        final String s = xo.getStringAttribute(METHOD);
        m = TreeMetricStatistic.Method.valueOf(s.toUpperCase());
    }
    final String name = xo.getAttribute(Statistic.NAME, xo.hasId() ? xo.getId() : m.name());
    final Tree target = (Tree) xo.getElementFirstChild(TARGET);
    final Tree reference = (Tree) xo.getElementFirstChild(REFERENCE);
    return new TreeMetricStatistic(name, target, reference, m);
}
Also used : TreeMetricStatistic(dr.evomodel.tree.TreeMetricStatistic) Tree(dr.evolution.tree.Tree)

Example 22 with Tree

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

the class NodeHeightsStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String name = xo.getAttribute(Statistic.NAME, xo.getId());
    Tree tree = (Tree) xo.getChild(Tree.class);
    Parameter groupSizes = (Parameter) xo.getChild(Parameter.class);
    return new NodeHeightsStatistic(name, tree, groupSizes);
}
Also used : NodeHeightsStatistic(dr.evomodel.tree.NodeHeightsStatistic) Tree(dr.evolution.tree.Tree) Parameter(dr.inference.model.Parameter)

Example 23 with Tree

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

the class ParsimonyStateStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String name = xo.getAttribute(Statistic.NAME, xo.getId());
    Tree tree = (Tree) xo.getChild(Tree.class);
    XMLObject cxo = xo.getChild(STATE);
    TaxonList stateTaxa = (TaxonList) cxo.getChild(TaxonList.class);
    cxo = xo.getChild(MRCA);
    TaxonList mrcaTaxa = (TaxonList) cxo.getChild(TaxonList.class);
    try {
        return new ParsimonyStateStatistic(name, tree, stateTaxa, mrcaTaxa);
    } catch (TreeUtils.MissingTaxonException mte) {
        throw new XMLParseException("Taxon, " + mte + ", in " + getParserName() + "was not found in the tree.");
    }
}
Also used : TaxonList(dr.evolution.util.TaxonList) ParsimonyStateStatistic(dr.evomodel.tree.ParsimonyStateStatistic) Tree(dr.evolution.tree.Tree) TreeUtils(dr.evolution.tree.TreeUtils)

Example 24 with Tree

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

the class ParsimonyStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String name = xo.getAttribute(Statistic.NAME, xo.getId());
    Tree tree = (Tree) xo.getChild(Tree.class);
    XMLObject cxo = xo.getChild(STATE);
    TaxonList taxa = (TaxonList) cxo.getChild(TaxonList.class);
    try {
        return new ParsimonyStatistic(name, tree, taxa);
    } catch (TreeUtils.MissingTaxonException mte) {
        throw new XMLParseException("Taxon, " + mte + ", in " + getParserName() + "was not found in the tree.");
    }
}
Also used : TaxonList(dr.evolution.util.TaxonList) Tree(dr.evolution.tree.Tree) ParsimonyStatistic(dr.evomodel.tree.ParsimonyStatistic) TreeUtils(dr.evolution.tree.TreeUtils)

Example 25 with Tree

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

the class RateCovarianceStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    String name = xo.getAttribute(Statistic.NAME, xo.getId());
    Tree tree = (Tree) xo.getChild(Tree.class);
    BranchRateModel branchRateModel = (BranchRateModel) xo.getChild(BranchRateModel.class);
    return new RateCovarianceStatistic(name, tree, branchRateModel);
}
Also used : BranchRateModel(dr.evomodel.branchratemodel.BranchRateModel) Tree(dr.evolution.tree.Tree) RateCovarianceStatistic(dr.evomodel.tree.RateCovarianceStatistic)

Aggregations

Tree (dr.evolution.tree.Tree)128 NewickImporter (dr.evolution.io.NewickImporter)32 ArrayList (java.util.ArrayList)31 TreeModel (dr.evomodel.tree.TreeModel)26 Parameter (dr.inference.model.Parameter)26 NexusImporter (dr.evolution.io.NexusImporter)18 TaxonList (dr.evolution.util.TaxonList)18 Taxa (dr.evolution.util.Taxa)17 FlexibleTree (dr.evolution.tree.FlexibleTree)16 Taxon (dr.evolution.util.Taxon)15 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)15 NodeRef (dr.evolution.tree.NodeRef)14 SimpleTree (dr.evolution.tree.SimpleTree)13 ImportException (dr.evolution.io.Importer.ImportException)12 Importer (dr.evolution.io.Importer)11 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)11 BeagleSequenceSimulator (dr.app.beagle.tools.BeagleSequenceSimulator)10 Partition (dr.app.beagle.tools.Partition)10 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)10 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)9