Commit 46ee62d9 authored by peastman's avatar peastman
Browse files

Better handle empty insertion codes

parent 9be26851
...@@ -372,7 +372,7 @@ class PDBFile(object): ...@@ -372,7 +372,7 @@ class PDBFile(object):
else: else:
atomName = atom.name atomName = atom.name
coords = positions[posIndex] coords = positions[posIndex]
line = "%s%5d %-4s %3s %s%4s%s %s%s%s 1.00 0.00 %2s " % ( line = "%s%5d %-4s %3s %s%4s%1s %s%s%s 1.00 0.00 %2s " % (
recordName, atomIndex%100000, atomName, resName, chainName, resId, resIC, _format_83(coords[0]), recordName, atomIndex%100000, atomName, resName, chainName, resId, resIC, _format_83(coords[0]),
_format_83(coords[1]), _format_83(coords[2]), symbol) _format_83(coords[1]), _format_83(coords[2]), symbol)
assert len(line) == 80, 'Fixed width overflow detected' assert len(line) == 80, 'Fixed width overflow detected'
......
...@@ -385,7 +385,7 @@ class PDBxFile(object): ...@@ -385,7 +385,7 @@ class PDBxFile(object):
for (resIndex, res) in enumerate(residues): for (resIndex, res) in enumerate(residues):
if keepIds: if keepIds:
resId = res.id resId = res.id
resIC = res.insertionCode resIC = (res.insertionCode if len(res.insertionCode) > 0 else '.')
else: else:
resId = resIndex + 1 resId = resIndex + 1
resIC = '.' resIC = '.'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment