[Biopython-dev] Atom.py - _assign_element function (small bug)

João Rodrigues anaryin at gmail.com
Tue Jan 25 15:00:19 UTC 2011

Hey all,

I stumbled upon a little bug today in this function. There's a formatting
argument missing in line 92:

                msg = "Could not assign element %r for Atom (name=%s) with
given element %r" \
                      % (*putative_element,* self.name, element)

Apart from this "typo", there's a problem with hydrogens. For example with
Glutamine, the hydrogens HE21 and HE22 (if present) fail to be assigned
decently with the current setting. I'm adding an additional condition to the
if-clause in line 77 to correct this. This correction now parses correctly
these hydrogens (and everyone else). The tests run fine too and I don't
think I should add anything to them either.

GLN 205
HE22 [  8.46199989  -1.04999995 -15.40400028] 4368
Final Assignment: H

I'm pushing this fix to my github atom-element branch, I guess that's easy
to cherry-pick?



More information about the Biopython-dev mailing list