def calculates(self, np): if (self.__isLocalSearch): np = self.__LocalSearch.initLocalProcess(np, self.__Ligand) auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + np.x), (self.__newSpaceCenter[1] + np.y), (self.__newSpaceCenter[2] + np.z)]) auxLigand.rotateByVector( Methods.spherePoint(1, np.sph_theta, np.sph_phi), np.theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, np.rotateAtoms[r]) self.__ScoreFx.traceScoring(auxLigand, np.score) else: auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + np.x), (self.__newSpaceCenter[1] + np.y), (self.__newSpaceCenter[2] + np.z)]) auxLigand.rotateByVector( Methods.spherePoint(1, np.sph_theta, np.sph_phi), np.theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, np.rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange( auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom], 3) atomV.y = round(auxLigand.y[atom], 3) atomV.z = round(auxLigand.z[atom], 3) auxPose.residue(auxPose.total_residue()).set_xyz( auxLigand.atom[atom], atomV) np.score = self.__ScoreFx.generateScoringByPose(auxPose, auxLigand) return np
def calculates(self, np): if(self.__isLocalSearch): np = self.__LocalSearch.initLocalProcess(np, self.__Ligand) auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + np.x), (self.__newSpaceCenter[1] + np.y), (self.__newSpaceCenter[2] + np.z)]) auxLigand.rotateByVector(Methods.spherePoint(1, np.sph_theta, np.sph_phi), np.theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, np.rotateAtoms[r]) self.__ScoreFx.traceScoring(auxLigand,np.score) else: auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + np.x), (self.__newSpaceCenter[1] + np.y), (self.__newSpaceCenter[2] + np.z)]) auxLigand.rotateByVector(Methods.spherePoint(1, np.sph_theta, np.sph_phi), np.theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, np.rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange(auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom],3) atomV.y = round(auxLigand.y[atom],3) atomV.z = round(auxLigand.z[atom],3) auxPose.residue(auxPose.total_residue()).set_xyz(auxLigand.atom[atom], atomV) np.score = self.__ScoreFx.generateScoringByPose(auxPose, auxLigand) return np
def recalculate(self, selectedPop, changeId=False): if(len(selectedPop)>0): for j in xrange(len(selectedPop)): auxLigand = copy.deepcopy(self.__ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + selectedPop[j].x), (self.__newSpaceCenter[1] + selectedPop[j].y), (self.__newSpaceCenter[2] + selectedPop[j].z)]) auxLigand.rotateByVector(Methods.spherePoint(1, selectedPop[j].sph_theta, selectedPop[j].sph_phi), selectedPop[j].theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, selectedPop[j].rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange(auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom],3) atomV.y = round(auxLigand.y[atom],3) atomV.z = round(auxLigand.z[atom],3) auxPose.residue(auxPose.total_residue()).set_xyz(auxLigand.atom[atom], atomV) selectedPop[j].score = self.__scoreFx.generateScoringByPose(auxPose, auxLigand) selectedPop.sort(key=lambda x: x.score, reverse=False) if(changeId): for k in xrange(len(selectedPop)): selectedPop[k].id = k return selectedPop
def getScoring(self, solution): auxLigand = copy.deepcopy(self.__ligand) auxLigand.traslateToPoint([(self.__spaceCenter[0] + solution.x), (self.__spaceCenter[1] + solution.y), (self.__spaceCenter[2] + solution.z)]) auxLigand.rotateByVector( Methods.spherePoint(1, solution.sph_theta, solution.sph_phi), solution.theta) for r in range(len(self.__ligand.rotationsPoints)): auxLigand.rotateSegment(r, solution.rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange(auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom], 3) atomV.y = round(auxLigand.y[atom], 3) atomV.z = round(auxLigand.z[atom], 3) auxPose.residue(auxPose.total_residue()).set_xyz( auxLigand.atom[atom], atomV) result = self.__scoreFx.generateScoringByPose(auxPose, auxLigand, False) return result
def applyChanges(self, solution): auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + solution.x), (self.__newSpaceCenter[1] + solution.y), (self.__newSpaceCenter[2] + solution.z)]) auxLigand.rotateByVector(Methods.spherePoint(1, solution.sph_theta, solution.sph_phi), solution.theta) for r in xrange(len(self.__Ligand.rotationsPoints)): auxLigand.rotateSegment(r, solution.rotateAtoms[r]) return auxLigand
def applyChanges(self, solution): auxLigand = copy.deepcopy(self.__Ligand) auxLigand.traslateToPoint([(self.__newSpaceCenter[0] + solution.x), (self.__newSpaceCenter[1] + solution.y), (self.__newSpaceCenter[2] + solution.z)]) auxLigand.rotateByVector( Methods.spherePoint(1, solution.sph_theta, solution.sph_phi), solution.theta) for r in xrange(len(self.__Ligand.rotationsPoints)): auxLigand.rotateSegment(r, solution.rotateAtoms[r]) return auxLigand
def getScoring(self, solution): auxLigand = copy.deepcopy(self.__ligand) auxLigand.traslateToPoint([(self.__spaceCenter[0] + solution.x), (self.__spaceCenter[1] + solution.y), (self.__spaceCenter[2] + solution.z)]) auxLigand.rotateByVector(Methods.spherePoint(1, solution.sph_theta, solution.sph_phi), solution.theta) for r in range(len(self.__ligand.rotationsPoints)): auxLigand.rotateSegment(r, solution.rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange(auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom],3) atomV.y = round(auxLigand.y[atom],3) atomV.z = round(auxLigand.z[atom],3) auxPose.residue(auxPose.total_residue()).set_xyz(auxLigand.atom[atom], atomV) result = self.__scoreFx.generateScoringByPose(auxPose, auxLigand, False) return result
def recalculate(self, selectedPop, changeId=False): if (len(selectedPop) > 0): for j in xrange(len(selectedPop)): auxLigand = copy.deepcopy(self.__ligand) auxLigand.traslateToPoint([ (self.__newSpaceCenter[0] + selectedPop[j].x), (self.__newSpaceCenter[1] + selectedPop[j].y), (self.__newSpaceCenter[2] + selectedPop[j].z) ]) auxLigand.rotateByVector( Methods.spherePoint(1, selectedPop[j].sph_theta, selectedPop[j].sph_phi), selectedPop[j].theta) for r in xrange(len(self.__rotateAtoms)): auxLigand.rotateSegment(r, selectedPop[j].rotateAtoms[r]) 'Score' auxPose = rosetta.core.pose.Pose() auxPose.assign(self.__pose_ligand) for atom in xrange( auxPose.residue(auxPose.total_residue()).natoms()): atomV = rosetta.numeric.xyzVector_Real() atomV.x = round(auxLigand.x[atom], 3) atomV.y = round(auxLigand.y[atom], 3) atomV.z = round(auxLigand.z[atom], 3) auxPose.residue(auxPose.total_residue()).set_xyz( auxLigand.atom[atom], atomV) selectedPop[j].score = self.__scoreFx.generateScoringByPose( auxPose, auxLigand) selectedPop.sort(key=lambda x: x.score, reverse=False) if (changeId): for k in xrange(len(selectedPop)): selectedPop[k].id = k return selectedPop
'Original Molecule' if (__onlyLigand): IO.writePDB("Ligand_" + ligandName + ".pdb", ligandOri, resultPath) else: IO.writeAllPDB(ligandName, protein, ligandOri, resultPath, True) 'Log' log = "" 'Generate Files' for i in range(len(listaGenes)): auxLigand = None auxLigand = copy.deepcopy(ligand) #auxLigand.traslateToPoint([listaGenes[i].x, listaGenes[i].y, listaGenes[i].z]) auxLigand.rotateByVector( Methods.spherePoint(1, listaGenes[i].sph_theta, listaGenes[i].sph_phi), listaGenes[i].theta) for l in range(len(ligand.rotationsPoints)): auxLigand.rotateSegment(l, listaGenes[i].rotateAtoms[l]) #if( len(ligand.rotationsPoints) > 0): # auxLigand.traslateToPoint(ligandPoint) 'RMSD' IO.writeAllPDB("result_aux.pdb", protein, auxLigand, resultPath) rmsd = scoringFx.getRMSD("original_" + __MoleculeName + ".pdb", "result_aux.pdb", tempPath, resultPath) 'Create Result' ligandOri.x = auxLigand.x[:] ligandOri.y = auxLigand.y[:]
'Original Molecule' if(__onlyLigand): IO.writePDB("Ligand_"+ligandName +".pdb",ligandOri,resultPath) else: IO.writeAllPDB(ligandName, protein, ligandOri, resultPath, True) 'Log' log = "" 'Generate Files' for i in range(len(listaGenes)): auxLigand = None auxLigand = copy.deepcopy(ligand) #auxLigand.traslateToPoint([listaGenes[i].x, listaGenes[i].y, listaGenes[i].z]) auxLigand.rotateByVector(Methods.spherePoint(1, listaGenes[i].sph_theta, listaGenes[i].sph_phi), listaGenes[i].theta) for l in range(len(ligand.rotationsPoints)): auxLigand.rotateSegment(l, listaGenes[i].rotateAtoms[l]) #if( len(ligand.rotationsPoints) > 0): # auxLigand.traslateToPoint(ligandPoint) 'RMSD' IO.writeAllPDB("result_aux.pdb", protein, auxLigand, resultPath) rmsd = scoringFx.getRMSD("original_" + __MoleculeName + ".pdb", "result_aux.pdb", tempPath, resultPath) 'Create Result' ligandOri.x = auxLigand.x[:] ligandOri.y = auxLigand.y[:] ligandOri.z = auxLigand.z[:]