A Greasemonkey script: Library Ezproxy Forwarder

Update: I’m typically using Google Chrome or Chromium these days, so it’s unlikely I’ll update this script in the future. For a similar extension for Chrome, try the EZProxy Redirect extension.

Many University libraries use some server software called Ezproxy to do authentication and arbitrate access to full-text online journal subscriptions. Essentially, Ezproxy uses some URL mangling, rewriting all hyperlinks, to pass traffic via the proxy (rather than using a conventional browser proxy setting). For example, http://www.sciencemag.org/cgi/content/full/313/5785/314 is changed to http://www.sciencemag.org.ezproxy.lib.unimelb.edu.au/cgi/content/full/313/5785/314 . If the user is not logged in to the proxy (ie has no fresh & valid cookie), a login screen is given before being forwarded to the journal site.

This plugin helps mangle URLs to add the proxy domain to outgoing links from various journal sites as well as NCBI PubMed (eg, like .ezproxy.lib.unimelb.edu.au), meaning that the user doesn’t actively have to go to their library site to follow “ezproxy-fied” links. It makes getting full-text articles via the institutional library proxy a more seamless experience (assuming that your library subscribes to the journal).

The plugin contains a list of journal and publisher sites at which it is active, plus some “special case” code for making sure only fulltext links outgoing from NCBI PubMed are handled. You can add your own journal sites as needed.

The user needs to edit the variable proxyname to make the script use their institutions EZproxy … I can’t really help you with that part, since I only know that my workplace (The University of Melbourne) uses .ezproxy.lib.unimelb.edu.au .. beyond that, you are on your own 🙂 !

I’ve uploaded the Library Ezproxy Forwarder script to Userscripts.org

Software review: producing two dimensional diagrams of membrane proteins

E. coli LamB, presented using TMRPres2D. Not that the cytoplasmic/extracellular labels are incorrect, and should say extracellular/periplasmic.

I recently needed to make a simple, two dimensional figure of a beta-barrel membrane protein. I went hunting for programs that might take a sequence and/or structure and produce a pretty looking diagram to save me constructing everything by hand. Here are two I found and tried.

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.

ResolveRef : looking at the logs

One of the nice features of Google App Engine is you can easily view logs for your application to quickly see requests generating errors. Browsing the logs of ResolveRef, I’ve been able to identify an few classes of query which for one reason or another, weren’t working.

Continue reading

Announcing ResolveRef on Google App Engine

About two weeks ago, tipped off by Neil, I heard about Google App Engine. I managed to get a beta account, and I’ve finally had a chance to do something (hopefully) useful with it.

In the absence of any quickly achievable ideas for a bioinformatics app, I ported over the OpenRef application I wrote on top of TurboGears a few months back.

Just like the original, the new app, ResolveRef, is essentially a RESTful way of doing PubMed queries.
Continue reading