[Biopython] subclassing SeqRecord

Peter Cock p.j.a.cock at googlemail.com
Tue Apr 26 12:15:22 EDT 2011


2011/4/26 Björn Johansson <bjorn_johansson at bio.uminho.pt>:
> Hi, I tried to subclass the SeqRecord object to make it take a new parameter
> which is a int describing the annealing position for a primer. I tried the
> code below, but it does not produce the result I want and it is also ugly,
> mostly where indicated. This question may be more about Python the
> BioPython, but I run into the wall here.

What I would expect you to do is just store this integer in the existing
SeqRecord's annotations dictionary.

> The comments in the code point out where it goes wrong.
>
> I have RTFM but in the Python docs, but I still did not figure this one out.
> I suspect that I am complicating things.
>
> If someone knows how to do this, I would be grateful!

You probably should use isinstance(x, SeqRecord) rather than type(x).

Peter



More information about the Biopython mailing list