diff --git a/src/beastfx/app/tools/Application.java b/src/beastfx/app/tools/Application.java index aef33a1..113adaf 100644 --- a/src/beastfx/app/tools/Application.java +++ b/src/beastfx/app/tools/Application.java @@ -150,6 +150,10 @@ public Application(beast.base.inference.Runnable analyser, String[] suppressedIn /** default input used for argument parsing **/ protected Input defaultInput = null; + public void setDefaultInput(Input input) { + defaultInput = input; + } + /** * Arguments of the form -name value are processed by finding Inputs with * matching name and setting their value. @@ -254,7 +258,7 @@ public void parseArgs(String[] args, boolean sloppy) throws Exception { } } else { if (i == args.length - 1 && defaultInput != null) { - defaultInput.setValue(arg, null); + defaultInput.setValue(arg, myBeastObject); done = true; } } diff --git a/src/beastfx/app/treeannotator/TreeAnnotator2.java b/src/beastfx/app/treeannotator/TreeAnnotator2.java index 82c82bb..d8587a9 100644 --- a/src/beastfx/app/treeannotator/TreeAnnotator2.java +++ b/src/beastfx/app/treeannotator/TreeAnnotator2.java @@ -27,6 +27,8 @@ +import static beast.pkgmgmt.BEASTClassLoader.addServices; + import java.io.*; import java.util.*; @@ -72,7 +74,8 @@ public class TreeAnnotator2 extends beast.base.inference.Runnable { final public Input hpd2DInput = new Input<> ("hpd2D", "the HPD interval to be used for the bivariate traits"); final public Input nohpd2DInput = new Input<> ("nohpd2D", "suppress calculation of HPD intervals for the bivariate traits"); final public Input noSAInput = new Input<> ("noSA", "interpret the tree set as begin from a not being from a sampled ancestor analysis, even if there are zero branch lengths in the tree set"); - + final public Input> versionFileInput = new Input<> ("version_file", "Provide a version file containing a list of services to explicitly allow. (Useful for package development.)", new ArrayList<>()); + private final static BEASTVersion version = new BEASTVersion(); private final static boolean USE_R = false; @@ -87,7 +90,7 @@ public class TreeAnnotator2 extends beast.base.inference.Runnable { public TopologySettingService topologySettingService; private int burninPercentage; // arguments that do not set any input option - static public Input> filesInput = new Input<> ("file", "Specify the input filename and (optional) output file name" , new ArrayList<>()); + public Input> filesInput = new Input<> ("file", "Specify the input filename and (optional) output file name" , new ArrayList<>()); public abstract class TreeSet { public abstract boolean hasNext(); @@ -1254,13 +1257,12 @@ public static void main(String[] args) throws Exception { // return; // } - new Application(new TreeAnnotator2(), "Tree Annotator", args) { - @Override - public void parseArgs(String[] args, boolean sloppy) throws Exception { - defaultInput = filesInput; - super.parseArgs(args, true); - } - }; + TreeAnnotator2 annotator = new TreeAnnotator2(); + Application app = new Application(annotator); + app.setDefaultInput(annotator.filesInput); + app.parseArgs(args, true); + annotator.initAndValidate(); + annotator.run(); } @Override @@ -1271,6 +1273,10 @@ public void initAndValidate() { @Override public void run() throws Exception { + for (String versionFile : versionFileInput.get()) { + BEASTClassLoader.addServices(versionFile); + } + String targetTreeFileName = null; String inputFileName = null; String outputFileName = null; diff --git a/version.xml b/version.xml index f819881..c45596d 100644 --- a/version.xml +++ b/version.xml @@ -91,6 +91,19 @@ + + + + + + + + + + + + +