Search in sources :

Example 6 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class ExponentialGrowthModelParser 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);
    Parameter rParam;
    boolean usingGrowthRate = true;
    if (xo.getChild(GROWTH_RATE) != null) {
        cxo = xo.getChild(GROWTH_RATE);
        rParam = (Parameter) cxo.getChild(Parameter.class);
    } else {
        cxo = xo.getChild(DOUBLING_TIME);
        rParam = (Parameter) cxo.getChild(Parameter.class);
        usingGrowthRate = false;
    }
    return new ExponentialGrowthModel(N0Param, rParam, units, usingGrowthRate);
}
Also used : ExponentialGrowthModel(dr.evomodel.coalescent.ExponentialGrowthModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 7 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class ExponentialLogisticModelParser 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(LOGISTIC_GROWTH_RATE);
    Parameter logGrowthParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(LOGISTIC_SHAPE);
    Parameter shapeParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(EXPONENTIAL_GROWTH_RATE);
    Parameter expGrowthParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(TRANSITION_TIME);
    Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
    double alpha = xo.getDoubleAttribute(ALPHA);
    return new ExponentialLogisticModel(N0Param, logGrowthParam, shapeParam, expGrowthParam, timeParam, alpha, units);
}
Also used : ExponentialLogisticModel(dr.evomodel.coalescent.ExponentialLogisticModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 8 with Units

use of dr.evolution.util.Units 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)

Example 9 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class ConstantLogisticModelParser 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(ANCESTRAL_POPULATION_SIZE);
    Parameter N1Param = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(GROWTH_RATE);
    Parameter rParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(SHAPE);
    Parameter cParam = (Parameter) cxo.getChild(Parameter.class);
    double alpha = xo.getDoubleAttribute(ALPHA);
    return new ConstantLogisticModel(N0Param, N1Param, rParam, cParam, alpha, units);
}
Also used : Parameter(dr.inference.model.Parameter) ConstantLogisticModel(dr.evomodel.coalescent.ConstantLogisticModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 10 with Units

use of dr.evolution.util.Units in project beast-mcmc by beast-dev.

the class EmergingEpidemicModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    Parameter growthRateParameter = (Parameter) xo.getElementFirstChild(GROWTH_RATE);
    Parameter generationTimeParameter = (Parameter) xo.getElementFirstChild(GENERATION_TIME);
    Parameter generationShapeParameter = (Parameter) xo.getElementFirstChild(GENERATION_DISTRIBUTION_SHAPE);
    Parameter offspringDispersionParameter = (Parameter) xo.getElementFirstChild(OFFSPRING_DISPERSION);
    TreeModel tree = (TreeModel) xo.getElementFirstChild(TREE);
    return new EmergingEpidemicModel(growthRateParameter, generationTimeParameter, generationShapeParameter, offspringDispersionParameter, tree, units);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) EmergingEpidemicModel(dr.evomodel.coalescent.EmergingEpidemicModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Aggregations

Units (dr.evolution.util.Units)70 XMLUnits (dr.evoxml.util.XMLUnits)65 Parameter (dr.inference.model.Parameter)62 TreeModel (dr.evomodel.tree.TreeModel)4 Date (dr.evolution.util.Date)3 MultiEpochExponential (dr.evolution.coalescent.MultiEpochExponential)2 ConstantPopulationSizeModel (dr.evomodel.coalescent.ConstantPopulationSizeModel)2 ExponentialPopulationSizeModel (dr.evomodel.coalescent.ExponentialPopulationSizeModel)2 BirthDeathGernhard08Model (dr.evomodel.speciation.BirthDeathGernhard08Model)2 BirthDeathSerialSamplingModel (dr.evomodel.speciation.BirthDeathSerialSamplingModel)2 TreePriorParameterizationType (dr.app.beauti.types.TreePriorParameterizationType)1 TreePriorType (dr.app.beauti.types.TreePriorType)1 ExponentialExponential (dr.evolution.coalescent.ExponentialExponential)1 ExponentialGrowth (dr.evolution.coalescent.ExponentialGrowth)1 Importer (dr.evolution.io.Importer)1 NewickImporter (dr.evolution.io.NewickImporter)1 SimpleNode (dr.evolution.tree.SimpleNode)1 SimpleTree (dr.evolution.tree.SimpleTree)1 Tree (dr.evolution.tree.Tree)1 Taxon (dr.evolution.util.Taxon)1