Search in sources :

Example 81 with Parameter

use of dr.inference.model.Parameter 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.ScaledPiecewiseModel)

Example 82 with Parameter

use of dr.inference.model.Parameter in project beast-mcmc by beast-dev.

the class TwoEpochDemographicModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(EPOCH_1);
    DemographicModel demo1 = (DemographicModel) cxo.getChild(DemographicModel.class);
    cxo = xo.getChild(EPOCH_2);
    DemographicModel demo2 = (DemographicModel) cxo.getChild(DemographicModel.class);
    cxo = xo.getChild(TRANSITION_TIME);
    Parameter timeParameter = (Parameter) cxo.getChild(Parameter.class);
    return new TwoEpochDemographicModel(demo1, demo2, timeParameter, units);
}
Also used : TwoEpochDemographicModel(dr.evomodel.coalescent.TwoEpochDemographicModel) DemographicModel(dr.evomodel.coalescent.DemographicModel) Parameter(dr.inference.model.Parameter) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits) TwoEpochDemographicModel(dr.evomodel.coalescent.TwoEpochDemographicModel)

Example 83 with Parameter

use of dr.inference.model.Parameter in project beast-mcmc by beast-dev.

the class VariableSkylineLikelihoodParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(POPULATION_SIZES);
    Parameter param = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(INDICATOR_PARAMETER);
    Parameter param2 = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(CoalescentLikelihoodParser.POPULATION_TREE);
    TreeModel treeModel = (TreeModel) cxo.getChild(TreeModel.class);
    VariableSkylineLikelihood.Type type = VariableSkylineLikelihood.Type.STEPWISE;
    if (xo.hasAttribute(TYPE)) {
        final String s = xo.getStringAttribute(TYPE);
        if (s.equalsIgnoreCase(STEPWISE)) {
            type = VariableSkylineLikelihood.Type.STEPWISE;
        } else if (s.equalsIgnoreCase(LINEAR)) {
            type = VariableSkylineLikelihood.Type.LINEAR;
        } else if (s.equalsIgnoreCase(EXPONENTIAL)) {
            type = VariableSkylineLikelihood.Type.EXPONENTIAL;
        } else {
            throw new XMLParseException("Unknown Bayesian Skyline type: " + s);
        }
    }
    boolean logSpace = xo.getBooleanAttribute(LOG_SPACE);
    Logger.getLogger("dr.evomodel").info("Variable skyline plot: " + type.toString() + " control points");
    return new VariableSkylineLikelihood(treeModel, param, param2, type, logSpace);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) VariableSkylineLikelihood(dr.evomodel.coalescent.VariableSkylineLikelihood) Parameter(dr.inference.model.Parameter)

Example 84 with Parameter

use of dr.inference.model.Parameter in project beast-mcmc by beast-dev.

the class BayesianSkylineGibbsOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    final double lowerBound = xo.getAttribute(LOWER, 0.0);
    final double upperBound = xo.getAttribute(UPPER, Double.MAX_VALUE);
    final boolean jeffreysPrior = xo.getAttribute(JEFFREYS, true);
    boolean exponentialMarkovPrior = xo.getAttribute(EXPONENTIALMARKOV, false);
    double shape = xo.getAttribute(SHAPE, 1.0);
    boolean reverse = xo.getAttribute(REVERSE, false);
    int iterations = xo.getAttribute(ITERATIONS, 1);
    BayesianSkylineLikelihood bayesianSkylineLikelihood = (BayesianSkylineLikelihood) xo.getChild(BayesianSkylineLikelihood.class);
    // This is the parameter on which this operator acts
    Parameter paramPops = (Parameter) xo.getChild(Parameter.class);
    Parameter paramGroups = bayesianSkylineLikelihood.getGroupSizeParameter();
    final int type = bayesianSkylineLikelihood.getType();
    if (type != BayesianSkylineLikelihood.STEPWISE_TYPE) {
        throw new XMLParseException("Need stepwise control points (set 'linear=\"false\"' in skyline Gibbs operator)");
    }
    return new BayesianSkylineGibbsOperator(bayesianSkylineLikelihood, paramPops, paramGroups, type, weight, lowerBound, upperBound, jeffreysPrior, exponentialMarkovPrior, shape, reverse, iterations);
}
Also used : BayesianSkylineGibbsOperator(dr.evomodel.coalescent.operators.BayesianSkylineGibbsOperator) Parameter(dr.inference.model.Parameter) BayesianSkylineLikelihood(dr.evomodel.coalescent.BayesianSkylineLikelihood)

Example 85 with Parameter

use of dr.inference.model.Parameter in project beast-mcmc by beast-dev.

the class RandomWalkIntegerNodeHeightWeightedOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    double d = xo.getDoubleAttribute(WINDOW_SIZE);
    if (d != Math.floor(d)) {
        throw new XMLParseException("The window size of a " + RANDOM_WALK_INT_NODE_HEIGHT_WGT_OP + " should be an integer");
    }
    int windowSize = (int) d;
    Parameter parameter = (Parameter) xo.getChild(Parameter.class);
    Parameter internalNodeHeights = (Parameter) xo.getElementFirstChild(INTERNAL_NODE_HEIGHTS);
    return new RandomWalkIntegerNodeHeightWeightedOperator(parameter, windowSize, weight, internalNodeHeights);
}
Also used : Parameter(dr.inference.model.Parameter) RandomWalkIntegerNodeHeightWeightedOperator(dr.evomodel.operators.RandomWalkIntegerNodeHeightWeightedOperator)

Aggregations

Parameter (dr.inference.model.Parameter)397 TreeModel (dr.evomodel.tree.TreeModel)62 MatrixParameter (dr.inference.model.MatrixParameter)46 ArrayList (java.util.ArrayList)44 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)43 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)41 Units (dr.evolution.util.Units)36 XMLUnits (dr.evoxml.util.XMLUnits)36 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)30 Tree (dr.evolution.tree.Tree)25 DataType (dr.evolution.datatype.DataType)24 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)23 CompoundParameter (dr.inference.model.CompoundParameter)23 GammaSiteModel (dr.oldevomodel.sitemodel.GammaSiteModel)21 SitePatterns (dr.evolution.alignment.SitePatterns)20 HKY (dr.evomodel.substmodel.nucleotide.HKY)17 Likelihood (dr.inference.model.Likelihood)17 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)16 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)16 ParametricDistributionModel (dr.inference.distribution.ParametricDistributionModel)16