Search in sources :

Example 1 with CataclysmicDemographicModel

use of dr.evomodel.coalescent.CataclysmicDemographicModel in project beast-mcmc by beast-dev.

the class CataclysmicDemographicModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(POPULATION_SIZE);
    Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(GROWTH_RATE);
    Parameter rParam = (Parameter) cxo.getChild(Parameter.class);
    Parameter secondParam = null;
    boolean useSpike = true;
    if (xo.hasChildNamed(SPIKE_SIZE)) {
        cxo = xo.getChild(SPIKE_SIZE);
        secondParam = (Parameter) cxo.getChild(Parameter.class);
    } else if (xo.hasChildNamed(DECLINE_RATE)) {
        cxo = xo.getChild(DECLINE_RATE);
        secondParam = (Parameter) cxo.getChild(Parameter.class);
        useSpike = false;
    } else {
        throw new XMLParseException("Must provide either a spike factor or decline rate");
    }
    cxo = xo.getChild(TIME_OF_CATACLYSM);
    Parameter tParam = (Parameter) cxo.getChild(Parameter.class);
    return new CataclysmicDemographicModel(N0Param, secondParam, rParam, tParam, units, useSpike);
}
Also used : Parameter(dr.inference.model.Parameter) CataclysmicDemographicModel(dr.evomodel.coalescent.CataclysmicDemographicModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Aggregations

Units (dr.evolution.util.Units)1 CataclysmicDemographicModel (dr.evomodel.coalescent.CataclysmicDemographicModel)1 XMLUnits (dr.evoxml.util.XMLUnits)1 Parameter (dr.inference.model.Parameter)1