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);
}
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);
}
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.");
}
}
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.");
}
}
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);
}
Aggregations