Commit 2436468b by Chodera

Fix issue with mutations when chain appears in multiple places in PDB file…

Fix issue with mutations when chain appears in multiple places in PDB file separated by other chains.
parent ccc80f18
......@@ -739,15 +739,16 @@ class PDBFixer(object):
"""
# First find residues based on our table of standard substitutions.
index_to_old_name = dict((r.index, r.name) for r in self.topology.residues())
index_to_new_residues = {}
chain_id_to_chain_number = dict((c.id, k) for k, c in enumerate(self.topology.chains()))
chain_number = chain_id_to_chain_number[chain_id]
chain = list(self.topology.chains())[chain_number]
resSeq_to_index = dict((int(r.id), k) for k, r in enumerate(chain.residues()))
chain_numbers = list()
resSeq_to_index = dict()
for (chain_number, chain) in enumerate(self.topology.chains()):
if chain.id == chain_id:
chain_numbers.append(chain_id)
for (residue_number, residue) in enumerate(chain.residues()):
resSeq_to_index[int(residue.id)] = residue_number
for mut_str in mutations:
old_name, resSeq, new_name = mut_str.split("-")
......
......@@ -47,8 +47,6 @@ def test_mutate_2():
desired_atom_names = set(["C", "N", "CA", "CB", "CG", "CD1", "CD2", "O", "H", "HA", "HB2", "HB3", "HD11", "HD12", "HD13", "HD21", "HD22", "HD23", "HG"])
assert atom_names == desired_atom_names, "Atom Names did not match for LEU 57"
@raises(ValueError)
def test_mutate_3_fails():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
......@@ -65,3 +63,7 @@ def test_mutate_5_fails():
fixer = pdbfixer.PDBFixer(pdbid='1VII')
fixer.applyMutations(["ALA-1000-GLY", "SER-56-ALA"], "A")
def test_mutate_multiple_copies_of_chain_A():
fixer = pdbfixer.PDBFixer(pdbid='1OL5')
fixer.applyMutations(['TPO-287-THR','TPO-288-THR'], "A")
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