draw a simple trace log
make a presentable table
draw more complex graphs
Step 1: setting up a BEASTObject
The first thing to do is set up a class derived from beast.core.Runnable and specify inputs. To draw a trace of a single entry from a trace log we need to know
the file name of the log file
how much burnin to use
the entry of the trace log to plot
So, we need 3 inputs,
and implement the initAndValidate method, which just copies the Input values into local variables:
Step 2: Add Application
To make the class run, we just create a beast.app.util.Application and pass on this object and any command line arguments passed when starting:
The Application checks whether there are any command line arguments. If so, it assumes it is started from the CLI, and calls initAndValidate() followed by run() on the MiniTracer. If not, it pops up a dialog, where you can enter any information and after pressing the OK button, initAndValidate() and then run() are called.
Step 3: implement run()
The run() method does the actual work of loading the file, processing the data (not much here except finding the right column of the trace file) and writing an HTML page with a graph.
LogAnalyser loads trace logs from which you can get the data columns. Next, we write a bit of HTML that uses the Plotly library to plot a graph:
The only thing left now is to open the webpage in a browser. The Application.openUrl method allows you to do so conveniently:
The complete code is here.
Step 4: launching the App
To be able to launch the App, we need to add an entry in the version.xml file in the package, which looks something like this:
The version.xml file must be in the package directory to be picked up by the BEAST AppLauncher.
After the package is installed, you can start the app from the command line via the applauncher tool:
or via Beauti's File/Launch Apps, which open the AppLauncher dialog where you can pick the App from a list.
After selecting a file, adjusting any details and pressing OK, a console pops up showing progress in loading the trace log.
After it is finished, a web browser page should pop up that looks something like this:
Plotly lets you zoom in and scroll through the graph. Also, when you can edit the style of the graph by clicking the 'Edit' button in the graph:
An alternative is to use the CanvasJS library -- see implementation here, which looks something like this:
In the BeastApp package there is also an example for creating tables that look something like this:
There is even a dot-interpreter, which is used in the bModelTest package, and produces output that looks like so: