Skip to content

Commit

Permalink
Add checks for other PDBSelectors
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Oct 4, 2023
1 parent 22cc35e commit 69d1da1
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions modules/atom/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 69d1da1

Please sign in to comment.