[Biopython-dev] RNA Alphabet: request for comments
Kristian Rother
krother at rubor.de
Tue Jun 15 14:06:52 UTC 2010
Hi,
I've commited a proof-of-concept implementation how modified RNA bases
could be made compatible to Biopython Alphabets. Comments are very
welcome, especially because I had to change two lines in the Seq class to
make it work.
The code can be viewed on:
http://github.com/krother/biopython/commit/d9f942936d6165703512099a6a2d84452fea27aa
(on github: krother/biopython, branch rna_alphabet).
The two main classes are:
RNAAlphabetEntry(str) that contains different abbreviations for one base.
and
ModifiedRNAString(str) that behaves like a string except that it iterates
through RNAAlphabetEntry objects.
Thus, you can do:
>>> from Bio.Alphabet.ModifiedRNAAlphabet import modified_rna
>>> from Bio.Seq import Seq
>>> from Bio.RNA.ModifiedRNAString import ModifiedRNAString
>>>
>>> mod_seq = ModifiedRNAString('AA:"A')
>>> seq = Seq(mod_seq, modified_rna)
>>> for char in seq:
>>> print char
adenosine
adenosine
2-O-methyladenosine
1-methyladenosine
adenosine
(see Unit test for details).
Best Regards,
Kristian
More information about the Biopython-dev
mailing list