Skip to content

Commit

Permalink
fix issues with TreeAnnotator. fixes CompEvol/beast2#1143
Browse files Browse the repository at this point in the history
  • Loading branch information
rbouckaert committed Mar 20, 2024
1 parent f898660 commit 627864a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/beastfx/app/treeannotator/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,14 @@ public double getPosteriorLimit() {
}
}

public Target getTargetOption() {
for (Target t : Target.values()) {
if (t.toString().equals(treeType.getValue())) {
return t;
}
}
return null;
public String getTargetOption() {
return treeType.getValue();
// for (Target t : Target.values()) {
// if (t.toString().equals(treeType.getValue())) {
// return t;
// }
// }
// return null;
}

public String getHeightsOption() {
Expand Down
6 changes: 4 additions & 2 deletions src/beastfx/app/treeannotator/TAGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import beast.pkgmgmt.BEASTVersion;
import beastfx.app.beauti.ThemeProvider;
import beastfx.app.treeannotator.TreeAnnotator.Target;
import beastfx.app.treeannotator.services.UserTargetTreeTopologyService;
import beastfx.app.util.Console;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ButtonType;
Expand Down Expand Up @@ -101,11 +102,11 @@ public void run() {
}
double posteriorLimit = controller.getPosteriorLimit();
double hpd2D = 0.80;
Target targetOption = controller.getTargetOption();
String targetOption = controller.getTargetOption();
String heightsOption = controller.getHeightsOption();

String targetTreeFileName = controller.getTargetFileName();
if (targetOption == Target.USER_TARGET_TREE && targetTreeFileName == null) {
if (targetOption.equals(UserTargetTreeTopologyService.SERVICE_NAME) && targetTreeFileName == null) {
Log.err.println("No target file specified");
return;
}
Expand All @@ -125,6 +126,7 @@ public void run() {

try {
TreeAnnotator ta = new TreeAnnotator();
ta.topologyInput.setValue(targetOption, ta);
ta.heightInput.setValue(heightsOption, ta);
ta.run(burninPercentage,
lowMem,
Expand Down
2 changes: 1 addition & 1 deletion src/beastfx/app/treeannotator/TreeAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*/
public class TreeAnnotator extends beast.base.inference.Runnable {
final public Input<String> heightInput = new Input<> ("height", "name of the method for estimating node heights", "CA");
final public Input<Integer> burnInPercentageInput = new Input<>("burnin", "percentage of trees to used as burn-in (and will be ignored)", -1);
final public Input<Integer> burnInPercentageInput = new Input<>("burnin", "percentage of trees to used as burn-in (and will be ignored)", 10);
final public Input<Double> limitInput = new Input<>("limit", "the minimum posterior probability for a node to be annotated", 0.0);
final public Input<String> topologyInput = new Input<> ("topology", "name of the method for determining topology", "MCC");
final public Input<String> targetInput = new Input<> ("target", "target_file_name, specifies a user target tree to be annotated");
Expand Down

0 comments on commit 627864a

Please sign in to comment.