Skip to content

Commit

Permalink
Improve regex pattern used for ATOM/HETATM records
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrellet committed Oct 10, 2018
1 parent 89cdab7 commit 191b999
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pdb_strict_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,21 @@
# Spec: http://www.wwpdb.org/documentation/file-format-content/format33/sect9.html#ATOM
re_ATOM = re.compile("""
(ATOM[\s]{2}|HETATM)
(?P<serial>[\d\s]{4}[0-9])
(?P<serial>[\d\s]{5})
[\s]{1}
(?P<atname>[\w\s\']{4})
(?P<atname>[\w\s\+\']{4})
(?P<altloc>[\w\s]{1})
(?P<resn>[\s\w]{3})
[\s]{1}
(?P<chain>[\w\s]{1})
(?P<resi>[\s\d]{3}[0-9])
(?P<resi>[\s\-?\d+$]{4})
(?P<icode>[\w\s]{1})
[\s]{3}
(?P<x>[\s\d\-]{4}\.[0-9]{3})
(?P<y>[\s\d\-]{4}\.[0-9]{3})
(?P<z>[\s\d\-]{4}\.[0-9]{3})
(?P<o>[\s\d\.\-]{3}\.[0-9]{2})
(?P<b>[\s\d\.\-]{3}\.[0-9]{2})
[\s]{6}
(?P<segid>[\w\s]{1})
[\s]{3}
(?P<x>[\s\d\.\-]{8})
(?P<y>[\s\d\.\-]{8})
(?P<z>[\s\d\.\-]{8})
(?P<o>[\s\d\.\-]{6})
(?P<b>[\s\d\.\-]{6})
""", re.VERBOSE)
# Taken from
# http://www.wwpdb.org/documentation/format33/v3.3.html
Expand Down

0 comments on commit 191b999

Please sign in to comment.