The Wasabi web interface communicates with the web browser and its backend server using REST API (URL parameters). URL parameters are useful for customizing Wasabi and integrating it with other tools. For many examples below, you need a Wasabi user ID (the 6-character code at the end of user-specific Wasabi address) and a data set, preferably both the sequence alignment and its phylogeny (example dataset).
Wasabi interface commands
Wasabi can be given commands in a web browser using URL parameters. For example, the web address http://was.bi/userID?url=http://tinyurl.com/wasabi-example in a web browser will open Wasabi, and the parameter url=... will tell Wasabi to download and import a data file from the tinyurl address (replace userID with your Wasabi user id). The file link after url= can be anything that is accessible by the browser, e.g. an ftp site or a DropBox file. You can use multiple url= sources (e.g. separate files for tree and sequence data) and complex URLs (e.g. from Ensembl REST API) as long as any “&“symbols in the file link are encoded to “%26“.
Wasabi can be customized on launch also with other URL parameters:
- id=analysisID opens a dataset or a collection of datasets from any Wasabi user’s analysis library. Example: http://was.bi?id=tiger
disables Wasabi user interface elements and features. Example: disable=tools,logo,sharing disables the tools menu, sharing links and Wasabi logo.
- zoomlevel=1...6 sets the visualization window zoom level (smaller level shows more data)
- colorscheme=rainbow|greyscale|Taylor|Zappo|Clustal sets the coloring scheme for sequence sites
- font=Arial|Georgia|Tahoma|Verdana sets the font for drawing sequences
- maskcolor=dark|light|white sets the (background) coloring for masked sites
- nodelabel|leaflabel=label|branchlength|species|accession|C|S|... display metadata labels next to tree nodes or as leaf text.
Wasabi supports metadata tags embedded in various dataset file formats (Nexus, PhyloXML, extended Newick) that can be used to customize data visualization. For example, a tree node that is marked in datafile with <color>red</color> (PhyloXML) or [&&NHX:C=red] (Newick) will be colored red in Wasabi.
In addition to standard Newick NHX tags, Wasabi can import and display custom metadata tags:
- C|BC=red|255.0.0 colors the tree node/leaf (C) or its branch (BC). Use color names or rgb codes.
- Co=Y collapses the connected subtree.
- Vis=Y displays the ancestral sequence of the tree node (if included in the dataset).
- ND|G|TR|PR=id sets the leaf sequence node/gene/transcript/protein ID.
- PVAL=number associated p-value.
- NL=S|B|GN|NDG|PVAL|... displays the specified metadata tag as tree node/leaf label
Wasabi server commands
I addition to the Wasabi graphical interface, you can use programs or scripts to communicate with Wasabi server. This allows to programmatically send or retrieve data from your Wasabi analysis library and integrate Wasabi to command-line pipelines or web applications. Wasabi server accepts the following web requests and parameters:
GET requests for retrieving data.
Commands are sent as web URL: http://was.bi/command?parameters
Use callback parameter to get response in JSONP format (for cross-domain requests).
- getlibrary=userid get a list of analyses in the user userid library
- getdir=id get a list of files in the analysis id
- getanalysis=id&file=filename get a file filename (default: meta.txt) from an analysis id
POST requests for uploading data.
Commands and file data are sent as multipart webform.
Response is sent in JSON format.
- action=save userid=userid id=id file=text filename=fname writemode=new|child|sibling
send a datafile text to the analysis library of user userid. The file is stored as fname to a new analysis, optionally placed as the next (child) or alternative (sibling) step of the current analysis id.
Other parameters: name=... source=... parameters=[...] sets analysis metadata.
If datafile is omitted, an empty library folder (for a dataset collection) is created instead.
Returns: id of the created analysis (and a new userid if omitted from parameters).
Command line integration
Using PUT and GET requests, Wasabi can be used in command line with automation scripts.
Let’s assume that a Perl script called upload.pl looks like this:
$userid = $ARGV; $filename = $ARGV;
$url = 'http://was.bi';
$browser = 'google-chrome';
$command = "curl -F \"action=save\" -F \"userid=$userid\" -F \"file=\@$filename\" $url";
($parameters = `$command`) =~ s/.*\"id\": "(.+?)".*/$userid?id=$1/; #do POST request
`$browser $url/$parameters`; #do URL command in browser (using id from POST)
With the command perl upload.pl FooBar my_alignment.xml this script uploads data set my_alignment.xml to the Wasabi library of user FooBar and opens that in a web browser. A python version of the script is available in the downloads folder. Use with the command open_in_wasabi.py -u FooBar -x my_alignment.xml