[Biopython] codon usage

Peter biopython at maubp.freeserve.co.uk
Fri Jan 15 18:07:43 UTC 2010


On Fri, Jan 15, 2010 at 4:07 PM, Anirban Bhattachariya <anbhat at utu.fi> wrote:
> Hi,
>
> I found this script on ... which is supposed to count codon usage and plot them
> in a bar plot but this not working since some of the modules used in the script
> does not exist anymore.

Hi Anirban,

Sadly that Pasteur Institute "Python course in Bioinformatics" is out of date.
We have tried emailing the authors about this, and I offered to help update
it - but so far I have had no reply. If anyone has current contact information
please get in touch.
http://www.pasteur.fr/recherche/unites/sis/formation/python/

Looking at the code there are several issues:

The built in python module string still exists but is considered
obsolete, string
methods are generally preferred.

Bio.Fasta still exists but is obsolete, that bit can be replaced with Bio.SeqIO
fairly easily. Not sure about the other bits (see below).

Numeric is also obsolete and no longer supported (it could use numpy
instead). See http://numpy.scipy.org/

Then for the plotting itself I would suggest maybe matplotlib instead of tkplot
(personal preference, I've never tried tkplot).
http://matplotlib.sourceforge.net/

There are examples of some simple plots using this in the current Biopython
tutorial:
http://biopython.org/DIST/docs/tutorial/Tutorial.html
http://biopython.org/DIST/docs/tutorial/Tutorial.pdf

The relevant background to this example is here, with a small
(compressed) example image where I can't read the captions:
http://www.pasteur.fr/recherche/unites/sis/formation/python/apas05.html#f_codon_freq

Have you seen a larger sample output image? It should be pretty easy to
recode this from scratch, but it would take a bit of "archaeology" to work
out what exactly the old code did.

It might be easier if you told us what you want to plot - a simple
bar chart with an entry for each of the possible 64 codons
(assuming non-ambiguous RNA or DNA is used)?

Peter



More information about the Biopython mailing list