Search in sources :

Example 41 with TreeModel

use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.

the class GibbsPruneAndRegraftParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    boolean pruned = true;
    if (xo.hasAttribute("pruned")) {
        pruned = xo.getBooleanAttribute("pruned");
    }
    return new GibbsPruneAndRegraft(treeModel, pruned, weight);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) GibbsPruneAndRegraft(dr.evomodel.operators.GibbsPruneAndRegraft)

Example 42 with TreeModel

use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.

the class RateSampleOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    final boolean sampleAll = xo.getBooleanAttribute(SAMPLE_ALL);
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    RateEvolutionLikelihood rateEvolution = (RateEvolutionLikelihood) xo.getChild(RateEvolutionLikelihood.class);
    RateSampleOperator operator = new RateSampleOperator(treeModel, sampleAll, rateEvolution);
    operator.setWeight(weight);
    return operator;
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) RateEvolutionLikelihood(dr.oldevomodel.clock.RateEvolutionLikelihood) RateSampleOperator(dr.evomodel.operators.RateSampleOperator)

Example 43 with TreeModel

use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.

the class SubtreeJumpOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    CoercionMode mode = CoercionMode.DEFAULT;
    if (xo.hasAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
        if (xo.getBooleanAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
            mode = CoercionMode.COERCION_ON;
        } else {
            mode = CoercionMode.COERCION_OFF;
        }
    }
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    //        final double targetAcceptance = xo.getAttribute(TARGET_ACCEPTANCE, 0.234);
    final double bias = xo.getAttribute("bias", 0.0);
    final boolean arctanTransform = xo.getAttribute("arctanTransform", true);
    if (Double.isInfinite(bias)) {
        throw new XMLParseException("bias attribute must be not infinite. was " + bias + " for tree " + treeModel.getId());
    }
    SubtreeJumpOperator operator = new SubtreeJumpOperator(treeModel, weight, bias, arctanTransform, mode);
    return operator;
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) SubtreeJumpOperator(dr.evomodel.operators.SubtreeJumpOperator) CoercionMode(dr.inference.operators.CoercionMode)

Example 44 with TreeModel

use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.

the class SubtreeSlideOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    boolean swapRates = xo.getAttribute(SWAP_RATES, false);
    boolean swapTraits = xo.getAttribute(SWAP_TRAITS, false);
    boolean scaledDirichletBranches = xo.getAttribute(DIRICHLET_BRANCHES, false);
    CoercionMode mode = CoercionMode.DEFAULT;
    if (xo.hasAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
        if (xo.getBooleanAttribute(CoercableMCMCOperator.AUTO_OPTIMIZE)) {
            mode = CoercionMode.COERCION_ON;
        } else {
            mode = CoercionMode.COERCION_OFF;
        }
    }
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    final double targetAcceptance = xo.getAttribute(TARGET_ACCEPTANCE, 0.234);
    final double size = xo.getAttribute("size", 1.0);
    if (Double.isInfinite(size) || size <= 0.0) {
        throw new XMLParseException("size attribute must be positive and not infinite. was " + size + " for tree " + treeModel.getId());
    }
    final boolean gaussian = xo.getBooleanAttribute("gaussian");
    SubtreeSlideOperator operator = new SubtreeSlideOperator(treeModel, weight, size, gaussian, swapRates, swapTraits, scaledDirichletBranches, mode);
    operator.setTargetAcceptanceProbability(targetAcceptance);
    return operator;
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) SubtreeSlideOperator(dr.evomodel.operators.SubtreeSlideOperator) CoercionMode(dr.inference.operators.CoercionMode)

Example 45 with TreeModel

use of dr.evomodel.tree.TreeModel in project beast-mcmc by beast-dev.

the class TreeBitMoveOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
    String trait1 = null;
    String trait2 = null;
    if (xo.hasAttribute(INDICTATOR_TRAIT))
        trait1 = xo.getStringAttribute(INDICTATOR_TRAIT);
    if (xo.hasAttribute(TRAIT2))
        trait2 = xo.getStringAttribute(TRAIT2);
    return new TreeBitMoveOperator(treeModel, trait1, trait2, weight);
}
Also used : TreeModel(dr.evomodel.tree.TreeModel) TreeBitMoveOperator(dr.evomodel.operators.TreeBitMoveOperator)

Aggregations

TreeModel (dr.evomodel.tree.TreeModel)142 Parameter (dr.inference.model.Parameter)62 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)28 ArrayList (java.util.ArrayList)28 Tree (dr.evolution.tree.Tree)26 NewickImporter (dr.evolution.io.NewickImporter)21 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)20 FrequencyModel (dr.evomodel.substmodel.FrequencyModel)19 HomogeneousBranchModel (dr.evomodel.branchmodel.HomogeneousBranchModel)18 DefaultBranchRateModel (dr.evomodel.branchratemodel.DefaultBranchRateModel)15 SubstitutionModel (dr.evomodel.substmodel.SubstitutionModel)15 PatternList (dr.evolution.alignment.PatternList)14 NodeRef (dr.evolution.tree.NodeRef)14 Partition (dr.app.beagle.tools.Partition)12 BranchModel (dr.evomodel.branchmodel.BranchModel)12 IOException (java.io.IOException)12 BeagleSequenceSimulator (dr.app.beagle.tools.BeagleSequenceSimulator)11 Taxon (dr.evolution.util.Taxon)11 TaxonList (dr.evolution.util.TaxonList)11 Patterns (dr.evolution.alignment.Patterns)9