diff --git a/examples/BEASTmodeltest.xml b/examples/BEASTmodeltest.xml index db7dc65..d2d3727 100644 --- a/examples/BEASTmodeltest.xml +++ b/examples/BEASTmodeltest.xml @@ -49,8 +49,8 @@ name="alignment"> 1.0 0.1 - 1 - 1 + 1 + 1 @@ -71,14 +71,17 @@ name="alignment"> - + + + + + + 1.0 - - - + @@ -114,16 +117,22 @@ name="alignment"> - - - + + + + + + + @@ -150,8 +159,8 @@ name="alignment"> - - + + diff --git a/examples/prior.xml b/examples/prior.xml index f5171d8..886e9d8 100644 --- a/examples/prior.xml +++ b/examples/prior.xml @@ -21,22 +21,25 @@ - - - - - - + + + + + + + @@ -45,7 +48,7 @@ --> - + diff --git a/src/beast/evolution/operators/RBOperator.java b/src/beast/evolution/operators/RBOperator.java index 8724fed..6d664d6 100644 --- a/src/beast/evolution/operators/RBOperator.java +++ b/src/beast/evolution/operators/RBOperator.java @@ -3,7 +3,6 @@ import org.apache.commons.math.MathException; -import beast.core.BEASTObject; import beast.core.Description; import beast.core.Input; import beast.core.Operator; @@ -35,7 +34,7 @@ public class RBOperator extends Operator { public void initAndValidate() throws Exception { rates = rateInput.get(); distr = new Exponential(); - for (BEASTObject plugin : rates.outputs) { + for (Object plugin : rates.getOutputs()) { if (plugin instanceof RBPrior) { RBPrior prior = (RBPrior) plugin; distr = prior.distInput.get(); @@ -53,7 +52,7 @@ public double proposal() { if (Randomizer.nextBoolean()) { // increase nr of rates - if (count == 5) { + if (count == rates.getDimension() ) { // cannot increase any further return Double.NEGATIVE_INFINITY; } diff --git a/src/beast/evolution/sitemodel/BEASTModelTest.java b/src/beast/evolution/sitemodel/BEASTModelTest.java index e9835da..e9c2df5 100644 --- a/src/beast/evolution/sitemodel/BEASTModelTest.java +++ b/src/beast/evolution/sitemodel/BEASTModelTest.java @@ -9,16 +9,17 @@ import beast.core.Input; import beast.core.Input.Validate; import beast.core.parameter.BooleanParameter; +import beast.core.parameter.IntegerParameter; import beast.evolution.tree.Node; @Description("Site model that jumps between with and without gamma sites, as well as with and without invariant sites") public class BEASTModelTest extends SiteModel { - public Input hasGammaRatesInput = new Input("hasGammaRates", "flag indicating whether gamma rate heterogeneity should be used", Validate.REQUIRED); - public Input hasInvariantSitesInput = new Input("hasInvariantSites", "flag indicating whether invariant sites should be used", Validate.REQUIRED); + public Input hasGammaRatesInput = new Input("hasGammaRates", "flag indicating whether gamma rate heterogeneity should be used", Validate.REQUIRED); + public Input hasInvariantSitesInput = new Input("hasInvariantSites", "flag indicating whether invariant sites should be used", Validate.REQUIRED); - BooleanParameter hasInvariantSites; - BooleanParameter hasGammaRates; + IntegerParameter hasInvariantSites; + IntegerParameter hasGammaRates; @Override public void initAndValidate() throws Exception { @@ -52,7 +53,7 @@ protected void calculateCategoryRates(final Node node) { double propVariable = 1.0; int cat = 0; - if (/*invarParameter != null && */hasInvariantSites.getValue()) { + if (/*invarParameter != null && */hasInvariantSites.getValue() > 0) { if (hasPropInvariantCategory) { categoryRates[0] = 0.0; categoryProportions[0] = invarParameter.getValue(); @@ -68,7 +69,7 @@ protected void calculateCategoryRates(final Node node) { } } - if (hasGammaRates.getValue()) { + if (hasGammaRates.getValue() > 0) { final double a = shapeParameter.getValue(); double mean = 0.0; @@ -144,7 +145,7 @@ protected boolean requiresRecalculation() { @Override public double getProportionInvariant() { - if (hasInvariantSites.getValue()) { + if (hasInvariantSites.getValue() > 0) { return invarParameter.getValue(); } else { return 0.0; diff --git a/src/beast/math/distributions/RBPrior.java b/src/beast/math/distributions/RBPrior.java index a7b5555..12e87a6 100644 --- a/src/beast/math/distributions/RBPrior.java +++ b/src/beast/math/distributions/RBPrior.java @@ -1,5 +1,6 @@ package beast.math.distributions; + import beast.core.Description; import beast.core.Function; import beast.core.Input; diff --git a/templates/BEASTmodeltest.xml b/templates/BEASTmodeltest.xml index 0ccdb43..4275b2f 100644 --- a/templates/BEASTmodeltest.xml +++ b/templates/BEASTmodeltest.xml @@ -11,40 +11,40 @@ 1.0 1.0 0.1 - 1 - 1 + 1 + 1 - - - - - - - - + + + + + + + + - - 1.0 - - - - + + 1.0 + + + + - + + - - - - - - - - + + + + + + + ]]> @@ -62,12 +62,12 @@ Prior on gamma shape parameter for partition s:$(n) Prior on proportion invariant for partition s:$(n) - Resersible jump of subst models for partition s:$(n) + Resersible jump of subst models for partition s:$(n) Scales subst model rates of partition s:$(n) Scales gamma shape parameter of partition s:$(n) Scales proportion invariant of partition s:$(n) - Switches gamma rates on/off of partition s:$(n) - Switches invariant sites on/off of partition s:$(n) + Switches gamma rates on/off of partition s:$(n) + Switches invariant sites on/off of partition s:$(n)