Skip to content

PDB parser ignores the element column #2422

@jbarnoud

Description

@jbarnoud

Related to #2420

Expected behavior

The penultimate field of the ATOM and HETATM records is the element symbol: http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM. The PDB reader should read that field when present and expose it through the elements topology attribute.

Actual behavior

The element field of a PDB file is ignored. This means the element must be guessed even when provided.

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PDB_full

u = mda.Universe(PDB_full)
u.atoms.elements
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-61-b55fd0543db8> in <module>
      4 
      5 u = mda.Universe(PDB_full)
----> 6 u.atoms.elements

~/dev/mdanalysis/package/MDAnalysis/core/groups.py in __getattr__(self, attr)
   2291             except selection.SelectionError:
   2292                 pass
-> 2293         raise AttributeError("{cls} has no attribute {attr}".format(
   2294             cls=self.__class__.__name__, attr=attr))
   2295 

AttributeError: AtomGroup has no attribute elements

Currently version of MDAnalysis

  • Which version are you using? 0.20.2-dev0 4adbd6c
  • Which version of Python (python -V)? '3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38) \n[GCC 7.3.0]'
  • Which operating system? Ubuntu 18.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions