Search in sources :

Example 86 with Parameter

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

the class RandomWalkIntegerSetSizeWeightedOperatorParser 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_SET_SIZE_WGT_OP + " should be an integer");
    }
    double baseSetSize = xo.getDoubleAttribute(BASE_SET_SIZE);
    int windowSize = (int) d;
    Parameter parameter = (Parameter) xo.getChild(Parameter.class);
    MicrosatelliteSamplerTreeModel msatSampleTreeModel = (MicrosatelliteSamplerTreeModel) xo.getChild(MicrosatelliteSamplerTreeModel.class);
    return new RandomWalkIntegerSetSizeWeightedOperator(parameter, windowSize, weight, msatSampleTreeModel, baseSetSize);
}
Also used : RandomWalkIntegerSetSizeWeightedOperator(dr.evomodel.operators.RandomWalkIntegerSetSizeWeightedOperator) MicrosatelliteSamplerTreeModel(dr.evomodel.tree.MicrosatelliteSamplerTreeModel) Parameter(dr.inference.model.Parameter)

Example 87 with Parameter

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

the class LeafTraitExtractorParser method parseXMLObject.

@Override
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    TreeModel model = (TreeModel) xo.getChild(TreeModel.class);
    final CompoundParameter allTraits = (CompoundParameter) xo.getChild(CompoundParameter.class);
    String taxonString = (String) xo.getAttribute(TreeModelParser.TAXON);
    final int leafIndex = model.getTaxonIndex(taxonString);
    if (leafIndex == -1) {
        throw new XMLParseException("Unable to find taxon '" + taxonString + "' in trees.");
    }
    final Parameter leafTrait = allTraits.getParameter(leafIndex);
    boolean setBounds = xo.getAttribute(SET_BOUNDS, true);
    if (setBounds) {
        Parameter.DefaultBounds bound = new Parameter.DefaultBounds(Double.MAX_VALUE, -Double.MAX_VALUE, leafTrait.getDimension());
        leafTrait.addBounds(bound);
    }
    return leafTrait;
}
Also used : CompoundParameter(dr.inference.model.CompoundParameter) TreeModel(dr.evomodel.tree.TreeModel) CompoundParameter(dr.inference.model.CompoundParameter) Parameter(dr.inference.model.Parameter)

Example 88 with Parameter

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

the class PeakAndDeclineModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject cxo = xo.getChild(PEAK_VALUE);
    Parameter peakValueParam = (Parameter) cxo.getChild(Parameter.class);
    Parameter rParam;
    cxo = xo.getChild(SHAPE);
    rParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(PEAK_TIME);
    Parameter peakTimeParam = (Parameter) cxo.getChild(Parameter.class);
    return new PeakAndDeclineModel(peakValueParam, rParam, peakTimeParam, units);
}
Also used : Parameter(dr.inference.model.Parameter) PeakAndDeclineModel(dr.evomodel.coalescent.PeakAndDeclineModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 89 with Parameter

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

the class PiecewisePopulationModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    XMLObject obj = xo.getChild(EPOCH_WIDTHS);
    double[] epochWidths = obj.getDoubleArrayAttribute(WIDTHS);
    if (xo.hasChildNamed(EPOCH_SIZES)) {
        Parameter epochSizes = (Parameter) xo.getElementFirstChild(EPOCH_SIZES);
        boolean isLinear = false;
        if (xo.hasAttribute(LINEAR)) {
            isLinear = xo.getBooleanAttribute(LINEAR);
        }
        return new PiecewisePopulationModel(PIECEWISE_POPULATION, epochSizes, epochWidths, isLinear, units);
    } else {
        Parameter populationSize = (Parameter) xo.getElementFirstChild(POPULATION_SIZE);
        Parameter growthRates = (Parameter) xo.getElementFirstChild(GROWTH_RATES);
        return new PiecewisePopulationModel(PIECEWISE_POPULATION, populationSize, growthRates, epochWidths, units);
    }
}
Also used : Parameter(dr.inference.model.Parameter) PiecewisePopulationModel(dr.evomodel.coalescent.PiecewisePopulationModel) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 90 with Parameter

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

the class PowerLawGrowthModelParser method parseXMLObject.

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

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