Skip to content

Commit

Permalink
Merge pull request #291 from stefdoerr/integer_resnames
Browse files Browse the repository at this point in the history
Fix bug and add support for integer resnames which exist in PDB
  • Loading branch information
Darren Curtis authored Jan 17, 2022
2 parents 470045c + af9686f commit 9189181
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pdb2pqr/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ def characters(self, text):
if text.isspace():
return
_LOGGER.debug(f"Got text for <{self.curelement}>: {text}")
# If this is a float, make it so
try:
value = float(str(text))
except ValueError:
value = str(text)

# If this is a float, make it so. Except for residue names which should stay string
value = str(text)
if self.curelement != "name":
try:
value = float(value)
except ValueError:
pass

# Special cases - lists and dictionaries
if self.curelement == "bond":
Expand Down

0 comments on commit 9189181

Please sign in to comment.