use of dr.evomodel.speciation.SpeciesBindings in project beast-mcmc by beast-dev.
the class SpeciesTreeModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
SpeciesBindings spb = (SpeciesBindings) xo.getChild(SpeciesBindings.class);
Parameter coalPointsPops = null;
Parameter coalPointsIndicators = null;
final Boolean cr = xo.getAttribute(CONST_ROOT_POPULATION, false);
final Boolean cp = xo.getAttribute(CONSTANT_POPULATION, false);
final Boolean bmp = xo.getAttribute(BMPRIOR, false);
{
XMLObject cxo = xo.getChild(COALESCENT_POINTS_POPULATIONS);
if (cxo != null) {
final double value = cxo.getAttribute(Attributable.VALUE, 1.0);
coalPointsPops = SpeciesTreeModel.createCoalPointsPopParameter(spb, cxo.getAttribute(Attributable.VALUE, value), bmp);
ParameterParser.replaceParameter(cxo, coalPointsPops);
coalPointsPops.addBounds(new Parameter.DefaultBounds(Double.MAX_VALUE, 0, coalPointsPops.getDimension()));
cxo = xo.getChild(COALESCENT_POINTS_INDICATORS);
if (cxo == null) {
throw new XMLParseException("Must have indicators");
}
coalPointsIndicators = new Parameter.Default(coalPointsPops.getDimension(), 0);
ParameterParser.replaceParameter(cxo, coalPointsIndicators);
} else {
// assert ! bmp;
}
}
final XMLObject cxo = xo.getChild(SPP_SPLIT_POPULATIONS);
final double value = cxo.getAttribute(Attributable.VALUE, 1.0);
final boolean nonConstRootPopulation = coalPointsPops == null && !cr;
final Parameter sppSplitPopulations = SpeciesTreeModel.createSplitPopulationsParameter(spb, value, nonConstRootPopulation, cp);
ParameterParser.replaceParameter(cxo, sppSplitPopulations);
final Parameter.DefaultBounds bounds = new Parameter.DefaultBounds(Double.MAX_VALUE, 0, sppSplitPopulations.getDimension());
sppSplitPopulations.addBounds(bounds);
final Tree startTree = (Tree) xo.getChild(Tree.class);
return new SpeciesTreeModel(spb, sppSplitPopulations, coalPointsPops, coalPointsIndicators, startTree, bmp, nonConstRootPopulation, cp);
}
use of dr.evomodel.speciation.SpeciesBindings in project beast-mcmc by beast-dev.
the class TreeNodeSlideParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
SpeciesBindings species = (SpeciesBindings) xo.getChild(SpeciesBindings.class);
SpeciesTreeModel tree = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
//final boolean oo = xo.getAttribute("outgroup", false);
return new TreeNodeSlide(tree, species, /*, oo*/
weight);
}
use of dr.evomodel.speciation.SpeciesBindings in project beast-mcmc by beast-dev.
the class MultiSpeciesCoalescentParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
final SpeciesBindings sb = (SpeciesBindings) xo.getChild(SpeciesBindings.class);
final SpeciesTreeModel tree = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
return new MultiSpeciesCoalescent(sb, tree);
}
Aggregations