def comp_score(receptor_file, ligand_file): """Compute the Cornell score for a docking configuration.""" # Parse the two files pdb_receptor = parse_pdb(receptor_file) pdb_ligand = parse_pdb(ligand_file) # Create a pdb object for the docking pdb_docking = Pdb() for chainID in pdb_receptor.keys(): pdb_docking.add_chain("R" + chainID, pdb_receptor[chainID]) for chainID in pdb_ligand.keys(): pdb_docking.add_chain("L" + chainID, pdb_ligand[chainID]) # Create the Cornell ojbect for the docking cornell_dock = Cornell_calc(pdb_docking) # Split the list of atom's index between ligand and receptor last_receptor = len(pdb_receptor.get_atom_list()) last_ligand = len(pdb_ligand.get_atom_list()) receptor_idx = range(last_receptor) ligand_idx = range(last_receptor, last_receptor + last_ligand) #compute the score score = 0 for i in receptor_idx: for j in ligand_idx: score += cornell_dock.get_Eij(i, j) return score
def rmsdInterface(file_Ligand_Natif, file_Ligand_Soluce, listeIndices): PDB1 = pdb.parse_pdb(file_Ligand_Natif) PDB2 = pdb.parse_pdb(file_Ligand_Soluce) coord1 = PDB1.get_CA_Elems(listeIndices) coord2 = PDB1.get_CA_Elems(listeIndices) distanceMatrix = distances(coord2, coord2) return rmsd(distanceMatrix)
def rmsdLigant(file_Ligand_Natif, file_Ligand_Soluce): PDB1 = pdb.parse_pdb(file_Ligand_Natif) PDB2 = pdb.parse_pdb(file_Ligand_Soluce) coordCa1 = PDB1.get_CA() coordCa2 = PDB2.get_CA() distance = distances(coordCa1, coordCa2) return rmsd(distance)
def rmsdComplexe(file_Ligand_Natif, file_Ligand_Soluce, file_Rec_Natif): PDB1 = pdb.parse_pdb(file_Ligand_Natif) PDB2 = pdb.parse_pdb(file_Ligand_Soluce) PDB_REC = pdb.parse_pdb(file_Rec_Natif) coordCa_Ligand_Natif = PDB1.get_CA() coordCa_Ligand_Soluce = PDB2.get_CA() coordCa_REC = PDB_REC.get_CA() complexe = coordCa_REC + coordCa_Ligand_Natif solution = coordCa_REC + coordCa_Ligand_Soluce distance = distances(complexe, solution) return rmsd(distance)
from parser_pdb import parse_pdb from Protein import interface import os good_pdb = [] rec = parse_pdb("../data/Rec_natif.pdb") for pdb_file in os.listdir("../data"): important_residues = set({'39', '42', '29', '35', '76', '38'}) if (pdb_file.find("natif") == -1 and pdb_file != 'ex.pdb' and pdb_file.find(".pdb") != -1): print(pdb_file) # to follow the progression lig = parse_pdb("../data/" + pdb_file) if len( interface( rec.values()[0], lig.values()[0])[1].intersection(important_residues)) >= 4: good_pdb.append(pdb_file) good_pdb_file = open("../data/scoring_Cornell/good_pdb.txt", 'w') for pdb in good_pdb: good_pdb_file.write(pdb + '\n')
from Cornell import Cornell_calc from parser_pdb import parse_pdb from structureToolsProjPython import preparePDB official = preparePDB("../data/ex.pdb", "D") test = Cornell_calc(parse_pdb("../data/ex.pdb")) for chain in official["chains"]: for curres in official[chain]["reslist"]: for atomtype in official[chain][curres]["atomlist"]: atom = official[chain][curres][atomtype] id_at = int(atom['id']) - 1 if atom["charge"] != test.get_q(id_at): print (curres, official[chain][curres]["resname"], atomtype, "charge") print(id_at) if atom["vdw"] != test.get_r(id_at): print (curres, official[chain][curres]["resname"], atomtype, "vdw") print(id_at) if atom["epsilon"] != test.get_epsilon(id_at): print (curres, official[chain][curres]["resname"], atomtype, "epsilon") print(id_at) official = None official = preparePDB("../data/Lig_natif.pdb", "D") test = Cornell_calc(parse_pdb("../data/Lig_natif.pdb")) id_at = 0 for chain in official["chains"]: for curres in official[chain]["reslist"]: for atomtype in official[chain][curres]["atomlist"]: atom = official[chain][curres][atomtype] if atom["charge"] != test.get_q(id_at):