Skip to content

Commit

Permalink
Merge pull request #183 from Autodesk/missing-terminal-parsing
Browse files Browse the repository at this point in the history
Fix bug in chain detection
  • Loading branch information
avirshup authored Oct 11, 2017
2 parents 061a5a7 + 2e170b0 commit 5cbeab2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Binary file added moldesign/_tests/data/3b5x.cif.bz2
Binary file not shown.
8 changes: 8 additions & 0 deletions moldesign/_tests/test_pdb_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ def test_numeric_residue_name_1PYN(request, mol):
assert len(contents) == 1
assert list(contents.keys())[0] == '941'


def test_missing_atoms_3b5x():
mol = mdt.read(get_data_path('3b5x.cif.bz2'))
assert mol.num_chains == 2
assert mol.num_atoms == 1144
assert mol.num_residues == 1144


MISSINGRES_2JAJ = [('A', 'GLY', -4), ('A', 'PRO', -3), ('A', 'LEU', -2), ('A', 'GLY', -1),
('A', 'MET', 0), ('A', 'ALA', 1), ('A', 'GLY', 2), ('A', 'LEU', 3),
('A', 'GLY', 4), ('A', 'HIS', 5), ('A', 'PRO', 6), ('A', 'ALA', 7),
Expand Down
5 changes: 2 additions & 3 deletions moldesign/molecules/residue.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,10 @@ def _is_ending_residue(self):
except KeyError:
# If we're here, the residue is missing some atoms. We'll fall back to checking the
# next residues in line
if self.index == len(self.molecule.residues):
if self.index == len(self.molecule.residues) - 1:
return True
else:
print('WARNING: %s is missing expected atoms. Attempting to infer chain end' % \
self)
print('WARNING: %s is missing expected atoms. Attempting to infer chain end' % self)
nextres = self.molecule.residues[self.index + 1]
return not self._same_polymer(nextres)

Expand Down

0 comments on commit 5cbeab2

Please sign in to comment.