From de281bd0aebfacb57db19a6b1c5b2fc5690b6acb Mon Sep 17 00:00:00 2001 From: jordandouglas Date: Tue, 9 Aug 2022 11:26:41 +1200 Subject: [PATCH] clock rate fix first entry; extinction fraction beta prior --- fxtemplates/StarBeast3.xml | 3 ++ fxtemplates/sb3TreePriors.xml | 5 ++- .../branchratemodel/StarBeast3Clock.java | 37 ++++++++++++------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/fxtemplates/StarBeast3.xml b/fxtemplates/StarBeast3.xml index 4589838..10987d0 100644 --- a/fxtemplates/StarBeast3.xml +++ b/fxtemplates/StarBeast3.xml @@ -445,6 +445,9 @@ ClusterTree/clusterType//'> + + + diff --git a/fxtemplates/sb3TreePriors.xml b/fxtemplates/sb3TreePriors.xml index a820a5c..ddb0374 100644 --- a/fxtemplates/sb3TreePriors.xml +++ b/fxtemplates/sb3TreePriors.xml @@ -116,7 +116,10 @@ ExtinctionFractionPrior/index/=Priors/DeathRatePrior/'> - + + 5.0 + 1.0 + diff --git a/src/starbeast3/evolution/branchratemodel/StarBeast3Clock.java b/src/starbeast3/evolution/branchratemodel/StarBeast3Clock.java index 445e963..705cf2b 100644 --- a/src/starbeast3/evolution/branchratemodel/StarBeast3Clock.java +++ b/src/starbeast3/evolution/branchratemodel/StarBeast3Clock.java @@ -12,16 +12,18 @@ package starbeast3.evolution.branchratemodel; + +import beastfx.app.inputeditor.BeautiDoc; + import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Set; -import beastfx.app.inputeditor.BeautiDoc; import beast.base.core.BEASTInterface; import beast.base.core.Function; import beast.base.core.Input; -import beast.base.inference.CalculationNode; import beast.base.inference.StateNode; -import beast.base.inference.parameter.RealParameter; import beast.base.inference.util.InputUtil; import beast.base.core.Log; import beast.base.evolution.branchratemodel.BranchRateModel; @@ -205,6 +207,7 @@ public double getRateForBranch(Node node) { public static void estimateGeneClockRates(BeautiDoc doc) { + boolean first = true; for (String str : doc.pluginmap.keySet()) { @@ -212,18 +215,26 @@ public static void estimateGeneClockRates(BeautiDoc doc) { BEASTInterface obj = doc.pluginmap.get(str); if (obj instanceof StarBeast3Clock) { - // Get the clock rate StarBeast3Clock clock = (StarBeast3Clock)obj; - //if (first) { - //first=false; - //clock.meanRateInput.get().isEstimatedInput.set(false); - //}else { - if (clock.meanRateInput.get() instanceof StateNode) { - StateNode rp = (StateNode)clock.meanRateInput.get(); - //rp.isEstimatedInput.set(true); - } + if (clock.meanRateInput.get() != null && clock.meanRateInput.get() instanceof StateNode) { + + StateNode rp = (StateNode)clock.meanRateInput.get(); - //} + //rp.isEstimatedInput.set(true); + + + // Get the clock rate + if (first) { + first=false; + rp.isEstimatedInput.set(false); + }else { + rp.isEstimatedInput.set(true); + } + + + } + + }