Searching bioinformatic databases with YubNub

You may already be familiar with YubNub; it describes itself as “the social command line for the web”. Most commands consist of two (or more) words … one for the search engine, the other for the query.

For example, typing:

gg open science on friendfeed

into the YubNub search box searches Google for “open science on friendfeed“, via YubNub.

I thought I’d highlight a few life science- and bioinformatics-related YubNub commands I find myself using quite often in my day-to-day work. Some are commands I created, others someone else created. This is the beauty of YubNub … often someone has already made the ‘obvious’ command … it’s worth just trying to search with a command you expect to exist, since it often does.

Onward, with the list:

Continue reading

Setting up NCBI wwwblast on Ubuntu 8.04 (Hardy), Apache 2

Recently I needed to install NCBI wwwblast on my local workstation to enable some software that needed to interface with BLAST via the web service. It was straightforward to install, but I took some notes, because there were a few changes required with respect to the official wwwblast documentation at NCBI. These instructions are for Ubuntu 8.04, but probably will work with many recent flavours of Debian.
Continue reading

Mako templates in Google App Engine: seems to work for me

For some reason which I can’t really articulate, I’m not a huge fan of Django templating. I’d actually prefer to use Genshi with Google App Engine, but I need to wait until all the kinks are ironed out, since as far as I can tell it’s not quite working painlessly yet. Another templating option is Mako, which I’ve barely used, but I still prefer to Django templates. One nice thing about Mako: it’s faster than most Python templating engines out there. So, here’s a quickie on how I got Mako working with Google App Engine. It wasn’t tricky at all, but I thought I’d document it anyway.

Checkout Mako from SVN and copy the directory mako/lib/mako to the path of your application, eg, on Linux:

$ cp -r mako/lib/mako myapp

(where myapp is the directory that your GAE app lives in).

In your app, obviously you’ll need to import some parts of mako:

from mako.template import Template
 

Then, whenever you want to render a template as output (say, at the end of a ‘get’ or ‘post’ method .. see the GAE templating example for some context), call something like:

# a dictionary of variables to send to the template namespace
foo, bar = "some", "enthralling text"
template_values = {
  ‘some_foo’: foo,
  ‘some_bar’: bar
}

# index.mako is the template file in our GAE app directory
path = os.path.join(os.path.dirname(__file__), ‘index.mako’)
# make a new template instance
templ = Template(filename=path)
# unpack the dictionary to become keyword arguments and render
self.response.out.write(templ.render(**template_values))
 

An example of some template text that could go into index.mako could be:

<html><body>${some_foo} likes the ${some_bar}<br/></body></html>

One possible modification: I need to look into it, but defining your Template class (eg templ in the example above) in the main() function (maybe as a global) rather than instantiating it every time it is rendered would probably give better performance.