Say, you have some post-processing classes written for your package and you want to make it available to users. Since the class is in your package, say mypackage.addon.jar and most likely you need classes from BEAST-core or other packages, it is a nuisance to set the class path from the command line. You’ll and up having to do something like
This is especially cumbersome to explain to users since these paths depend on where BEAST is installed and where packages are installed. These paths are operating system dependent. One solution to this is to use the BEAST AppStore. This is an application that comes with BEAST. It picks up information from the version.xml file. You specify an addonapp element with a description, class, default arguments and an icon. For example, the model-selection package contains an application to run a path sampling analysis, which is encoded like so:
When you start the AppStore, it will look like this:
If you launch it from the AppStore, you probably want to launch it as a GUI, since Windows and Mac users won’t be able to see any terminal input otherwise. You can write your own GUI in Swing or JavaFX if you like, but there are a few helper classes that make it very easy to write GUI applications with BEAST. The recipe is as follows:
Create a class for your App that derives from beast.core.Runnable.
Specify Inputs for each of the arguments for your application.
Implement the run() method to pick up values from inputs and run your app.
Create a class to launch the App.
Update the version.xml file
Path sample analyser application
Step 1: create class for App
The path sample analyser lives in the class beast.inference.PathSampleAnalyser and derives from beast.core.Runnable.
Step 2: specify inputs
For the path sample analyser, we need a root directory, alpha, number of steps and burnin as a percentage. So, we add the following Inputs to the class.
Step 3: implement run() method
The actual post-processing happens in the method estimateMarginalLikelihood. The run method just gather info from the inputs and passes it to that worker method.
Step 4: Create launcher class
Create a class to launch the App. This is the class that you register in the version.xml file. The following bit of code can be used as a template for your own app — just replace the class for the analyser variable and update name and title. It uses two utility classes beast.app.util.Application and beast.app.util.ConsoleApp (currently in the model-selection package, but it should probably move somewhere else). You can also suppress inputs that you do not want to expose to the user.
Update the version.xml file
Add an addonapp element to the version.xml file, so the AppStore can pick it up.
When launching the PathSampleAnalyser from the AppStore, it looks like this: