[Biopython-dev] Parsing "element" out of PDB file

Eric Talevich eric.talevich at gmail.com
Thu Jun 24 18:05:11 UTC 2010


On Thu, Jun 24, 2010 at 12:54 PM, Peter <biopython at maubp.freeserve.co.uk>wrote:

> On Thu, Jun 24, 2010 at 5:36 PM, João Rodrigues <anaryin at gmail.com> wrote:
> >>
> >> I wonder if using None or NAN would be better than zero here? Or just an
> >> exception. This is difficult for me to say without a better idea of what
> >> you will be using the atomic weights for.
> >>
> >
> > Right now I'm just using them for the center of mass calculation.
> >
>
> Well if you don't know an atom's mass, you can't calculate the real
> center of mass. Maybe this should throw an exception?
>

And the center of mass calculation was for coarse-graining structures,
right? What would be most useful there?

(a) Give unknown atoms a weight of 0.0, so CoM essentially disregards them
(b) Give unknown atoms a weight of None, and have CoM check for this and
disregard those atoms (similar effect) -- preferably issuing a warning
(c) Like (b), but CoM raises an exception
(d) Give CoM a keyword argument for how to treat this (e.g.
strict=True/False), so course-graining can be permissive but direct use of
CoM can raise an exception if desired. (However, if warnings are used then
the warnings module already lets you convert specific warnings into
exceptions.)


 >> On a separate point, if you have an old fashioned PDB file without the
> >> element column, you can probably work out the element anyway. ...
> >
> > From non HETATMs its possible from the first letter of the atom name (or
> it
> > is H if the first letter is a digit). For HETATMs, names match elements
> > IIRC.
> >
> > Do you think it's worth the try? It shouldn't be hard to write and the
> cases
> > where it would fail would be sporadic.
>
> Eric - what do you think?
>

Sounds useful to me. Where would it fail, and how should failures be
treated? Unrecognized atom names, and then issue a warning and leave the
element attribute blank? (See options above...)

Cheers,
Eric




More information about the Biopython-dev mailing list