TrinotateWeb in a Docker container

TrinotateWeb shows some reports from Trinotate. I know very little about it (please don’t ask me how to run Trinotate or interpret your results), but I wanted to serve up the reports. To make the services we provide to end-users a little more portable and reproducable, we tend to wrap them up as Docker containers. Even if we don’t actually ever move the images/containers between hosts, the Dockerfile acts as ‘runnable documentation’ on how a key part of the service is setup.

We do a similar thing for private instances of SequenceServer when researchers want a convenient interface to BLAST search some of their private (hopefully eventually open !) sequence databases.

The container here is self-contained with the data baked in. You may not want this, but an immutable container containing the analysis is what we wanted.

The code lives here:


  • TrinotateAnno.sqlite – the database generated via Trinotate
  • lighttpd.conf (provided) – preconfigured, don’t edit.
FROM debian:buster-slim



RUN apt-get -y update && \
    apt-get install -y lighttpd libhtml-template-perl libdbd-sqlite3-perl && \
    rm -rf /var/lib/apt/lists/*

# Not required, using Debian packages instead
# RUN apt-get install -y cpanminus build-essential
# RUN cpanm -i DBI && \
#     cpanm -i HTML && \
#     cpanm -i HTML::Template && \
#     cpanm -i DBD::SQLite

RUN tar xvzf Trinotate-v${TRINOTATE_VERSION}.tar.gz && \
    rm Trinotate-v${TRINOTATE_VERSION}.tar.gz && \
    mv Trinotate-Trinotate-v${TRINOTATE_VERSION} Trinotate

COPY TrinotateAnno.sqlite /data/TrinotateAnno.sqlite 
COPY lighttpd.conf /app/lighttpd.conf

RUN chown -R www-data:www-data /app


ENTRYPOINT ["lighttpd", "-D", "-f", "/app/lighttpd.conf"]


On port 4569.

docker run --name DatasetName_Trinotate --restart=always -it -d -p 4569:80 trinotate:dataset_name

Use Apache to forward (proxy) to the container for a nice URL (eg /apps/trinotate/DatasetName), behind .htaccess.

Option: external data and config in a host directory

With a few small edits to the Dockerfile (comment out the Trinotate download and sqlite db COPY), you can instead use an external copy of Trinotate and a database on the host.
You might want this for data that is going to be in flux for a while, before baking it permanently in a container (?).

docker run --name DatasetName_Trinotate --rm -it -d -p 4569:80 -v $(pwd):/app -v /home/perry/bin/Trinotate-Trinotate-v3.1.1/:/app/Trinotate -v $(pwd)/TrinotateAnno.sqlite:/data/TrinotateAnno.sqlite trinotate:dataset_name

Apache config

Use this to forward incoming requests to /apps/trinotate/DatasetName/ -> the port on the Docker container (4569), with a custom htaccess file for Basic Auth.

    # /apps/trinotate/DatasetName
    <Proxy "http://localhost:4569/*">
      Order deny,allow
      Allow from all
      Authtype Basic
      Authname "Restricted Content"
      AuthUserFile /etc/apache2/htaccess/DatasetName
      Require valid-user

    RewriteEngine on

    # For TrinotateWeb inside a Docker container - absolute URLs mean /css and /js links break
    # when proxied, unless we use this RewriteCond trick detecting referrer. 
    RewriteCond "%{HTTP_REFERER}" ".**" [NV]
    RewriteRule ^/css/(.*)$ "http://localhost:4569/css/$1" [P]
    RewriteCond "%{HTTP_REFERER}" ".**" [NV]
    RewriteRule ^/js/(.*)$ "http://localhost:4569/js/$1" [P]
    RewriteRule ^/apps/trinotate/DatasetName$ /apps/trinotate/DatasetName/ [R]
    RewriteRule ^/apps/trinotate/DatasetName/(.*)$ "http://localhost:4569/$1" [P]

TrinotateWeb makes requests to – as of 28-Jun-2018 the certificates for HTTPS are currently expired. The user should visit first and accept the insecure certificate so that icons in TrinotateWeb load correctly.

mPartsRegistry : small update

I just made a small update to mPartsRegistry, the mobile interface I wrote to make browsing the Registry of Standard Biological Parts a little easier on smartphones.

This update adds a “Random Part” button – it’s mostly just so people who want to play with it without actually knowing a part ID can get some instant gratification. This is in addition to the quiet update I made a few months ago to replace jQTouch with JQuery Mobile, since jQTouch development stagnated for a while and never really properly supported most mobile browsers.

Wiider postmortem

I always intended to write this postmortem earlier … now three years after development ceased, I’m finally getting around to it. Warning – retrospective rambling ahead.

In mid 2007, Nintendo released the Opera-powered browser for their Wii gaming console which they called the Internet Channel. For many people, including myself, this was the first time they had been able to use “Internet on the TV”. Because of the typical viewing distance, low resolution for CRT-based televisions, and the unique navigation interface using the Wiimote, many web sites were functional but not particularly comfortable to use. Many sites targeted at desktop PCs were too complex and heavyweight for the Internet Channel, fonts were often too small such that cumbersome zooming and scrolling was required. I felt this was a good opportunity to write a Wii-browser specific app – in particular, I wanted a news reader that was comfortable to use in a lounge room setting, controlled via the Wiimote.

I started the Wiider project around Dec 2007, as the successor to a Wii-specific news aggregator service I had set up called WiiRSS. The last SVN commit for Wiider was in Dec 2008.

The goal of the Wiider project was to create a web-based news feed reader optimized for the Nintendo Wii Internet Channel. Features included:

  • Wii-friendly user interface – large TV friendly fonts, simple navigation
  • Cookie-less view-only access for a personal feed list (via ?key=xxx, bookmarked on the Wii once you’ve logged in)
  • Wiimote navigation controls, beyond what the browser provides
  • Painless image zooming (eg Lightbox)
  • RSS and ATOM feed support
  • Easy feed discovery using the Google Feed API
While I’ve since retired the project, I felt it would be good to document some of the insights I gained as a result of developing it.

Running a local JABAWS server for Jalview on Ubuntu (11.04 Natty)

The excellent Jalview sequence alignment visualization and editing tool has the ability to send a set of sequences to a multiple sequence alignment web service (“JABAWS”) and receive the results in a new alignment window. This is really convenient when you are doing lots of sequence analysis, and Geoff Barton’s group at the University of Dundee provide a JABAWS server that Jalview will use by default.

But maybe the Dundee server is down. Or maybe you think your local machine will do things faster. Or maybe you work on über secret sequences in some Faraday cage bunker with no permanent network connection. In each of these cases, you may want to run your own local JABAWS server and use that instead. In this case, read on.

Continue reading

A mobile interface to the Registry of Standard Biological Parts

Recently I developed a simple mobile interface to the Registry of Standard Biological Parts – the database that is currently the focal point for parts-based synthetic biology. I’ve called this mobile interface mPartsRegistry and I thought it would be worth outlining it’s features and sharing some notes about the project, in case someone else finds it useful.

mPartsRegistry is a simple interface to the Registry of Standard Biological Parts aimed at mobile smartphone browsers. It’s powered by the Parts Registry API, which provides a simple RESTful interface to key metadata about parts in the database. It features:

  • A simple interface tailored for mobile WebKit browsers (Android browser, mobile Safari, probably others). Web-based, zero-installation required.
  • Basic search of the Registry by part name.
  • “Favorite parts” to locally bookmark parts on your device.
  • Provides basic metadata associated with parts, including size, description, authors, DNA sequence, categories and availability.
  • Freely available and recyclable source code, released under the MIT License (fork it on GitHub).

The idea for a mobile interface to the Registry came out of a moment in the wet lab, where I was supervising the Monash iGEM team, and someone asked “How many basepairs is that part again ?”. I’ve found most ideas for smartphone apps in the lab a little contrived; nothing more than an excuse to jump on the Android or iOS app bandwagon, with limited practical utility. This was a situation where I could genuinely see a use for a simple mobile interface to look up some reference information, so I thought I’d create it.

The goal is not to completely replicate the functionality of the Registry (at this stage the API would not allow that anyhow), but to provide simple mobile-friendly interface to quickly look up important data about a Biobrick(tm) parts in a laboratory setting, where accessing a desktop computer is often less convenient. In this context, you generally know the part name (eg B0034) that is written on a tube, but would like to quickly lookup some details.

The project consists of two main parts: the web frontend, build using jQTouch and Django templates hosted on Google App Engine, and the parser backend ( that deals with directly querying the Registry API.

The application uses BeautifulSoup on the server side to parse the XML served by the Registry’s API. This parser may be useful as a generic Python interface to the Registry API for other projects, although it is not yet feature complete. Why parse the XML on the server rather than the client ? The Registry API does not offer JSONP callbacks, making direct client-to-API queries by a web app served from another domain tricky (Same Origin Policy, yadda yadda). While this probably could have been done in straight clientside Javascript if I’d used some type of cross-domain AJAX hack, parsing on the server side also opens the possibility in the future to ‘value-add’ to the data in some way, potentially incorporating extra data not served directly by the Registry API, before it’s sent to the client.

Google App Engine works as a cheap hosting solution for a low traffic app like this, which is likely to stay within the free quotas. Also, GAE supports Python, and I like Python. jQTouch makes for a reasonable cross-platform mobile web interface, since it is optimized for WebKit-based browsers. While officially jQTouch supports iPhone/iPod Touch and doesn’t have official Android support, in my hands it works well enough on Android (and in fact displayed some minor bugs on Mobile Safari that were not evident on Android). Typically when using jQTouch you are expected to load multiple ‘pages’ all into several div-sections, lumped into a single HTML document. jQTouch then does the Javascript+CSS magic to render fast page switching, which actually working within a single HTML document. Since the main action of this app is to ‘search’, we don’t yet know what the results page will be, so this nice feature of jQTouch is barely used.

Searching for the same part all the time can get annoying, so mPartsRegistry provides a simple ‘bookmarking’ feature where a list of favorite parts can be managed and stored on the device. This is implemented via HTML5 localStorage – if there was demand then this could easily be turned into server side storage, but I doubt it’s necessary. In the future, it might make sense to pre-cache the metadata for any of these “favorite parts” so that the fast page switching features in jQTouch can be used to full advantage.

Currently, the interface does not show information about sequence features, subparts and twins, however I plan to implement these at some point. The Registry API currently does not provide information about samples, literature references or lab groups, but once these are enabled I plan to support this metadata within mPartsRegistry too.

Okay, that’s all kids .. and remember .. take off your gloves before using your smartphone in the lab !