diff --git a/src/beast/evolution/speciation/BirthDeathSkylineModel.java b/src/beast/evolution/speciation/BirthDeathSkylineModel.java index 15a663b..4d26432 100644 --- a/src/beast/evolution/speciation/BirthDeathSkylineModel.java +++ b/src/beast/evolution/speciation/BirthDeathSkylineModel.java @@ -7,11 +7,13 @@ import beast.core.Input; import beast.core.MCMC; import beast.core.Operator; +import beast.core.StateNode; import beast.core.parameter.BooleanParameter; import beast.core.parameter.RealParameter; import beast.core.util.Log; import beast.evolution.alignment.Taxon; import beast.evolution.operators.Exchange; +import beast.evolution.operators.ScaleOperator; import beast.evolution.operators.SubtreeSlide; import beast.evolution.operators.TipDatesRandomWalker; import beast.evolution.operators.WilsonBalding; @@ -316,7 +318,7 @@ public void initAndValidate() { // sanity check for sampled ancestor analysis // make sure that operators are valid for such an analysis boolean isSAAnalysis = false; - if (removalProbability.get().getValue() >= 1.0 && removalProbability.get().isEstimatedInput.get()) { + if (removalProbability.get() != null && removalProbability.get().getValue() >= 1.0 && removalProbability.get().isEstimatedInput.get()) { // default parameters have estimated=true by default. // check there is an operator on this parameter for (BEASTInterface o : removalProbability.get().getOutputs()) { @@ -325,17 +327,28 @@ public void initAndValidate() { } } } - if (removalProbability.get().getValue() < 1.0 || isSAAnalysis) { + if (removalProbability.get() != null && removalProbability.get().getValue() < 1.0 || isSAAnalysis) { // this is a sampled ancestor analysis // check that there are no invalid operators in this analysis List operators = getOperators(this); if (operators != null) { for (Operator op : operators) { + boolean isOK = true; if (op.getClass().isAssignableFrom(TipDatesRandomWalker.class) || op.getClass().isAssignableFrom(SubtreeSlide.class) || op.getClass().isAssignableFrom(WilsonBalding.class) || op.getClass().isAssignableFrom(Uniform.class) || op.getClass().isAssignableFrom(Exchange.class)) { + isOK = false; + } else if (op.getClass().isAssignableFrom(ScaleOperator.class)) { + // scale operators on Trees shouldbe replaced with SAScaleOperator + for (StateNode o : op.listStateNodes()) { + if (o instanceof Tree) { + isOK = false; + } + } + } + if (!isOK) { Log.err.println("ERROR: " + op.getClass().getSimpleName() + " is not a valid operator for a sampled ancestor analysis.\n" + "Either remove the operator (id=" + op.getID() + ") or fix the " +