# [BioPython] Substitution matrices

**Brad Chapman**
chapmanb@arches.uga.edu

*30 Sep 2000 08:25:55 EDT*

Hi Iddo:
>* I've been thinking about implementing a class for substitution
*>* matrices
*
Great!
>* I thought of a class with the following attributes:
*[excellent ideas for manipulating substitution matrices]
>* Thoughts? Suggestions? Is anybody already doing this?
*
A while back I was teaching myself dynamic programming and so I made up a
simple SubstitutionMatrix class which I used to deal with matrices. I
also parsed a ton of matrices into python dictionaries (exactly as you
describe!), so this might be something useful for you to start from, if
you want to make reuse of the stuff I've done. I put the code that I have
for this at:
http://www.bioinformatics.org/bradstuff/bp/NWAlign.tar.gz
What I have there that might be of interest to you is:
1. SubstitutionMatrix.py - A really simple class for modeling a
SubstitionMatrix
2. matrix_info.py - A whole ton of matrices as python dictionaries that
can be imported and used.
There is also a implementation of Needleman-Wunsch global alignment that
uses these matrices, so you can see them in use (Aside warning -- don't
use the alignment code to align over 300 residues or so, since I used
recursion to implement it and ran into some kind of recusion limit in
python).
I would be very happy for you to take over work on this, and you are
welcome to use any and all of my code (if you like any of it :-). I hope
this helps!
Brad