[Biopython-dev] Fwd: [biopython] PDBParser fails with error "AttributeError: 'NoneType' object has no attribute 'get_fullname'" (#441)

Hongbo Zhu 朱宏博 macrozhu at gmail.com
Fri Dec 12 10:04:36 UTC 2014


it is caused by the occupancy value -1 in atom:

ATOM   1886  CA AHIS X 244     -26.757  46.527  49.179 -1.00 44.13           C

It is a disordered atom. in Atom.py,

class DisorderedAtom(DisorderedEntityWrapper):
    def __init__(self, id):
        self.last_occupancy=-1
        DisorderedEntityWrapper.__init__(self, id)


self.last_occupancy is initialized to -1 and later used to help decide
which disordered atom will be selected as representative:

    def disordered_add(self, atom):
        ...
        if occupancy>self.last_occupancy:
            self.last_occupancy=occupancy
            self.disordered_select(altloc)


Since the atom already has -1 occupancy, the comparison was not satisfied
and the atom is not selected though there was only one disordered atom at
that moment. Hence NoneType error.

The fix would to initialize self.last_occupancy to some value
unrealistically smaller (as occupancy value):

        self.last_occupancy=-999999

since occupancy value occupies col 55-60 (6 digits). It can never get
smaller than -999999 and this issue will never appear again.

cheers, Hongbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython-dev/attachments/20141212/b18bb0f0/attachment.html>


More information about the Biopython-dev mailing list