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