Skip to content

Commit

Permalink
clock rate fix first entry; extinction fraction beta prior
Browse files Browse the repository at this point in the history
  • Loading branch information
jordandouglas committed Aug 8, 2022
1 parent c631655 commit de281bd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
3 changes: 3 additions & 0 deletions fxtemplates/StarBeast3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ ClusterTree/clusterType//'>
<mergepoint id="aux-sb3-partitiontemplate"/>


<connect method="starbeast3.evolution.branchratemodel.StarBeast3Clock.estimateGeneClockRates" />





Expand Down
5 changes: 4 additions & 1 deletion fxtemplates/sb3TreePriors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ ExtinctionFractionPrior/index/=Priors/DeathRatePrior/'>
<distr spec="beast.base.inference.distribution.Uniform" lower="0.0" upper="10000.0"/>
</prior>
<prior id="ExtinctionFractionPrior.t:$(n)" x="@ExtinctionFraction.t:$(n)">
<distr spec="beast.base.inference.distribution.Uniform" lower="0.0" upper="1.0"/>
<Beta name="distr">
<alpha spec="parameter.RealParameter" lower="0.0">5.0</alpha>
<beta spec="parameter.RealParameter" lower="0.0">1.0</beta>
</Beta>
</prior>
Expand Down
37 changes: 24 additions & 13 deletions src/starbeast3/evolution/branchratemodel/StarBeast3Clock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -205,25 +207,34 @@ public double getRateForBranch(Node node) {
public static void estimateGeneClockRates(BeautiDoc doc) {



boolean first = true;
for (String str : doc.pluginmap.keySet()) {

// Find the StarBeast3Clocks
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);
}


}




}
Expand Down

0 comments on commit de281bd

Please # to comment.