Wasabi uses Pline interface generator to integrate external command-line tools to the graphical analysis environment. This allows to extend Wasabi with custom tools using JSON-based program descriptions.
To add a command-line tool to a local Wasabi installation :
- Make a JSON description file (save as
plugin.json
) - Drop the JSON, program executable (and icon image) files to a new folder in the Wasabi
plugins
folder
To write your own plugin interface, refer to the API documentation and see some of the available plugin JSON files. You are welcome to make your plugin available on the public Wasabi by submitting it to the plugin repository.
Simple example
To better explain how the plugin file works, lets consider this quite naive Python script:
import sys filecontent = open(sys.argv[1]).read() open("output.fa", "w").write(filecontent.replace("-", "")) if(len(sys.argv)==3 and sys.argv[2]=="--count"): print "# of sequences:", filecontent.count(">")
Given an input fasta file, the algorithm removes all gap signs, stores the result to file (output.fa
), and (optionally) counts the number of input sequences.
The program can be described to Wasabi with the following JSON:
{ "program": "remove_gaps.py", "name": "Gaps remover", "outfile": "output.fa", "options": [ {"file": "current sequences", "option": "", "required": "Import sequence data"}, {"checkbox": "Count sequences", "option": "--count"} ] }
This program description specifies two inputs for remove_gaps.py
:
- an input file (required parameter)
- flag –count (optional parameter)
After plugin.json
and remove_gaps.py
have been dropped to a new folder in the Wasabi plugins folder, the program will appear in the Tools menu and the resulting interface will look like this:
After RUN button is clicked, the command-line program is launched, its status is shown on the Wasabi toolbar and the results will appear in the Analysis library. If “count sequences” checkbox was selected, the output.log
file in the Analysis library record will contain the count number.
I hope that by now I have convinced you that creating Wasabi plugins is fairly simple and straightforward. Of course, this minimal example did not show the full flexibility of the plugin system, like conditional option groups, input value filtering, dynamic interface (based on user input), graphical pipelines, etc. For more examples see the Pline homepage.