Author Archives: James Casbon

something about me

pivot tables with sqlalchemy 1

If your database doesn’t support pivots, here is a quick technique to get pivot columns with sqlalchemy

import operator
from sqlalchemy.sql import case, func, select

def pivot_report(report, pivot_on=None, pivot_columns=None, pivot_func=func.sum,
non_pivot_columns=None, group_by=None):
“”" produce a pivot [...]

object ceremony, dynamic languages, JSON and algebraic data types 0

The reason most people end up using a dynamic language is to avoid the boilerplate associated with object creation. You know, typing “FileWriter fout = new FileWriter(”fred.txt”);” gets boring quickly. I think this is a good enough reason to move to another language on its own. This boilerplate is also sometimes called [...]

cogent: the unsung hero of bioinformatics and python 0

I recently started using cogent – the COmparative GENomics Toolkit and discovered that it is an excellent piece of kit. A google search for ‘python ensembl‘ doesn’t even show it at all, yet it definitely has the best bindings for ensembl avaiable in python – they’re based on sqlalchemy making it easy enough to [...]

Installing python bioinformatics tools with virtualenv and pip 2

Python seems to have developed a decent set of tools for quickly building development environments. I want to store my notes on how to get a good environment for bioinformatics set up quickly.
First of all, if you haven’t already, install virtualenv and pip. Both are easy installable. Now install virtualenv wrapper.
Now we [...]

More money… 0

My company has met its goals and secured a second tranche of VC money. To celebrate, we’ve even got a website: Population Genetics Technologies.

Making textmate virtualenv aware 1

So I am using textmate for my python development, but I wanted it to pick up any virtualenv configured in a project. Here’s how to hack the python bundle…
First off, the run script command needs to be aware of the virtualenv stuff. So open up the bundle editor, and replace this:
is_test_script = ENV["TM_FILEPATH"] [...]

An interesting new campaign 0

RentalRights looks like it is finally getting a campaign together to organise in support of people who rent. If you rent and live in the uk you should check it out. No other country seems to treat tenants so badly.

chimpy: MailChimp API for python 2

I needed to use MailChimp from a Django app, so I have knocked up a wrapper for their API. Come on over to the google code site for chimpy if it is useful to you.

Why you shouldn’t use BT business 0

My new office use BT for their ADSL. We had a problem with mail disappearing between people in the office. So I emailed BT and asked them what was happening. Before they would help, they needed three emails in the last 72 hours that had disappeared.
I provided three emails satisfying this criteria. [...]

TextMate with nose 0

If you want to use nose as your test runner while developing with TextMate, then you need the nosexml plugin. Install and then follow these instructions.