Search in sources :

Example 1 with SpeciesTreeModel

use of dr.evomodel.speciation.SpeciesTreeModel 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);
}
Also used : SpeciesBindings(dr.evomodel.speciation.SpeciesBindings) Parameter(dr.inference.model.Parameter) Tree(dr.evolution.tree.Tree) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel)

Example 2 with SpeciesTreeModel

use of dr.evomodel.speciation.SpeciesTreeModel in project beast-mcmc by beast-dev.

the class BirthDeathCollapseNClustersStatisticParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    xo.getAttribute("name");
    final XMLObject spptreexo = xo.getChild(SPECIES_TREE);
    SpeciesTreeModel spptree = (SpeciesTreeModel) spptreexo.getChild(SpeciesTreeModel.class);
    final XMLObject cmxo = xo.getChild(COLLAPSE_MODEL);
    BirthDeathCollapseModel bdcm = (BirthDeathCollapseModel) cmxo.getChild(BirthDeathCollapseModel.class);
    return new BirthDeathCollapseNClustersStatistic(spptree, bdcm);
}
Also used : BirthDeathCollapseNClustersStatistic(dr.evomodel.alloppnet.speciation.BirthDeathCollapseNClustersStatistic) BirthDeathCollapseModel(dr.evomodel.alloppnet.speciation.BirthDeathCollapseModel) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel)

Example 3 with SpeciesTreeModel

use of dr.evomodel.speciation.SpeciesTreeModel in project beast-mcmc by beast-dev.

the class SpeciesTreeSimplePriorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SpeciesTreeModel st = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
    //ParametricDistributionModel pr = (ParametricDistributionModel) xo.getChild(ParametricDistributionModel.class);
    Parameter pr = (Parameter) ((XMLObject) xo.getChild("sigma")).getChild(Parameter.class);
    final XMLObject cxo = xo.getChild(TIPS);
    final ParametricDistributionModel tipsPrior = (ParametricDistributionModel) cxo.getChild(ParametricDistributionModel.class);
    return new SpeciesTreeSimplePrior(st, pr, tipsPrior);
}
Also used : ParametricDistributionModel(dr.inference.distribution.ParametricDistributionModel) Parameter(dr.inference.model.Parameter) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel) SpeciesTreeSimplePrior(dr.evomodel.speciation.SpeciesTreeSimplePrior)

Example 4 with SpeciesTreeModel

use of dr.evomodel.speciation.SpeciesTreeModel 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);
}
Also used : MultiSpeciesCoalescent(dr.evomodel.speciation.MultiSpeciesCoalescent) SpeciesBindings(dr.evomodel.speciation.SpeciesBindings) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel)

Example 5 with SpeciesTreeModel

use of dr.evomodel.speciation.SpeciesTreeModel in project beast-mcmc by beast-dev.

the class SpeciesTreeBMPriorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final SpeciesTreeModel st = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
    //ParametricDistributionModel pr = (ParametricDistributionModel) xo.getChild(ParametricDistributionModel.class);
    final Object child = xo.getChild(SIGMA);
    Parameter popSigma = child != null ? (Parameter) ((XMLObject) child).getChild(Parameter.class) : null;
    Parameter stSigma = (Parameter) ((XMLObject) xo.getChild(STSIGMA)).getChild(Parameter.class);
    final XMLObject cxo = (XMLObject) xo.getChild(TIPS);
    final ParametricDistributionModel tipsPrior = (ParametricDistributionModel) cxo.getChild(ParametricDistributionModel.class);
    final boolean logRoot = xo.getAttribute(LOG_ROOT, false);
    return new SpeciesTreeBMPrior(st, popSigma, stSigma, tipsPrior, logRoot);
}
Also used : ParametricDistributionModel(dr.inference.distribution.ParametricDistributionModel) SpeciesTreeBMPrior(dr.evomodel.speciation.SpeciesTreeBMPrior) Parameter(dr.inference.model.Parameter) SpeciesTreeModel(dr.evomodel.speciation.SpeciesTreeModel)

Aggregations

SpeciesTreeModel (dr.evomodel.speciation.SpeciesTreeModel)6 SpeciesBindings (dr.evomodel.speciation.SpeciesBindings)3 Parameter (dr.inference.model.Parameter)3 ParametricDistributionModel (dr.inference.distribution.ParametricDistributionModel)2 Tree (dr.evolution.tree.Tree)1 BirthDeathCollapseModel (dr.evomodel.alloppnet.speciation.BirthDeathCollapseModel)1 BirthDeathCollapseNClustersStatistic (dr.evomodel.alloppnet.speciation.BirthDeathCollapseNClustersStatistic)1 TreeNodeSlide (dr.evomodel.operators.TreeNodeSlide)1 MultiSpeciesCoalescent (dr.evomodel.speciation.MultiSpeciesCoalescent)1 SpeciesTreeBMPrior (dr.evomodel.speciation.SpeciesTreeBMPrior)1 SpeciesTreeSimplePrior (dr.evomodel.speciation.SpeciesTreeSimplePrior)1