[Biopython-dev] Bio.PDB.Residue.id

Hongbo Zhu macrozhu at gmail.com
Tue Jan 25 10:17:48 UTC 2011


I totally agree that removing hetero-flag from residue ID is a big API
change. I myself hate that very much when some other libraries I use
announce such API changes. That should always be carefully planned and kept
to minimal.

In my opinion, what's more realistic is to add an additional mechanism to
locate residues in PDB.Residue, in which no hetero-flag is required. That
is, in this mechanism, one can use just sequence identifier + icode.
Internally, PDB.Residue will first check whether residue (' ', seqnum,
icode) exists. If not, it checks all residues with non-empty hetero-flag.
Only if no residue with the sequence identifier + icode exsits (regardless
of the hetero-flag) does it throw an exception, rather than simply throw an
exception if  (' ', seqnum, icode) does not exists.

For instance, this can be realized by revising PDB.Chain._translate_id() to:

    def _translate_id(self, id):
        if type(id)==IntType:
            longid=(' ', id, ' ')
            if not self.has_id(longid):
                for r in self:
                    if r.id[0] != ' ' and r.id[1] == id and r.id[2] == ' ':
                        longid = r.id
        else:
            longid = id
        return longid


On Tue, Jan 25, 2011 at 10:40 AM, Kristian Rother <krother at rubor.de> wrote:

>
> Hi,
>
> In our group, we've been discussing the PDB.Residue.id issue a couple of
> times. The current notation is fine but it is unintuitive and hard to
> learn for newbies.
> We therefore use a wrapper that allows to access residues by one-string
> ids = str(identifier + icode), like '101', '101A', '3B' etc.
>
> I'm sure changing ids in PDB.Residue would break a lot of scripts people
> use. I could imagine some workarounds that allow ignoring the HETERO flag
> though. Would work for me. How about you?
>
> Best regards,
>   Kristian
>
> --
Hongbo



More information about the Biopython-dev mailing list