diff --git a/modules/atom/test/test_pdb.py b/modules/atom/test/test_pdb.py index 21ed207cdd..7447dc9d88 100644 --- a/modules/atom/test/test_pdb.py +++ b/modules/atom/test/test_pdb.py @@ -81,6 +81,43 @@ def test_calpha_pdb_selector(self): bds = IMP.atom.get_internal_bonds(mp) self.assertEqual(len(bds), 0) + def test_cbeta_pdb_selector(self): + """Test CBetaPDBSelector""" + m = IMP.Model() + with self.open_input_file("input.pdb") as fh: + mp = IMP.atom.read_pdb(fh, m, IMP.atom.CBetaPDBSelector()) + self.assertEqual(len(m.get_particle_indexes()), 237) + ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) + self.assertEqual(len(ps), 117) + + def test_c_pdb_selector(self): + """Test CPDBSelector""" + m = IMP.Model() + with self.open_input_file("input.pdb") as fh: + mp = IMP.atom.read_pdb(fh, m, IMP.atom.CPDBSelector()) + self.assertEqual(len(m.get_particle_indexes()), 261) + ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) + self.assertEqual(len(ps), 129) + + def test_water_pdb_selector(self): + """Test WaterPDBSelector""" + m = IMP.Model() + with self.open_input_file("input.pdb") as fh: + mp = IMP.atom.read_pdb(fh, m, IMP.atom.WaterPDBSelector()) + self.assertEqual(len(m.get_particle_indexes()), 205) + ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) + self.assertEqual(len(ps), 101) + + def test_non_water_non_hydrogen_pdb_selector(self): + """Test NonWaterNonHydrogenPDBSelector""" + m = IMP.Model() + with self.open_input_file("input.pdb") as fh: + mp = IMP.atom.read_pdb( + fh, m, IMP.atom.NonWaterNonHydrogenPDBSelector()) + self.assertEqual(len(m.get_particle_indexes()), 1133) + ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) + self.assertEqual(len(ps), 1001) + def test_backbone_pdb_selector(self): """Test BackbonePDBSelector""" m = IMP.Model() @@ -105,6 +142,14 @@ def test_non_water_pdb_selector_dna(self): ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) self.assertEqual(len(ps), 3011) + def test_p_pdb_selector(self): + """Test PPDBSelector""" + m = IMP.Model() + with self.open_input_file("single_dna.pdb") as fh: + mp = IMP.atom.read_pdb(fh, m, IMP.atom.PPDBSelector()) + ps = IMP.atom.get_by_type(mp, IMP.atom.ATOM_TYPE) + self.assertEqual(len(ps), 146) + def test_read_non_water(self): """Check that the default pdb reader skips waters""" IMP.set_log_level(IMP.VERBOSE) @@ -149,6 +194,13 @@ def test_residue_type(self): fh, m, IMP.atom.ResidueTypePDBSelector(["MET"])) self.assertEqual(len(IMP.atom.get_leaves(mp)), 22) + def test_atom_pdb_selector(self): + """Test ATOMPDBSelector""" + m = IMP.Model() + mp = IMP.atom.read_pdb(self.get_input_file_name("protein_water.pdb"), + m, IMP.atom.ATOMPDBSelector()) + self.assertEqual(len(IMP.atom.get_leaves(mp)), 300) + def test_sel_logic(self): """Test boolean logic selectors""" m = IMP.Model()