コード例 #1
0
 def dummy(self):
     with pymol2.PyMOL() as pymol:
         pymol.cmd.load(self.params_file.replace('.params', '.pdb'),
                        'ligand')
         pymol.cmd.fab('ACA', chain='A')
         pymol.cmd.alter('resn LIG', 'chain="B"')
         pymol.cmd.alter('resn LIG', 'resi="1"')
         pymol.cmd.sort()
         for atom in pymol.cmd.get_model('resn LIG').atom:
             pymol.cmd.translate([random.random() for i in range(3)],
                                 f'resn LIG and name {atom.name}')
         dummy = pymol.cmd.get_pdbstr('*')
     if self.is_covalent():
         dummy = f'LINK         SG  CYS A   2                {self.covalent_atomname} LIG B   1     1555   1555  1.8\n' + dummy
     pyrosetta.init(
         extra_options=
         '-load_PDB_components false -no_optH true -relax:jump_move true')
     pose = pyrosetta.Pose()
     params_paths = pyrosetta.rosetta.utility.vector1_string()
     params_paths.extend([f"{self.name}.params"])
     pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, dummy)
     pose.dump_pdb(f'test_{self.name}.0.pdb')
     self.do_relax(pose)
     pose.dump_pdb(f'test_{self.name}.1.pdb')
     #pyrosetta.rosetta.protocols.docking.ConformerSwitchMover().apply(pose)
     docking = pyrosetta.rosetta.protocols.docking.DockMCMProtocol().apply(
         pose)
     pose.dump_pdb(f'test_{self.name}.2.pdb')
コード例 #2
0
 def snap_shot(self):
     with pymol2.PyMOL() as pymol:
         pymol.cmd.bg_color('white')
         pymol.cmd.load(f'{self.work_path}/{self.name}/pre_{self.name}.pdb',
                        'pre')
         for k in ('pre', 'min'):  #('min1','min2', 'docked'):
             pymol.cmd.load(
                 f'{self.work_path}/{self.name}/{k}_{self.name}.pdb', k)
         for hit in self.hits:
             pymol.cmd.load(hit.bound_file)
         # pymol.cmd.read_pdbstr(Chem.MolToPDBBlock(self.fragmenstein.positioned_mol), 'scaffold')
         pymol.cmd.remove('solvent')
         pymol.cmd.remove('resn DMS')
         pymol.cmd.show('sticks', 'resi 145')
         pymol.cmd.show('lines', 'byres resn LIG around 4')
         pymol.cmd.zoom('resi 145 or resn LIG')
         pymol.cmd.save(
             f'{self.work_path}/{self.name}/{self.name}_protein.pse')
コード例 #3
0
 def best_hit(self) -> Hit:
     #cached.
     if self._best_hit is not None:
         return self._best_hit
     best_d = 99999
     best_hit = -1
     with pymol2.PyMOL() as pymol:
         for hit in self.hits:
             pymol.cmd.load(hit.bound_file)
             d = min([
                 pymol.cmd.distance('resi 145 and name SG',
                                    f'resn LIG and name {atom.name}')
                 for atom in pymol.cmd.get_model('resn LIG').atom
             ])
             if d < best_d:
                 best_hit = hit
                 best_d = d
             pymol.cmd.delete('*')
     print('Best hit', best_hit.name)
     self._best_hit = best_hit
     return best_hit
コード例 #4
0
 def make_fragmenstein(self):
     with pymol2.PyMOL() as pymol:
         pymol.cmd.load(self.best_hit.bound_file, 'prot')
         sg = Chem.MolFromPDBBlock(
             pymol.cmd.get_pdbstr('resi 145 and name SG'))
         pymol.cmd.save('sg.pdb', 'resi 145 and name SG')
     ff = Fragmenstein(self.ori_mol, [h.mol for h in self.hits],
                       attachment=sg)
     ff.make_pse(
         f'{self.work_path}/{self.name}/{self.name}_fragmenstein.pse')
     Chem.MolToMolFile(
         ff.scaffold,
         f'{self.work_path}/{self.name}/scaffold.fragmenstein.mol',
         kekulize=False)
     Chem.MolToMolFile(
         ff.chimera,
         f'{self.work_path}/{self.name}/chimera.fragmenstein.mol',
         kekulize=False)
     Chem.MolToMolFile(
         ff.positioned_mol,
         f'{self.work_path}/{self.name}/{self.name}.fragmenstein.mol',
         kekulize=False)
     return ff
コード例 #5
0
 def load_pose(self):
     with pymol2.PyMOL() as pymol:
         pymol.cmd.load(self.bound_file)
         pymol.cmd.remove('solvent')
         pymol.cmd.remove(
             'not polymer and not resn LIG'
         )  # should run it through P Curran\s list of artefacts!
         pymol.cmd.alter('resn LIG', 'chain="B"')
         pymol.cmd.alter('resn LIG', 'resi="1"')
         pymol.cmd.sort()
         holo = pymol.cmd.get_pdbstr('*')
     if self.is_covalent():
         holo = f'LINK         SG  CYS A 145                {self.covalent_atomname} LIG B   1     1555   1555  1.8\n' + holo
     pose = pyrosetta.Pose()
     params_paths = pyrosetta.rosetta.utility.vector1_string()
     params_paths.extend([self.params_file])
     pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, holo)
     ## Force HIE
     r = pose.pdb_info().pdb2pose(res=41, chain='A')
     MutateResidue = pyrosetta.rosetta.protocols.simple_moves.MutateResidue
     MutateResidue(target=r, new_res='HIS').apply(pose)
     return pose