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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations