Commit 4e2daa1e by peastman Committed by GitHub

Merge pull request #184 from peastman/insertion

Improved handling of insertion codes
parents 9f93a85b a9feaed6
......@@ -599,12 +599,17 @@ class PDBFixer(object):
# Find the sequence of each chain, with gaps for missing residues.
for chain in chains:
minResidue = min(int(r.id) for r in chain.residues())
maxResidue = max(int(r.id) for r in chain.residues())
residues = [None]*(maxResidue-minResidue+1)
for r in chain.residues():
residues[int(r.id)-minResidue] = r.name
chainWithGaps[chain] = residues
residues = list(chain.residues())
ids = [int(r.id) for r in residues]
for i, res in enumerate(residues):
if res.insertionCode not in ('', ' '):
for j in range(i, len(residues)):
ids[j] += 1
minResidue = min(ids)
maxResidue = max(ids)
chainWithGaps[chain] = [None]*(maxResidue-minResidue+1)
for r, id in zip(residues, ids):
chainWithGaps[chain][id-minResidue] = r.name
# Try to find the chain that matches each sequence.
......
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