Resource: You want REST with that GreenMamba?

When you set up a GreenMamba resource, you get not only a web interface for human users, but also a REST web service API meant for scripts to interact with your tool. The REST interface is such an integral part of GreenMamba, that it is not even optional – you get it whether you want it or not. However, since the purpose of setting up GreenMamba resources is to make your tools and databases accessible to others, we cannot think of a good reason why you would not want to expose them as web services when it takes no extra work.

To illustrate how command-line tools can be accessed as web services, we return to the Motifs tool described in an earlier blot post. In addition to having an HTML web interface, it is accessible as a REST web service through the following URL (here shown as a GET request for simplicity; POST requests are also supported):

motif=regular expression

The name and parameters for the web service map one-to-one to the resource name and command-line arguments specified in the inifile:

command : greenmamba/examples/ $motif @fasta

GreenMamba also provides a REST web service API around any database that you configure through the inifile, although it is admittedly not as elegant as it could be. However, there is not much need for an API in this case, as the database functionality of GreenMamba is only intended for databases that are so small that they can easily be downloaded in their entirety instead.

In case of a GreenMamba metatool there is not a corresponding web service per se. However, because a metatool is made up of a list of subtools that all have their individual sections in the inifile, each of the underlying tools has a REST web service. All the functionalities of a metatool are thus nonetheless exposed as web services.

It should be noted that the REST web services provided by GreenMamba return the output from the underlying tools as is. It may thus be worthwhile to change (or write a post-processing scripts for) tools so that they produce simple tabular output. This will both make GreenMamba format the output nicer in the HTML web interface and make the REST web services more usable.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s