Search in sources :

Example 11 with SubstitutionModel

use of dr.oldevomodel.substmodel.SubstitutionModel in project beast-mcmc by beast-dev.

the class GammaSiteModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    SubstitutionModel substitutionModel = (SubstitutionModel) xo.getElementFirstChild(SUBSTITUTION_MODEL);
    String msg = "";
    Parameter muParam = null;
    if (xo.hasChildNamed(SUBSTITUTION_RATE)) {
        muParam = (Parameter) xo.getElementFirstChild(SUBSTITUTION_RATE);
        msg += "\n  with initial substitution rate = " + muParam.getParameterValue(0);
    } else if (xo.hasChildNamed(MUTATION_RATE)) {
        muParam = (Parameter) xo.getElementFirstChild(MUTATION_RATE);
        msg += "\n  with initial substitution rate = " + muParam.getParameterValue(0);
    } else if (xo.hasChildNamed(RELATIVE_RATE)) {
        muParam = (Parameter) xo.getElementFirstChild(RELATIVE_RATE);
        msg += "\n  with initial relative rate = " + muParam.getParameterValue(0);
    }
    Parameter shapeParam = null;
    int catCount = 4;
    if (xo.hasChildNamed(GAMMA_SHAPE)) {
        final XMLObject cxo = xo.getChild(GAMMA_SHAPE);
        catCount = cxo.getIntegerAttribute(GAMMA_CATEGORIES);
        shapeParam = (Parameter) cxo.getChild(Parameter.class);
        msg += "\n  " + catCount + " category discrete gamma with initial shape = " + shapeParam.getParameterValue(0);
    }
    Parameter invarParam = null;
    if (xo.hasChildNamed(PROPORTION_INVARIANT)) {
        invarParam = (Parameter) xo.getElementFirstChild(PROPORTION_INVARIANT);
        msg += "\n  initial proportion of invariant sites = " + invarParam.getParameterValue(0);
    }
    Logger.getLogger("dr.evomodel").info("Creating site model." + (msg.length() > 0 ? msg : ""));
    return new GammaSiteModel(substitutionModel, muParam, shapeParam, catCount, invarParam);
}
Also used : GammaSiteModel(dr.oldevomodel.sitemodel.GammaSiteModel) Parameter(dr.inference.model.Parameter) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel)

Example 12 with SubstitutionModel

use of dr.oldevomodel.substmodel.SubstitutionModel in project beast-mcmc by beast-dev.

the class SampleStateModelParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    XMLObject cxo = xo.getChild(MUTATION_RATE);
    Parameter muParam = (Parameter) cxo.getChild(Parameter.class);
    cxo = xo.getChild(PROPORTIONS);
    Parameter proportionParameter = (Parameter) cxo.getChild(Parameter.class);
    Vector<Object> subModels = new Vector<Object>();
    for (int i = 0; i < xo.getChildCount(); i++) {
        if (xo.getChild(i) instanceof SubstitutionModel) {
            subModels.addElement(xo.getChild(i));
        }
    }
    return new SampleStateModel(muParam, proportionParameter, subModels);
}
Also used : Parameter(dr.inference.model.Parameter) Vector(java.util.Vector) SubstitutionModel(dr.oldevomodel.substmodel.SubstitutionModel) SampleStateModel(dr.oldevomodel.sitemodel.SampleStateModel)

Aggregations

SubstitutionModel (dr.oldevomodel.substmodel.SubstitutionModel)12 Parameter (dr.inference.model.Parameter)10 DataType (dr.evolution.datatype.DataType)2 GammaSiteBMA (dr.oldevomodel.sitemodel.GammaSiteBMA)2 GammaSiteModel (dr.oldevomodel.sitemodel.GammaSiteModel)2 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)2 Vector (java.util.Vector)2 Alignment (dr.evolution.alignment.Alignment)1 ExtractPairs (dr.evolution.alignment.ExtractPairs)1 SimpleAlignment (dr.evolution.alignment.SimpleAlignment)1 SitePatterns (dr.evolution.alignment.SitePatterns)1 NexusImporter (dr.evolution.io.NexusImporter)1 Sequence (dr.evolution.sequence.Sequence)1 NodeRef (dr.evolution.tree.NodeRef)1 Tree (dr.evolution.tree.Tree)1 MatrixParameter (dr.inference.model.MatrixParameter)1 Variable (dr.inference.model.Variable)1 MultivariateOUModel (dr.inferencexml.distribution.MultivariateOUModel)1 CategorySiteModel (dr.oldevomodel.sitemodel.CategorySiteModel)1 SampleStateAndCategoryModel (dr.oldevomodel.sitemodel.SampleStateAndCategoryModel)1