Search in sources :

Example 71 with Parameter

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

the class AsymQuadModelParser method parseXMLObject.

//AbstractXMLObjectParser implementation
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Microsatellite microsatellite = (Microsatellite) xo.getChild(Microsatellite.class);
    Parameter expanConst = processModelParameter(xo, EXPANSION_CONSTANT);
    Parameter expanLin = processModelParameter(xo, EXPANSION_LIN);
    Parameter expanQuad = processModelParameter(xo, EXPANSION_QUAD);
    Parameter contractConst = processModelParameter(xo, CONTRACTION_CONSTANT);
    Parameter contractLin = processModelParameter(xo, CONTRACTION_LIN);
    Parameter contractQuad = processModelParameter(xo, CONTRACTION_QUAD);
    //get FrequencyModel
    FrequencyModel freqModel = null;
    if (xo.hasChildNamed(FrequencyModelParser.FREQUENCIES)) {
        freqModel = (FrequencyModel) xo.getElementFirstChild(FrequencyModelParser.FREQUENCIES);
    }
    boolean isSubmodel = xo.getAttribute(IS_SUBMODEL, false);
    return new AsymmetricQuadraticModel(microsatellite, freqModel, expanConst, expanLin, expanQuad, contractConst, contractLin, contractQuad, isSubmodel);
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) Microsatellite(dr.evolution.datatype.Microsatellite) AsymmetricQuadraticModel(dr.oldevomodel.substmodel.AsymmetricQuadraticModel) Parameter(dr.inference.model.Parameter)

Example 72 with Parameter

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

the class BinarySubstitutionModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Parameter ratesParameter;
    XMLObject cxo = xo.getChild(GeneralSubstitutionModelParser.FREQUENCIES);
    FrequencyModel freqModel = (FrequencyModel) cxo.getChild(FrequencyModel.class);
    DataType dataType = freqModel.getDataType();
    if (dataType != TwoStates.INSTANCE)
        throw new XMLParseException("Frequency model must have binary (two state) data type.");
    int relativeTo = 0;
    ratesParameter = new Parameter.Default(0);
    return new GeneralSubstitutionModel(dataType, freqModel, ratesParameter, relativeTo);
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) Parameter(dr.inference.model.Parameter) DataType(dr.evolution.datatype.DataType) GeneralSubstitutionModel(dr.oldevomodel.substmodel.GeneralSubstitutionModel)

Example 73 with Parameter

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

the class TKF91ModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    Parameter lengthDistParameter = (Parameter) xo.getElementFirstChild(TKF91_LENGTH_DIST);
    Parameter deathParameter = (Parameter) xo.getElementFirstChild(DEATH_RATE);
    Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
    return new TKF91Model(lengthDistParameter, deathParameter, units);
}
Also used : Parameter(dr.inference.model.Parameter) TKF91Model(dr.oldevomodel.indel.TKF91Model) Units(dr.evolution.util.Units) XMLUnits(dr.evoxml.util.XMLUnits)

Example 74 with Parameter

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

the class DiscretizedLociRatesParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final boolean normalize = xo.getAttribute(NORMALIZE, false);
    final double normalizeBranchRateTo = xo.getAttribute(NORMALIZE_MEAN_LOCI_RATE_TO, Double.NaN);
    final int categoryCount = xo.getIntegerAttribute(CATEGORY_COUNT);
    CompoundParameter lociRates = (CompoundParameter) xo.getElementFirstChild(LOCI_RATES);
    Parameter rateCategoryParameter = (Parameter) xo.getElementFirstChild(RATE_CATEGORIES);
    ParametricDistributionModel distributionModel = (ParametricDistributionModel) xo.getElementFirstChild(DISTRIBUTION);
    Logger.getLogger("dr.evomodel").info("Using discretized loci rates model.");
    Logger.getLogger("dr.evomodel").info("Number of categories: " + categoryCount);
    Logger.getLogger("dr.evomodel").info("  parametric model = " + distributionModel.getModelName());
    if (normalize) {
        Logger.getLogger("dr.evomodel").info("   mean rate is normalized to " + normalizeBranchRateTo);
    }
    return new DiscretizedLociRates(lociRates, rateCategoryParameter, distributionModel, normalize, normalizeBranchRateTo, categoryCount);
}
Also used : CompoundParameter(dr.inference.model.CompoundParameter) ParametricDistributionModel(dr.inference.distribution.ParametricDistributionModel) DiscretizedLociRates(dr.oldevomodel.sitemodel.DiscretizedLociRates) CompoundParameter(dr.inference.model.CompoundParameter) Parameter(dr.inference.model.Parameter)

Example 75 with Parameter

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

the class GammaSiteBMAParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SubstitutionModel substitutionModel = (SubstitutionModel) xo.getElementFirstChild(SUBSTITUTION_MODEL);
    Parameter muParam = (Parameter) xo.getElementFirstChild(MUTATION_RATE);
    Parameter logitInvar = (Parameter) xo.getElementFirstChild(LOGIT_PROPORTION_INVARIANT);
    final XMLObject cxo = xo.getChild(LOG_GAMMA_SHAPE);
    Parameter logShape = (Parameter) cxo.getChild(Parameter.class);
    int catCount = cxo.getIntegerAttribute(GAMMA_CATEGORIES);
    Variable<Integer> modelChoose = (Variable<Integer>) xo.getElementFirstChild(MODEL_CHOOSE);
    return new GammaSiteBMA(substitutionModel, muParam, logitInvar, logShape, catCount, modelChoose);
}
Also used : GammaSiteBMA(dr.oldevomodel.sitemodel.GammaSiteBMA) Variable(dr.inference.model.Variable) Parameter(dr.inference.model.Parameter) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel)

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