diff --git a/fxtemplates/ClockModels.xml b/fxtemplates/ClockModels.xml
index 0c9590a..756fcf9 100644
--- a/fxtemplates/ClockModels.xml
+++ b/fxtemplates/ClockModels.xml
@@ -30,10 +30,10 @@
-
-
-
-
+
+
+
+
]]>
-
-
-
-
+
+
+
+
]]>
-
-
+
+
+
+
+
+
+
+
@@ -309,7 +315,10 @@ ClusterTree/clusterType/,
-
+
+
+
+
diff --git a/fxtemplates/SubstModels.xml b/fxtemplates/SubstModels.xml
index 12d67ad..58b88fe 100644
--- a/fxtemplates/SubstModels.xml
+++ b/fxtemplates/SubstModels.xml
@@ -28,7 +28,10 @@ MutationRatePrior/index/=Priors/MutationRatePrior/
-
+
+
+
+
diff --git a/fxtemplates/TreePriors.xml b/fxtemplates/TreePriors.xml
index 135e6a8..d283678 100644
--- a/fxtemplates/TreePriors.xml
+++ b/fxtemplates/TreePriors.xml
@@ -110,7 +110,10 @@ CalibratedYuleBirthRatePrior/index/=Priors/CalibratedYuleBirthRatePrior/
-
+
+
+
+
]]>
@@ -164,7 +167,10 @@ DeathRatePrior/index/=Priors/DeathRatePrior/'>
-
+
+
+
+
@@ -234,7 +240,10 @@ PopSizeScaler/index/=Operators/BactrianRateScaler/index/'>
-
+
+
+
+
]]>
@@ -292,7 +301,10 @@ GrowthRateRandomWalk/index/=Operators/BactrianRandomWalk'>
-
+
+
+
+
@@ -367,11 +379,19 @@ groupSizesDelta/index/=Operators/BactrianDeltaExchange/index/'>
-
+
+
+
+
+
+
+
+
+
@@ -386,11 +406,17 @@ groupSizesDelta/index/=Operators/BactrianDeltaExchange/index/'>
if='inposterior(BayesianSkyline.t:$(n)) and inposterior(bPopSizes.t:$(n))'/>
+
Markov chained prior on population sizes of Bayesian
skyline plot
+ Prior on the mean of the first population size of
+ the Bayesian skyline plot
+
@@ -398,6 +424,8 @@ groupSizesDelta/index/=Operators/BactrianDeltaExchange/index/'>
if='inposterior(BayesianSkyline.t:$(n))'/>
+
Scale population size of Coalscent prior of tree t:$(n)
@@ -405,6 +433,9 @@ groupSizesDelta/index/=Operators/BactrianDeltaExchange/index/'>
Exchange group sizes of Coalscent prior of tree t:$(n)
+ Scale the mean of the first population size of tree t:$(n)
+
@@ -447,10 +478,10 @@ EBSPLogger/mode/
-
-
-
-
+
+
+
+
diff --git a/src/beastfx/app/inputeditor/BeautiConfig.java b/src/beastfx/app/inputeditor/BeautiConfig.java
index 78998af..fe08169 100644
--- a/src/beastfx/app/inputeditor/BeautiConfig.java
+++ b/src/beastfx/app/inputeditor/BeautiConfig.java
@@ -91,7 +91,12 @@ public class BeautiConfig extends BEASTObject {
public List subTemplates;
public List alignmentProvider;
+ /** hyperprior for a positive parameter: LogNormal(0, 8) with a scale operator */
public BeautiSubTemplate hyperPriorTemplate = null;
+ /** hyperprior for a parameter that may be negative (e.g. a LogNormal's M = 0):
+ * Normal(0, 8) with a random-walk operator. Uses the same IDs as hyperPriorTemplate,
+ * so BeautiDoc's sync rules (which apply hyperPriorTemplate's connectors) work for both. */
+ public BeautiSubTemplate realHyperPriorTemplate = null;
@Override
public void initAndValidate() {
@@ -125,6 +130,7 @@ public void initAndValidate() {
try {
XMLParser parser = new XMLParser();
hyperPriorTemplate = (BeautiSubTemplate) parser.parseBareFragment(HYPER_PRIOR_XML, true);
+ realHyperPriorTemplate = (BeautiSubTemplate) new XMLParser().parseBareFragment(REAL_HYPER_PRIOR_XML, true);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -134,11 +140,14 @@ public void initAndValidate() {
final static String HYPER_PRIOR_XML =
" \n" +
- " \n" +
+ " \n" +
" \n" +
" \n" +
- " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
" \n" +
"\n" +
" \n" +
@@ -153,6 +162,32 @@ public void initAndValidate() {
" Hyper prior for parameter $(n)\n" +
" \n" +
" \n";
+
+ final static String REAL_HYPER_PRIOR_XML =
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "\n" +
+ " \n" +
+ " ]]>\n" +
+ " \n" +
+ "\n" +
+ " Scale hyper parameter $(n)\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ "\n" +
+ " Hyper prior for parameter $(n)\n" +
+ " \n" +
+ " \n";
public void setDoc(BeautiDoc doc) {
partitionTemplate.get().setDoc(doc);
@@ -161,6 +196,7 @@ public void setDoc(BeautiDoc doc) {
}
doc.setExpertMode(isExpertInput.get());
hyperPriorTemplate.doc = doc;
+ realHyperPriorTemplate.doc = doc;
}
public void clear() {
diff --git a/src/beastfx/app/inputeditor/ParameterInputEditor.java b/src/beastfx/app/inputeditor/ParameterInputEditor.java
index b3defd0..bf78e0d 100644
--- a/src/beastfx/app/inputeditor/ParameterInputEditor.java
+++ b/src/beastfx/app/inputeditor/ParameterInputEditor.java
@@ -3,6 +3,7 @@
import beast.base.core.BEASTInterface;
+import beast.base.inference.parameter.RealParameter;
import beast.base.core.Input;
import beast.base.core.Log;
import beast.base.evolution.branchratemodel.BranchRateModel;
@@ -278,7 +279,13 @@ public void toggleEstimate() {
PartitionContext context = new PartitionContext(id.substring("parameter.".length()));
Log.warning.println(context + " " + id);
- doc.beautiConfig.hyperPriorTemplate.createSubNet(context, true);
+ // A log-normal hyperprior and a scale operator suit a positive parameter. Legacy
+ // parameters often have no lower bound even when positive (e.g. a LogNormal's S),
+ // so a parameter counts as positive if its lower bound is >= 0 or its value is > 0;
+ // otherwise (e.g. a LogNormal's M = 0) it gets a normal hyperprior and a
+ // random-walk operator, since a scale operator cannot move a value of 0.
+ boolean positive = !(parameter2 instanceof RealParameter rp) || rp.getLower() >= 0 || rp.getValue() > 0;
+ (positive ? doc.beautiConfig.hyperPriorTemplate : doc.beautiConfig.realHyperPriorTemplate).createSubNet(context, true);
}
hardSync();
refreshPanel();