def testPDB_contactmap(self): # preparation pdb_native = atomset.PDB() pdb_native.initialise("tests/data/pdb_test_contact.pdb") symmetryEvaluator = sym.SymmetryContactMapEvaluator([]) # function to test contact_map, contacts = symmetryEvaluator.createContactMap( pdb_native, "AIN", 8) golden_contact_map = np.array([[1, 0, 0, 0], [0, 1, 1, 1]]) golden_contacts = pdb_native.countContacts("AIN", 8) np.testing.assert_array_equal(contact_map, golden_contact_map) self.assertEqual(golden_contacts, contacts)
PDBobj.initialise(snapshot, resname=resname, topology=topology_contents) yield PDBobj else: for cluster in clAcc.clusters.clusters: yield cluster.pdb if __name__ == "__main__": traj_name, clustering, nRes, lig_resname, contactThreshold, top = parseArguments() if clustering is None: clusterAcc = None else: clusetrAcc = utilities.readClusteringObject(clustering) totalAcc = [] symEval = SymmetryContactMapEvaluator.SymmetryContactMapEvaluator() refPDB = None for pdb in generateConformations(lig_resname, clusetrAcc, traj_name, top): if refPDB is None: refPDB = pdb contactMap, foo = symEval.createContactMap(pdb, lig_resname, contactThreshold) if len(totalAcc): totalAcc += contactMap.sum(axis=0, dtype=bool).astype(int) else: totalAcc = contactMap.sum(axis=0, dtype=bool).astype(int) proteinList = symEval.proteinList residueCounts = {} totCounts = 0 for atomID, counts in zip(proteinList, totalAcc):