diff options
Diffstat (limited to 'plip/test')
-rw-r--r-- | plip/test/test_basic_functions.py | 39 | ||||
-rw-r--r-- | plip/test/test_command_line.py | 26 | ||||
-rw-r--r-- | plip/test/test_hydrogen_bonds.py | 16 | ||||
-rw-r--r-- | plip/test/test_literature_validated.py | 264 | ||||
-rw-r--r-- | plip/test/test_metal_coordination.py | 66 | ||||
-rw-r--r-- | plip/test/test_pi_stacking.py | 10 | ||||
-rw-r--r-- | plip/test/test_remote_services.py | 18 | ||||
-rw-r--r-- | plip/test/test_water_bridges.py | 8 | ||||
-rw-r--r-- | plip/test/test_xml_parser.py | 56 |
9 files changed, 274 insertions, 229 deletions
diff --git a/plip/test/test_basic_functions.py b/plip/test/test_basic_functions.py index 7134f55..ac6a012 100644 --- a/plip/test/test_basic_functions.py +++ b/plip/test/test_basic_functions.py @@ -21,13 +21,17 @@ class TestLigandSupport(unittest.TestCase): def test_dna_rna(self): """Test if DNA and RNA is correctly processed as ligands""" tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1tf6.pdb') + tmpmol.load_pdb("./pdb/1tf6.pdb") # DNA ligand four times consisting of 31 parts (composite) - self.assertEqual([len(ligand.members) for ligand in tmpmol.ligands].count(31), 4) - for ligset in [set((x[0] for x in ligand.members)) for ligand in tmpmol.ligands]: + self.assertEqual( + [len(ligand.members) for ligand in tmpmol.ligands].count(31), 4 + ) + for ligset in [ + set((x[0] for x in ligand.members)) for ligand in tmpmol.ligands + ]: if len(ligset) == 4: # DNA only contains four bases - self.assertEqual(ligset, {'DG', 'DC', 'DA', 'DT'}) + self.assertEqual(ligset, {"DG", "DC", "DA", "DT"}) class TestMapping(unittest.TestCase): @@ -36,34 +40,34 @@ class TestMapping(unittest.TestCase): def test_ids(self): """Test if the atom IDs are correctly mapped from internal to original PDB.""" tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1vsn.pdb') - bsid = 'NFT:A:283' + tmpmol.load_pdb("./pdb/1vsn.pdb") + bsid = "NFT:A:283" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] for contact in s.hydrophobic_contacts: - if contact.restype == 'ALA' and contact.resnr == 133: + if contact.restype == "ALA" and contact.resnr == 133: self.assertEqual(contact.ligatom_orig_idx, 1636) self.assertEqual(contact.bsatom_orig_idx, 994) - if contact.restype == 'ASP' and contact.resnr == 61: + if contact.restype == "ASP" and contact.resnr == 61: self.assertEqual(contact.ligatom_orig_idx, 1639) self.assertEqual(contact.bsatom_orig_idx, 448) for contact in s.hbonds_ldon + s.hbonds_pdon: - if contact.restype == 'GLN' and contact.resnr == 19: + if contact.restype == "GLN" and contact.resnr == 19: self.assertEqual(contact.a_orig_idx, 1649) self.assertEqual(contact.d_orig_idx, 153) - if contact.restype == 'CYS' and contact.resnr == 25: + if contact.restype == "CYS" and contact.resnr == 25: self.assertEqual(contact.a_orig_idx, 1649) self.assertEqual(contact.d_orig_idx, 183) - if contact.restype == 'ASN' and contact.resnr == 158: + if contact.restype == "ASN" and contact.resnr == 158: self.assertEqual(contact.d_orig_idx, 1629) self.assertEqual(contact.a_orig_idx, 1199) for contact in s.halogen_bonds: - if contact.restype == 'TYR' and contact.resnr == 67: + if contact.restype == "TYR" and contact.resnr == 67: self.assertEqual(contact.don.x_orig_idx, 1627) self.assertEqual(contact.acc.o_orig_idx, 485) - if contact.restype == 'LEU' and contact.resnr == 157: + if contact.restype == "LEU" and contact.resnr == 157: self.assertEqual(contact.don.x_orig_idx, 1628) self.assertEqual(contact.acc.o_orig_idx, 1191) @@ -72,7 +76,7 @@ class GeometryTest(unittest.TestCase): """Tests for geometrical calculations in PLIP""" def vector_magnitude(self, v): - return numpy.sqrt(sum(x**2 for x in v)) + return numpy.sqrt(sum(x ** 2 for x in v)) # noinspection PyUnusedLocal def setUp(self): @@ -132,4 +136,7 @@ class GeometryTest(unittest.TestCase): def test_cluster_doubles(self): """Tests for mathematics.cluster_doubles""" # Are the results correct? - self.assertEqual(set(cluster_doubles([(1, 3), (4, 1), (5, 6), (7, 5)])), {(1, 3, 4), (5, 6, 7)}) + self.assertEqual( + set(cluster_doubles([(1, 3), (4, 1), (5, 6), (7, 5)])), + {(1, 3, 4), (5, 6, 7)}, + ) diff --git a/plip/test/test_command_line.py b/plip/test/test_command_line.py index 5d8e8e5..3e27943 100644 --- a/plip/test/test_command_line.py +++ b/plip/test/test_command_line.py @@ -20,29 +20,39 @@ class CommandLineTest(unittest.TestCase): def test_empty_input_file(self): """Input file is empty.""" - exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -f ./special/empty.pdb -o {self.tmp_dir.name}', - shell=True) + exitcode = subprocess.call( + f"{sys.executable} ../plipcmd.py -f ./special/empty.pdb -o {self.tmp_dir.name}", + shell=True, + ) self.assertEqual(exitcode, 1) def test_invalid_pdb_id(self): """A PDB ID with no valid PDB record is provided.""" - exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -i xx1x -o {self.tmp_dir.name}', shell=True) + exitcode = subprocess.call( + f"{sys.executable} ../plipcmd.py -i xx1x -o {self.tmp_dir.name}", shell=True + ) self.assertEqual(exitcode, 1) def test_invalid_input_file(self): """A file is provided which is not a PDB file.""" - exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -f ./special/non-pdb.pdb -o {self.tmp_dir.name}', - shell=True) + exitcode = subprocess.call( + f"{sys.executable} ../plipcmd.py -f ./special/non-pdb.pdb -o {self.tmp_dir.name}", + shell=True, + ) self.assertEqual(exitcode, 1) def test_pdb_format_not_available(self): """A valid PDB ID is provided, but there is no entry in PDB format from wwPDB""" - exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -i 4v59 -o {self.tmp_dir.name}', shell=True) + exitcode = subprocess.call( + f"{sys.executable} ../plipcmd.py -i 4v59 -o {self.tmp_dir.name}", shell=True + ) self.assertEqual(exitcode, 1) def test_valid_pdb(self): """A PDB ID with no valid PDB record is provided.""" - exitcode = subprocess.call(f'{sys.executable} ../plipcmd.py -x -f ./pdb/1eve.pdb -o {self.tmp_dir.name}', - shell=True) + exitcode = subprocess.call( + f"{sys.executable} ../plipcmd.py -x -f ./pdb/1eve.pdb -o {self.tmp_dir.name}", + shell=True, + ) self.assertEqual(len(os.listdir(self.tmp_dir.name)), 2) self.assertEqual(exitcode, 0) diff --git a/plip/test/test_hydrogen_bonds.py b/plip/test/test_hydrogen_bonds.py index 9d68532..f673c6e 100644 --- a/plip/test/test_hydrogen_bonds.py +++ b/plip/test/test_hydrogen_bonds.py @@ -8,31 +8,35 @@ def characterize_complex(pdb_file: str, binding_site_id: str) -> PLInteraction: pdb_complex = PDBComplex() pdb_complex.load_pdb(pdb_file) for ligand in pdb_complex.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == binding_site_id: + if ( + ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) + == binding_site_id + ): pdb_complex.characterize_complex(ligand) return pdb_complex.interaction_sets[binding_site_id] class HydrogenBondTestCase(unittest.TestCase): - def test_4dst_nondeterministic_protonation(self): config.NOHYDRO = False for i in range(0, 10): - interactions = characterize_complex('./pdb/4dst.pdb', 'GCP:A:202') + interactions = characterize_complex("./pdb/4dst.pdb", "GCP:A:202") all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon self.assertTrue(len(all_hbonds) == 16 or len(all_hbonds) == 17) def test_4dst_deterministic_protonation(self): config.NOHYDRO = True for i in range(0, 10): - interactions = characterize_complex('./pdb/4dst_protonated.pdb', 'GCP:A:202') + interactions = characterize_complex( + "./pdb/4dst_protonated.pdb", "GCP:A:202" + ) all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon self.assertTrue(len(all_hbonds) == 16) def test_no_protonation(self): config.NOHYDRO = True - interactions1 = characterize_complex('./pdb/1x0n_state_1.pdb', 'DTF:A:174') + interactions1 = characterize_complex("./pdb/1x0n_state_1.pdb", "DTF:A:174") self.assertEqual(len(interactions1.hbonds_ldon), 0) config.NOHYDRO = False - interactions2 = characterize_complex('./pdb/1x0n_state_1.pdb', 'DTF:A:174') + interactions2 = characterize_complex("./pdb/1x0n_state_1.pdb", "DTF:A:174") self.assertEqual(len(interactions2.hbonds_ldon), 1) diff --git a/plip/test/test_literature_validated.py b/plip/test/test_literature_validated.py index f3f7cbc..d49dba5 100644 --- a/plip/test/test_literature_validated.py +++ b/plip/test/test_literature_validated.py @@ -21,10 +21,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Chakrabarti et al. Geometry of nonbonded interactions involving planar groups in proteins. (2007) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1eve.pdb') - bsid = 'E20:A:2001' + tmpmol.load_pdb("./pdb/1eve.pdb") + bsid = "E20:A:2001" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Aromatic stacking with Trp84 and Trp279 @@ -39,10 +39,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Chakrabarti et al. Geometry of nonbonded interactions involving planar groups in proteins. (2007) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1h2t.pdb') - bsid = 'GDP:Z:1151' + tmpmol.load_pdb("./pdb/1h2t.pdb") + bsid = "GDP:Z:1151" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Sandwiched pi-stacking involving Tyr20 and Tyr43 @@ -60,10 +60,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Betzi et al. Discovery of a potential allosteric ligand binding site in CDK2 (2012) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3pxf.pdb') - bsids = ['2AN:A:305', '2AN:A:304'] + tmpmol.load_pdb("./pdb/3pxf.pdb") + bsids = ["2AN:A:305", "2AN:A:304"] for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) in bsids: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) in bsids: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsids[0]] # 2AN:A:305 @@ -91,10 +91,10 @@ class LiteratureValidatedTest(unittest.TestCase): from Sinorhizobium meliloti in the liganded and unliganded-closed states. (2008) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2reg.pdb') - bsid = 'CHT:A:1' + tmpmol.load_pdb("./pdb/2reg.pdb") + bsid = "CHT:A:1" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Cation-pi interactions with Trp43, Trp90, Trp205, and Tyr119 @@ -109,10 +109,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Bird et al. Crystal structures of Varicella Zoster Virus Thyrimidine Kinase. (2003) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1osn.pdb') - bsid = 'BVP:A:500' + tmpmol.load_pdb("./pdb/1osn.pdb") + bsid = "BVP:A:500" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Sandwiched pi-stacking involving Phe93 and Phe139 @@ -128,10 +128,10 @@ class LiteratureValidatedTest(unittest.TestCase): has implications for antiviral therapy (2008) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2w0s.pdb') - bsid = 'BVP:B:1207' # Complex of BVDU with Magnesium Cofactor + tmpmol.load_pdb("./pdb/2w0s.pdb") + bsid = "BVP:B:1207" # Complex of BVDU with Magnesium Cofactor for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonding of Tyr101 and Arg72 @@ -152,10 +152,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Li et al. Identification of a potent and selective non-basic cathepsin K inhibitor. (2006) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1vsn.pdb') - bsid = 'NFT:A:283' + tmpmol.load_pdb("./pdb/1vsn.pdb") + bsid = "NFT:A:283" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonding to Gly66 @@ -167,10 +167,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: De Moliner et al. Alternative binding modes of an inhibitor to two different kinases. (2003) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1p5e.pdb') - bsid = 'TBS:A:301' + tmpmol.load_pdb("./pdb/1p5e.pdb") + bsid = "TBS:A:301" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Halogen Bonding of Ile10 and Leu83 @@ -183,10 +183,10 @@ class LiteratureValidatedTest(unittest.TestCase): acetylcholinesterase.. (1993) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1acj.pdb') - bsid = 'THA:A:999' + tmpmol.load_pdb("./pdb/1acj.pdb") + bsid = "THA:A:999" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # pi-stacking interaction with Phe330 and Trp84 @@ -199,10 +199,10 @@ class LiteratureValidatedTest(unittest.TestCase): glutamicum CgmR in Complex with Inducers and with an Operator. (2010) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2zoz.pdb') - bsid = 'ET:B:184' + tmpmol.load_pdb("./pdb/2zoz.pdb") + bsid = "ET:B:184" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # pi-stacking interaction with Trp63 and Phe147 @@ -219,10 +219,10 @@ class LiteratureValidatedTest(unittest.TestCase): RNA editing ligase 1. (2004) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1xdn.pdb') - bsid = 'ATP:A:501' + tmpmol.load_pdb("./pdb/1xdn.pdb") + bsid = "ATP:A:501" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Arg111, Ile61 (backbone), Asn92, Val88, Lys87 and Glu86# @@ -241,10 +241,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Peisach et al. Interaction of a Peptidomimetic Aminimide Inhibitor with Elastase. (1995) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1bma.pdb') - bsid = '0QH:A:256' + tmpmol.load_pdb("./pdb/1bma.pdb") + bsid = "0QH:A:256" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to val224 and Gln200 @@ -265,14 +265,16 @@ class LiteratureValidatedTest(unittest.TestCase): and Their Prodrugs As Antimalarial Agents (2004) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4rao.pdb') - bsid = '3L7:B:301' + tmpmol.load_pdb("./pdb/4rao.pdb") + bsid = "3L7:B:301" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Val187, Lys165, Thr141, Lys140, Gly139, Thr138, Asp137 - hbonds = {hbond.resnr for hbond in s.hbonds_pdon} # res nr 100, 68, 69 and 199 in alternative conformation, + hbonds = { + hbond.resnr for hbond in s.hbonds_pdon + } # res nr 100, 68, 69 and 199 in alternative conformation, self.assertTrue({137, 138, 139, 140, 141, 165, 187}.issubset(hbonds)) # Water bridges to Asp137, Thr141, Met142, Arg199 and Gly139 # res nr 199 and 142 in alternative conformation @@ -286,10 +288,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Bhattacharya et al. Structural basis of HIV-1 capsid recognition by PF74 and CPSF6(2014) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4qnb.pdb') - bsid = '1B0:A:301' + tmpmol.load_pdb("./pdb/4qnb.pdb") + bsid = "1B0:A:301" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Asn57 and Lys70 @@ -304,10 +306,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Zaware et al. Structural basis of HIV-1 capsid recognition by PF74 and CPSF6(2014) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4kya.pdb') - bsid = '1UG:E:702' + tmpmol.load_pdb("./pdb/4kya.pdb") + bsid = "1UG:E:702" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Ala609 @@ -329,10 +331,10 @@ class LiteratureValidatedTest(unittest.TestCase): implications for ligand binding and specificity(2002) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1n7g.pdb') - bsid = 'NDP:A:701' + tmpmol.load_pdb("./pdb/1n7g.pdb") + bsid = "NDP:A:701" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Thr37, Gly38, Gln39, Asp40, Arg60, Leu92, Asp91, Ser63, Leu92, Ala115, Ser117, @@ -340,7 +342,9 @@ class LiteratureValidatedTest(unittest.TestCase): # Publication give the Prediction for Asp91 as hydrogen bond, when this contains two acceptor atoms. hbonds = {hbond.resnr for hbond in s.hbonds_pdon} # #@todo Hbond to 128 not detected - self.assertTrue({37, 38, 39, 40, 92, 63, 92, 115, 117, 185, 189, 215, 220}.issubset(hbonds)) + self.assertTrue( + {37, 38, 39, 40, 92, 63, 92, 115, 117, 185, 189, 215, 220}.issubset(hbonds) + ) # Water bridges to Gly35, Thr37, Gly38, Asp40, Arg60, Arg61, Ser63, Asn66, Ser117, Tyr128, Lys189, Arg220 waterbridges = {wb.resnr for wb in s.water_bridges} # Hydrogen bonds to 35, 37, 38, 40, 63, 117, 128, 189, 220 not detected due to prioritization @@ -358,10 +362,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Tsuhako et al. The design, synthesis, and biological evaluation of PIM kinase inhibitors.(2012) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4alw.pdb') - bsid = 'HY7:A:1308' + tmpmol.load_pdb("./pdb/4alw.pdb") + bsid = "HY7:A:1308" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Asp186 @@ -377,10 +381,10 @@ class LiteratureValidatedTest(unittest.TestCase): for TMAO.(2013) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3o1h.pdb') - bsid = 'TMO:B:1' + tmpmol.load_pdb("./pdb/3o1h.pdb") + bsid = "TMO:B:1" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Trp45 @@ -396,10 +400,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Shikha et al. Mechanism of mismatch recognition revealed by human MutSĪ² bound to unpaired DNA loops.(2012) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3thy.pdb') - bsid = 'ADP:A:935' + tmpmol.load_pdb("./pdb/3thy.pdb") + bsid = "ADP:A:935" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Saltbridge to His295 and Lys675 @@ -414,10 +418,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Ash et al. The structure of an N11A mutant of the G-protein domain of FeoB.(2011) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3tah.pdb') - bsid = 'BGO:A:300' + tmpmol.load_pdb("./pdb/3tah.pdb") + bsid = "BGO:A:300" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Ala11, Lys14, Thr15, Ser16, Asp113, Met114, Ala143 and Asp113 @@ -434,10 +438,10 @@ class LiteratureValidatedTest(unittest.TestCase): kinase CK2 inhibitors in clinical trials for the treatment of cancer (2011). """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3r0t.pdb') - bsid = 'FU9:A:338' + tmpmol.load_pdb("./pdb/3r0t.pdb") + bsid = "FU9:A:338" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Val116 @@ -462,10 +466,10 @@ class LiteratureValidatedTest(unittest.TestCase): Redox Potentials of DesulfoVibrio Vulgaris Flavodoxin.(2002) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1aku.pdb') - bsid = 'FMN:A:150' + tmpmol.load_pdb("./pdb/1aku.pdb") + bsid = "FMN:A:150" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Thr59 @@ -488,10 +492,10 @@ class LiteratureValidatedTest(unittest.TestCase): 673, a potent inhibitor derived from dihydropyridophthalazinone.(2014) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4pjt.pdb') - bsid = '2YQ:D:1104' + tmpmol.load_pdb("./pdb/4pjt.pdb") + bsid = "2YQ:D:1104" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Gly863 @@ -506,15 +510,15 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Presnell et al. Oxyanion-Mediated Inhibition of Serine Proteases.(1998) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1bju.pdb') - bsid = 'GP6:A:910' + tmpmol.load_pdb("./pdb/1bju.pdb") + bsid = "GP6:A:910" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] - #@todo Publication show hydrogen bond interactions for Gly219 + # @todo Publication show hydrogen bond interactions for Gly219 # Hydrogen bonds to Ser190, Ser195, Gly219 and Asp189 - hbonds = {hbond.resnr for hbond in s.hbonds_pdon+s.hbonds_ldon} + hbonds = {hbond.resnr for hbond in s.hbonds_pdon + s.hbonds_ldon} self.assertTrue({189, 190, 195}.issubset(hbonds)) # Water bridges to Ser190 and Val227 # Water bridge to 190 not detected due to prioritization @@ -532,10 +536,10 @@ class LiteratureValidatedTest(unittest.TestCase): Reference: Wilcken et al. Halogen-Enriched Fragment Libraries as Leads for Drug Rescue of Mutant p53.(2012) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4agl.pdb') - bsid = 'P84:A:400' + tmpmol.load_pdb("./pdb/4agl.pdb") + bsid = "P84:A:400" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Water bridges to Val147 @@ -554,10 +558,10 @@ class LiteratureValidatedTest(unittest.TestCase): Pathway.(2007) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2efj.pdb') - bsid = '37T:A:502' + tmpmol.load_pdb("./pdb/2efj.pdb") + bsid = "37T:A:502" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bond to Ser237 @@ -573,10 +577,10 @@ class LiteratureValidatedTest(unittest.TestCase): inhibitor.(2006) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2iuz.pdb') - bsid = 'D1H:A:1440' + tmpmol.load_pdb("./pdb/2iuz.pdb") + bsid = "D1H:A:1440" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Trp137 @@ -597,10 +601,10 @@ class LiteratureValidatedTest(unittest.TestCase): phosphodiesterase type 5 (PDE5) inhibitors.(2011) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3shy.pdb') - bsid = '5FO:A:1' + tmpmol.load_pdb("./pdb/3shy.pdb") + bsid = "5FO:A:1" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Gln817 @@ -622,10 +626,10 @@ class LiteratureValidatedTest(unittest.TestCase): substrate recognition site constructed by rearrangement of hydrogen bond network..(1998) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1ay8.pdb') - bsid = 'PLP:A:413' + tmpmol.load_pdb("./pdb/1ay8.pdb") + bsid = "PLP:A:413" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds to Gly108, Thr109, Asn194 and Ser257 @@ -644,10 +648,10 @@ class LiteratureValidatedTest(unittest.TestCase): evolutionary path selected by the Lewis epitope..(2014) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/4rdl.pdb') - bsid = 'FUC:A:601' + tmpmol.load_pdb("./pdb/4rdl.pdb") + bsid = "FUC:A:601" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Instead of FUC-A-604 (sugar representative) # Water bridges to Asn395 @@ -670,18 +674,22 @@ class LiteratureValidatedTest(unittest.TestCase): with CGP 53820, a novel pseudosymmetric inhibitor (1995) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1hii.pdb') - bsid = 'C20:B:101' + tmpmol.load_pdb("./pdb/1hii.pdb") + bsid = "C20:B:101" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Water bridges - waterbridges = {str(wb.resnr)+wb.reschain for wb in s.water_bridges} - self.assertTrue({'50A', '50B'}.issubset(waterbridges)) # Bridging Ile-B50 and Ile-A50 with ligand + waterbridges = {str(wb.resnr) + wb.reschain for wb in s.water_bridges} + self.assertTrue( + {"50A", "50B"}.issubset(waterbridges) + ) # Bridging Ile-B50 and Ile-A50 with ligand # Hydrogen bonds - hbonds = {str(hbond.resnr)+hbond.reschain for hbond in s.hbonds_pdon+s.hbonds_ldon} - self.assertTrue({'27A', '27B', '29A', '48A', '48B'}.issubset(hbonds)) + hbonds = { + str(hbond.resnr) + hbond.reschain for hbond in s.hbonds_pdon + s.hbonds_ldon + } + self.assertTrue({"27A", "27B", "29A", "48A", "48B"}.issubset(hbonds)) # #@todo Publication mentions additional possible hydrogen bond with Asp28B # Hydrogen bonds with Asp-A25 are reported as a salt bridge as both partners have (potential) charges @@ -691,22 +699,28 @@ class LiteratureValidatedTest(unittest.TestCase): Diol Inhibitors of HIV-1 Protease (1994) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1hvi.pdb') - bsid = 'A77:A:800' + tmpmol.load_pdb("./pdb/1hvi.pdb") + bsid = "A77:A:800" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Water bridges - waterbridges = {str(wb.resnr)+wb.reschain for wb in s.water_bridges} + waterbridges = {str(wb.resnr) + wb.reschain for wb in s.water_bridges} # #@todo Water bridge with 50B not detected - self.assertTrue({'50A'}.issubset(waterbridges)) # Bridging Ile-B50 and Ile-A50 with ligand + self.assertTrue( + {"50A"}.issubset(waterbridges) + ) # Bridging Ile-B50 and Ile-A50 with ligand # pi-cation Interactions picat = {pication.resnr for pication in s.pication_laro} - self.assertEqual({8}, picat) # Described as weakly polar contact/stacking in paper + self.assertEqual( + {8}, picat + ) # Described as weakly polar contact/stacking in paper # Hydrogen bonds - hbonds = {str(hbond.resnr)+hbond.reschain for hbond in s.hbonds_pdon+s.hbonds_ldon} - self.assertTrue({'25B', '27A', '27B', '48A', '48B'}.issubset(hbonds)) + hbonds = { + str(hbond.resnr) + hbond.reschain for hbond in s.hbonds_pdon + s.hbonds_ldon + } + self.assertTrue({"25B", "27A", "27B", "48A", "48B"}.issubset(hbonds)) # #@todo Paper describes additional hydrogen bond with Asp25A def test_3o7g(self): @@ -715,16 +729,18 @@ class LiteratureValidatedTest(unittest.TestCase): melanoma (2010) """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/3og7.pdb') - bsid = '032:A:1' + tmpmol.load_pdb("./pdb/3og7.pdb") + bsid = "032:A:1" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrogen bonds - hbonds = {str(hbond.resnr)+hbond.reschain for hbond in s.hbonds_pdon+s.hbonds_ldon} + hbonds = { + str(hbond.resnr) + hbond.reschain for hbond in s.hbonds_pdon + s.hbonds_ldon + } # Additional hydrogen bond to residue 530A reported - self.assertTrue({'594A'}.issubset(hbonds)) + self.assertTrue({"594A"}.issubset(hbonds)) def test_1hpx(self): """ @@ -735,20 +751,22 @@ class LiteratureValidatedTest(unittest.TestCase): For residues in the B chain, the offset is -100 (e.g. Ile 50B in the PDB structure is Ile 150 in the paper). """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1hpx.pdb') - bsid = 'KNI:B:900' + tmpmol.load_pdb("./pdb/1hpx.pdb") + bsid = "KNI:B:900" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Hydrophobic contacts to Val82, Ile84, Ile150 as part of flap (S1, S1' sites) - hydroph = {str(hyd.resnr)+hyd.reschain for hyd in s.all_hydrophobic_contacts} - self.assertTrue({'82A', '84A', '50B'}.issubset(hydroph)) + hydroph = {str(hyd.resnr) + hyd.reschain for hyd in s.all_hydrophobic_contacts} + self.assertTrue({"82A", "84A", "50B"}.issubset(hydroph)) # Hydrogen bonds - hbonds = {str(hbond.resnr)+hbond.reschain for hbond in s.hbonds_ldon+s.hbonds_pdon} + hbonds = { + str(hbond.resnr) + hbond.reschain for hbond in s.hbonds_ldon + s.hbonds_pdon + } # Additional hbond to 25B not detected (low angle?) - self.assertTrue({'29B', '48B', '27B', '25A'}.issubset(hbonds)) + self.assertTrue({"29B", "48B", "27B", "25A"}.issubset(hbonds)) # Water bridges - waterbridges = {str(wb.resnr)+wb.reschain for wb in s.water_bridges} + waterbridges = {str(wb.resnr) + wb.reschain for wb in s.water_bridges} # Waterbridge with Gly27 is detected instead of Ala28/Asp29 - self.assertTrue({'50A', '50B', '29A'}.issubset(waterbridges)) + self.assertTrue({"50A", "50B", "29A"}.issubset(waterbridges)) diff --git a/plip/test/test_metal_coordination.py b/plip/test/test_metal_coordination.py index 424b8df..e054735 100644 --- a/plip/test/test_metal_coordination.py +++ b/plip/test/test_metal_coordination.py @@ -22,19 +22,19 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1rmd.pdb') - bsid = 'ZN:A:119' + tmpmol.load_pdb("./pdb/1rmd.pdb") + bsid = "ZN:A:119" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Coordination by three cysteines and one histidine of the protein metalres = [mres.restype for mres in s.metal_complexes] - self.assertEqual(metalres.count('CYS'), 3) - self.assertEqual(metalres.count('HIS'), 1) + self.assertEqual(metalres.count("CYS"), 3) + self.assertEqual(metalres.count("HIS"), 1) # Zn atom with tetrahedral geometry (coordination number 4) self.assertEqual(s.metal_complexes[0].coordination_num, 4) - self.assertEqual(s.metal_complexes[0].geometry, 'tetrahedral') + self.assertEqual(s.metal_complexes[0].geometry, "tetrahedral") def test_1rla(self): """Rat liver arginase, a binuclear manganese metalloenzyme (1rmd) @@ -42,20 +42,20 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1rla.pdb') - bsid = 'MN:A:500' + tmpmol.load_pdb("./pdb/1rla.pdb") + bsid = "MN:A:500" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Coordination by one histidine, three aspartic acid residues, and one water molecule metalres = [mres.restype for mres in s.metal_complexes] - self.assertEqual(metalres.count('HIS'), 1) - self.assertEqual(metalres.count('ASP'), 3) - self.assertEqual(metalres.count('HOH'), 1) + self.assertEqual(metalres.count("HIS"), 1) + self.assertEqual(metalres.count("ASP"), 3) + self.assertEqual(metalres.count("HOH"), 1) # Mn atom with square pyramidal geometry (coordination number 5) self.assertEqual(s.metal_complexes[0].coordination_num, 5) - self.assertEqual(s.metal_complexes[0].geometry, 'square.pyramidal') + self.assertEqual(s.metal_complexes[0].geometry, "square.pyramidal") def test_1het(self): """Liver alcohol deshydrogenase (1het) @@ -63,18 +63,18 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1het.pdb') - bsid = 'ZN:A:401' + tmpmol.load_pdb("./pdb/1het.pdb") + bsid = "ZN:A:401" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Coordination by four cysteines metalres = [mres.restype + str(mres.resnr) for mres in s.metal_complexes] - self.assertEqual(set(metalres), {'CYS97', 'CYS100', 'CYS103', 'CYS111'}) + self.assertEqual(set(metalres), {"CYS97", "CYS100", "CYS103", "CYS111"}) # Zn atom with tetrahedral geometry (coordination number 4) self.assertEqual(s.metal_complexes[0].coordination_num, 4) - self.assertEqual(s.metal_complexes[0].geometry, 'tetrahedral') + self.assertEqual(s.metal_complexes[0].geometry, "tetrahedral") def test_1vfy(self): """Phosphatidylinositol-3-phosphate binding FYVE domain of VPS27P protein (1vfy) @@ -82,18 +82,18 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/1vfy.pdb') - bsid = 'ZN:A:300' + tmpmol.load_pdb("./pdb/1vfy.pdb") + bsid = "ZN:A:300" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Coordination by four cysteines metalres = [mres.restype for mres in s.metal_complexes] - self.assertEqual(set(metalres), {'CYS'}) + self.assertEqual(set(metalres), {"CYS"}) # Zn atom with tetrahedral geometry (coordination number 4) self.assertEqual(s.metal_complexes[0].coordination_num, 4) - self.assertEqual(s.metal_complexes[0].geometry, 'tetrahedral') + self.assertEqual(s.metal_complexes[0].geometry, "tetrahedral") def test_2pvb(self): """Pike parvalbumin binding calcium (2pvb) @@ -101,15 +101,15 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2pvb.pdb') - bsid = 'CA:A:110' + tmpmol.load_pdb("./pdb/2pvb.pdb") + bsid = "CA:A:110" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Ca atom with square pyramidal geometry (coordination number 5) self.assertEqual(s.metal_complexes[0].coordination_num, 5) - self.assertEqual(s.metal_complexes[0].geometry, 'square.pyramidal') + self.assertEqual(s.metal_complexes[0].geometry, "square.pyramidal") def test_2q8q(self): """Crystal Structure of S. aureus IsdE complexed with heme (2q8q) @@ -117,16 +117,16 @@ class MetalCoordinationTest(unittest.TestCase): """ tmpmol = PDBComplex() - tmpmol.load_pdb('./pdb/2q8q.pdb') - bsid = 'HEM:A:300' + tmpmol.load_pdb("./pdb/2q8q.pdb") + bsid = "HEM:A:300" for ligand in tmpmol.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: + if ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) == bsid: tmpmol.characterize_complex(ligand) s = tmpmol.interaction_sets[bsid] # Coordination by four nitrogens of heme itself and one additional histidine from the protein metalres = [mres.restype for mres in s.metal_complexes] - self.assertEqual(metalres.count('HEM'), 4) - self.assertEqual(metalres.count('HIS'), 1) + self.assertEqual(metalres.count("HEM"), 4) + self.assertEqual(metalres.count("HIS"), 1) # Fe atom with square pyramidal geometry (coordination number 5) self.assertEqual(s.metal_complexes[0].coordination_num, 5) - self.assertEqual(s.metal_complexes[0].geometry, 'square.pyramidal') + self.assertEqual(s.metal_complexes[0].geometry, "square.pyramidal") diff --git a/plip/test/test_pi_stacking.py b/plip/test/test_pi_stacking.py index bb560a3..16409ef 100644 --- a/plip/test/test_pi_stacking.py +++ b/plip/test/test_pi_stacking.py @@ -8,18 +8,22 @@ def characterize_complex(pdb_file: str, binding_site_id: str) -> PLInteraction: pdb_complex = PDBComplex() pdb_complex.load_pdb(pdb_file) for ligand in pdb_complex.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == binding_site_id: + if ( + ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) + == binding_site_id + ): pdb_complex.characterize_complex(ligand) return pdb_complex.interaction_sets[binding_site_id] class RingDetectionTest(unittest.TestCase): - def test_consistent_ring_detection(self): config.NOHYDRO = True angles = set() for i in range(0, 10): - interactions = characterize_complex('./pdb/4dst_protonated.pdb', 'GCP:A:202') + interactions = characterize_complex( + "./pdb/4dst_protonated.pdb", "GCP:A:202" + ) angles.add(interactions.pistacking[0].angle) self.assertTrue(len(angles) == 1) config.NOHYDRO = False diff --git a/plip/test/test_remote_services.py b/plip/test/test_remote_services.py index d52bffc..9cd27b5 100644 --- a/plip/test/test_remote_services.py +++ b/plip/test/test_remote_services.py @@ -14,16 +14,16 @@ class TestPDB(unittest.TestCase): def test_pdb_entry_status(self): # 1a0v is an obsolete entry and is replaced by 1y46 - status, current_pdbid = check_pdb_status('1a0v') - self.assertEqual(status, 'OBSOLETE') - self.assertEqual(current_pdbid, '1y46') + status, current_pdbid = check_pdb_status("1a0v") + self.assertEqual(status, "OBSOLETE") + self.assertEqual(current_pdbid, "1y46") # 1vsn is an current entry - status, current_pdbid = check_pdb_status('1vsn') - self.assertEqual(status, 'CURRENT') - self.assertEqual(current_pdbid, '1vsn') + status, current_pdbid = check_pdb_status("1vsn") + self.assertEqual(status, "CURRENT") + self.assertEqual(current_pdbid, "1vsn") # xxxx is not an PDB entry - status, current_pdbid = check_pdb_status('xxxx') - self.assertEqual(status, 'UNKNOWN') - self.assertEqual(current_pdbid, 'xxxx') + status, current_pdbid = check_pdb_status("xxxx") + self.assertEqual(status, "UNKNOWN") + self.assertEqual(current_pdbid, "xxxx") diff --git a/plip/test/test_water_bridges.py b/plip/test/test_water_bridges.py index 24bf128..d820b59 100644 --- a/plip/test/test_water_bridges.py +++ b/plip/test/test_water_bridges.py @@ -7,14 +7,16 @@ def characterize_complex(pdb_file: str, binding_site_id: str) -> PLInteraction: pdb_complex = PDBComplex() pdb_complex.load_pdb(pdb_file) for ligand in pdb_complex.ligands: - if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == binding_site_id: + if ( + ":".join([ligand.hetid, ligand.chain, str(ligand.position)]) + == binding_site_id + ): pdb_complex.characterize_complex(ligand) return pdb_complex.interaction_sets[binding_site_id] class WaterBridgeTest(unittest.TestCase): - def test_3ems(self): - interactions = characterize_complex('./pdb/3ems.pdb', 'ARG:A:131') + interactions = characterize_complex("./pdb/3ems.pdb", "ARG:A:131") water_bridges = interactions.water_bridges self.assertEqual(len(water_bridges), 4) diff --git a/plip/test/test_xml_parser.py b/plip/test/test_xml_parser.py index 1f45daa..da99e50 100644 --- a/plip/test/test_xml_parser.py +++ b/plip/test/test_xml_parser.py @@ -13,27 +13,27 @@ class XMLParserTest(unittest.TestCase): """Checks if the XML parser is working correctly""" def setUp(self): - self.px = PlipXML('./xml/1vsn.report.xml') - self.bsite = self.px.bsites['NFT:A:283'] - self.smiles = 'CC(C)CC(NC(c1ccc(cc1)c1ccc(cc1)S(N)(=O)=O)C(F)(F)F)C(=O)NCC=N' + self.px = PlipXML("./xml/1vsn.report.xml") + self.bsite = self.px.bsites["NFT:A:283"] + self.smiles = "CC(C)CC(NC(c1ccc(cc1)c1ccc(cc1)S(N)(=O)=O)C(F)(F)F)C(=O)NCC=N" def test_general_information(self): """Test if general information is correctly parsed.""" - self.assertEqual(self.px.version, '1.4.2') - self.assertEqual(self.px.pdbid, '1VSN') + self.assertEqual(self.px.version, "1.4.2") + self.assertEqual(self.px.pdbid, "1VSN") self.assertFalse(self.px.fixed) - self.assertEqual(self.px.filename, '1vsn.pdb') + self.assertEqual(self.px.filename, "1vsn.pdb") self.assertEqual(self.px.excluded, []) def test_bsite_information(self): """Test if the binding site information is correctly parsed.""" - self.assertEqual(self.bsite.pdbid, '1VSN') - self.assertEqual(self.bsite.uniqueid, '1VSN:NFT:A:283') - self.assertEqual(self.bsite.hetid, 'NFT') - self.assertEqual(self.bsite.longname, 'NFT') - self.assertEqual(self.bsite.ligtype, 'SMALLMOLECULE') + self.assertEqual(self.bsite.pdbid, "1VSN") + self.assertEqual(self.bsite.uniqueid, "1VSN:NFT:A:283") + self.assertEqual(self.bsite.hetid, "NFT") + self.assertEqual(self.bsite.longname, "NFT") + self.assertEqual(self.bsite.ligtype, "SMALLMOLECULE") self.assertEqual(self.bsite.smiles, self.smiles) - self.assertEqual(self.bsite.members, ['NFT:A:283']) + self.assertEqual(self.bsite.members, ["NFT:A:283"]) self.assertFalse(self.bsite.composite) # ligand properties @@ -50,7 +50,7 @@ class XMLParserTest(unittest.TestCase): self.assertAlmostEqual(self.bsite.logp, 6, 0) # Atom mappings (non-exhaustive test) - lmap = self.bsite.mappings['pdb_to_smiles'] + lmap = self.bsite.mappings["pdb_to_smiles"] self.assertEqual(lmap[1625], 24) self.assertEqual(lmap[1649], 33) self.assertEqual(lmap[1617], 14) @@ -59,7 +59,7 @@ class XMLParserTest(unittest.TestCase): self.assertEqual(len(self.bsite.bs_res), 35) # Interacting chains - self.assertEqual(self.bsite.interacting_chains, ['A']) + self.assertEqual(self.bsite.interacting_chains, ["A"]) # Has Interactions? self.assertTrue(self.bsite.has_interactions, True) @@ -72,8 +72,8 @@ class XMLParserTest(unittest.TestCase): hydrophobic1 = self.bsite.hydrophobics[0] self.assertEqual(hydrophobic1.dist, 3.67) self.assertEqual(hydrophobic1.resnr, 61) - self.assertEqual(hydrophobic1.restype, 'ASP') - self.assertEqual(hydrophobic1.reschain, 'A') + self.assertEqual(hydrophobic1.restype, "ASP") + self.assertEqual(hydrophobic1.reschain, "A") self.assertEqual(hydrophobic1.ligcarbonidx, 1639) self.assertEqual(hydrophobic1.protcarbonidx, 448) self.assertEqual(hydrophobic1.ligcoo, (-7.395, 24.225, 6.614)) @@ -83,17 +83,17 @@ class XMLParserTest(unittest.TestCase): self.assertEqual(len(self.bsite.hbonds), 6) hbond1 = self.bsite.hbonds[0] self.assertEqual(hbond1.resnr, 19) - self.assertEqual(hbond1.restype, 'GLN') - self.assertEqual(hbond1.reschain, 'A') + self.assertEqual(hbond1.restype, "GLN") + self.assertEqual(hbond1.reschain, "A") self.assertTrue(hbond1.sidechain) self.assertEqual(hbond1.dist_h_a, 2.16) self.assertEqual(hbond1.dist_d_a, 3.11) self.assertEqual(hbond1.don_angle, 160.05) self.assertTrue(hbond1.protisdon) self.assertEqual(hbond1.donoridx, 153) - self.assertEqual(hbond1.donortype, 'Nam') + self.assertEqual(hbond1.donortype, "Nam") self.assertEqual(hbond1.acceptoridx, 1649) - self.assertEqual(hbond1.acceptortype, 'N2') + self.assertEqual(hbond1.acceptortype, "N2") self.assertEqual(hbond1.ligcoo, (2.820, 18.145, 6.806)) self.assertEqual(hbond1.protcoo, (3.976, 15.409, 7.712)) @@ -101,17 +101,17 @@ class XMLParserTest(unittest.TestCase): self.assertEqual(len(self.bsite.wbridges), 1) wbridge1 = self.bsite.wbridges[0] self.assertEqual(wbridge1.resnr, 159) - self.assertEqual(wbridge1.restype, 'HIS') - self.assertEqual(wbridge1.reschain, 'A') + self.assertEqual(wbridge1.restype, "HIS") + self.assertEqual(wbridge1.reschain, "A") self.assertEqual(wbridge1.dist_a_w, 3.67) self.assertEqual(wbridge1.dist_d_w, 3.13) self.assertEqual(wbridge1.don_angle, 126.73) self.assertEqual(wbridge1.water_angle, 116.36) self.assertTrue(wbridge1.protisdon) self.assertEqual(wbridge1.donor_idx, 1210) - self.assertEqual(wbridge1.donortype, 'Nar') + self.assertEqual(wbridge1.donortype, "Nar") self.assertEqual(wbridge1.acceptor_idx, 1649) - self.assertEqual(wbridge1.acceptortype, 'N2') + self.assertEqual(wbridge1.acceptortype, "N2") self.assertEqual(wbridge1.ligcoo, (2.820, 18.145, 6.806)) self.assertEqual(wbridge1.protcoo, (6.401, 19.307, 4.971)) self.assertEqual(wbridge1.watercoo, (3.860, 18.563, 3.309)) @@ -129,16 +129,16 @@ class XMLParserTest(unittest.TestCase): self.assertEqual(len(self.bsite.halogens), 2) hal1 = self.bsite.halogens[0] self.assertEqual(hal1.resnr, 67) - self.assertEqual(hal1.restype, 'TYR') - self.assertEqual(hal1.reschain, 'A') + self.assertEqual(hal1.restype, "TYR") + self.assertEqual(hal1.reschain, "A") self.assertTrue(hal1.sidechain) self.assertEqual(hal1.dist, 3.37) self.assertEqual(hal1.don_angle, 156.70) self.assertEqual(hal1.acc_angle, 100.53) self.assertEqual(hal1.don_idx, 1627) - self.assertEqual(hal1.donortype, 'F') + self.assertEqual(hal1.donortype, "F") self.assertEqual(hal1.acc_idx, 485) - self.assertEqual(hal1.acceptortype, 'O3') + self.assertEqual(hal1.acceptortype, "O3") self.assertEqual(hal1.ligcoo, (-1.862, 29.303, 4.507)) self.assertEqual(hal1.protcoo, (-1.005, 26.276, 3.287)) |