diff --git a/moldesign/_tests/data/3b5x.cif.bz2 b/moldesign/_tests/data/3b5x.cif.bz2 new file mode 100644 index 0000000..05dd98b Binary files /dev/null and b/moldesign/_tests/data/3b5x.cif.bz2 differ diff --git a/moldesign/_tests/test_pdb_processing.py b/moldesign/_tests/test_pdb_processing.py index 701112e..c7febe4 100644 --- a/moldesign/_tests/test_pdb_processing.py +++ b/moldesign/_tests/test_pdb_processing.py @@ -129,6 +129,13 @@ def test_single_chain_2p8w(): assert mol.chains['C'].num_residues == 1 assert mol.chains['C'].residues['GNP843'].num_atoms == 32 + +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), diff --git a/moldesign/molecules/residue.py b/moldesign/molecules/residue.py index 4bcc05e..b8325e9 100644 --- a/moldesign/molecules/residue.py +++ b/moldesign/molecules/residue.py @@ -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)