Search in sources :

Example 16 with Units

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

the class BirthDeathCollapseModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    final double collH = xo.getDoubleAttribute(COLLAPSE_HEIGHT);
    XMLObject cxo = xo.getChild(TREE);
    final Tree tree = (Tree) cxo.getChild(Tree.class);
    final Parameter birthMinusDeath = (Parameter) xo.getElementFirstChild(BIRTHDIFF_RATE);
    final Parameter relativeDeathRate = (Parameter) xo.getElementFirstChild(RELATIVE_DEATH_RATE);
    final Parameter originHeight = (Parameter) xo.getElementFirstChild(ORIGIN_HEIGHT);
    final Parameter collapseWeight = (Parameter) xo.getElementFirstChild(COLLAPSE_WEIGHT);
    final String modelName = xo.getId();
    return new BirthDeathCollapseModel(modelName, tree, units, birthMinusDeath, relativeDeathRate, originHeight, collapseWeight, collH);
}
Also used : Tree(dr.evolution.tree.Tree) Parameter(dr.inference.model.Parameter) BirthDeathCollapseModel(dr.evomodel.alloppnet.speciation.BirthDeathCollapseModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 17 with Units

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

the class SIRepidemicModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = (XMLObject) xo.getChild(POPULATION_SIZE);
    Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
    boolean usingGrowthRate = true;
    Parameter rParam = null;
    if (xo.getChild(GROWTH_RATE) != null) {
        cxo = (XMLObject) xo.getChild(GROWTH_RATE);
        rParam = (Parameter) cxo.getChild(Parameter.class);
    } else {
        cxo = (XMLObject) xo.getChild(DOUBLING_TIME);
        rParam = (Parameter) cxo.getChild(Parameter.class);
        usingGrowthRate = false;
    }
    cxo = (XMLObject) xo.getChild(TPEAK);
    Parameter tpeakParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = (XMLObject) xo.getChild(GAMMA);
    Parameter gammaParam = (Parameter) cxo.getChild(Parameter.class);
    double minPrevalence = xo.getDoubleAttribute(MIN_PREVALENCE);
    return new SIRepidemicModel(N0Param, rParam, tpeakParam, gammaParam, units, usingGrowthRate, minPrevalence);
}
Also used : Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 18 with Units

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

the class LogisticGrowthN0ModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = (XMLObject) xo.getChild(POPULATION_SIZE);
    Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
    boolean usingGrowthRate = true;
    Parameter rParam = null;
    if (xo.getChild(GROWTH_RATE) != null) {
        cxo = (XMLObject) xo.getChild(GROWTH_RATE);
        rParam = (Parameter) cxo.getChild(Parameter.class);
    } else {
        cxo = (XMLObject) xo.getChild(DOUBLING_TIME);
        rParam = (Parameter) cxo.getChild(Parameter.class);
        usingGrowthRate = false;
    }
    cxo = (XMLObject) xo.getChild(TIME_50);
    Parameter t50Param = (Parameter) cxo.getChild(Parameter.class);
    return new LogisticGrowthN0Model(N0Param, rParam, t50Param, units, usingGrowthRate);
}
Also used : Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 19 with Units

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

the class LinearGrowthModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(SLOPE);
    Parameter slopeParam = (Parameter) cxo.getChild(Parameter.class);
    return new LinearGrowthModel(slopeParam, units);
}
Also used : Parameter(dr.inference.model.Parameter) LinearGrowthModel(dr.evomodel.coalescent.demographicmodel.LinearGrowthModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 20 with Units

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

the class ScaledPiecewiseModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(EPOCH_SIZES);
    Parameter epochSizes = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(TREE_MODEL);
    TreeModel treeModel = (TreeModel) cxo.getChild(TreeModel.class);
    boolean isLinear = xo.getBooleanAttribute("linear");
    return new ScaledPiecewiseModel(epochSizes, treeModel, isLinear, units);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits) ScaledPiecewiseModel(dr.evomodel.coalescent.demographicmodel.ScaledPiecewiseModel)

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