Пример #1
0
def load_mem_pose(filename, opm_filename, params_paths=None):
    with pymol2.PyMOL() as pymol:
        #     pymol.cmd.load('SLC38A3_phyre.pdb', 'S38A3')
        pymol.cmd.load(filename, 'S38A3')
        # pymol.cmd.remove('resi 1-68 or resi 245-282 or resi 494-504')
        #     pymol.cmd.remove('resi 138-207 or resi 318-392')
        map_pdbblock = pymol.cmd.get_pdbstr()
        pymol.cmd.load(opm_filename, 'OPM')
        pymol.cmd.align('S38A3', 'OPM')
        pymol.cmd.remove('resn MEM')  # make sure its not there!
        pymol.cmd.delete('OPM')
        holo_pdbblock = pymol.cmd.get_pdbstr('polymer')
        lig_pdbblock = pymol.cmd.get_pdbstr('not polymer')
    #     pymol.cmd.save('test.pdb')
    pose = pyrosetta.Pose()
    if params_paths:
        pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
    # pyrosetta.rosetta.core.import_pose.pose_from_file(pose, 'phyre.gln_Na.PO4.loop_r.pdb')
    pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, holo_pdbblock)

    addmem = pyrosetta.rosetta.protocols.membrane.AddMembraneMover(
        'from_structure')
    addmem.apply(pose)
    pyrosetta.rosetta.protocols.membrane.AqueousPoreFinder().apply(pose)
    ligpose = pyrosetta.Pose()
    pyrosetta.generate_nonstandard_residue_set(ligpose, params_paths)
    # pyrosetta.rosetta.core.import_pose.pose_from_file(pose, 'phyre.gln_Na.PO4.loop_r.pdb')
    pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(
        ligpose, lig_pdbblock)
    pose.append_pose_by_jump(ligpose, pose.total_residue())
    return pose
Пример #2
0
 def score_ligand_alone(self):
     pose = pyrosetta.Pose()
     params_paths = pyrosetta.rosetta.utility.vector1_string()
     params_paths.extend(
         [f'{self.work_path}/{self.name}/{self.name}.params'])
     pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_file(
         pose, f'{self.work_path}/{self.name}/{self.name}.pdb')
     return pyrosetta.get_fa_scorefxn()(pose)
Пример #3
0
 def make_pose(self, pdbblock) -> pyrosetta.Pose:
     pose = pyrosetta.Pose()
     params_paths = pyrosetta.rosetta.utility.vector1_string()
     params_paths.extend(
         [f"{self.work_path}/{self.name}/{self.name}.params"])
     pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, pdbblock)
     # fix protonation of HIS41.
     r = pose.pdb_info().pdb2pose(res=41, chain='A')
     MutateResidue = pyrosetta.rosetta.protocols.simple_moves.MutateResidue
     MutateResidue(target=r, new_res='HIS_D').apply(pose)
     MutateResidue(target=r, new_res='HIS').apply(pose)
     return pose
Пример #4
0
 def _load_pose_from_file(cls, filename: str, params_filenames: Optional[List[str]] = None) -> pyrosetta.Pose:
     """
     Loads a pose from filename with the params in the params_folder
     :param filename:
     :param params_filenames:
     :return:
     """
     pose = pyrosetta.Pose()
     if params_filenames:
         params_paths = pyrosetta.rosetta.utility.vector1_string()
         params_paths.extend(params_filenames)
         pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_file(pose, filename)
     return pose
Пример #5
0
    def from_pdbblock(cls,
                      pdbblock: str,
                      params_file: str,
                      constraint_file: str,
                      ligand_residue: Union[str, int, Tuple[int, str], pyrosetta.Vector1] = 'LIG',
                      key_residues: Union[None, Sequence[Union[int, str, Tuple[int, str]]], pyrosetta.Vector1] = None):


        pose = pyrosetta.Pose()
        params_paths = pyrosetta.rosetta.utility.vector1_string()
        params_paths.extend([params_file])
        pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
        pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, pdbblock)
        return cls(pose, constraint_file, ligand_residue, key_residues)
    def params_to_pose(paramsfile: str, name: str) -> pyrosetta.Pose:
        """
        Staticmethod to get a pose from a params file.

        :param paramsfile: params file.
        :param name: 3-letter residue name.
        :return:
        """
        pose = pyrosetta.rosetta.core.pose.Pose()
        params_paths = pyrosetta.rosetta.utility.vector1_string()
        params_paths.extend([paramsfile])
        resiset = pyrosetta.generate_nonstandard_residue_set(
            pose, params_paths)
        ## This is the most convoluted way of getting it. But I don't known any otherway.
        v = pyrosetta.rosetta.core.chemical.ResidueTypeFinder(
            resiset).get_all_possible_residue_types()
        ligtype = [vv for vv in v if vv.name3() == name][0]
        lig = pyrosetta.rosetta.core.conformation.ResidueFactory.create_residue(
            ligtype)
        pose.append_residue_by_jump(lig, 1)
        cycles = 15
        scorefxn = pyrosetta.get_fa_scorefxn()
        relax = pyrosetta.rosetta.protocols.relax.FastRelax(scorefxn, cycles)
        relax.apply(pose)
        return pose
Пример #7
0
    def from_pdbfile(cls,
                     pdbfile: str,
                     params_file: str,
                     constraint_file: str,
                     ligand_residue: Union[str, int, Tuple[int, str], pyrosetta.Vector1] = 'LIG',
                     key_residues: Union[None, Sequence[Union[int, str, Tuple[int, str]]], pyrosetta.Vector1] = None):
        """
        Given a PDB with the ligand load it.

        :param pdbfile: pdb file
        :param params_file: params file
        :param constraint_file: filename
        :param ligand_residue: ligand -see class docstring
        :param key_residues: multiple entries -see class docstring
        :return:
        """
        pose = pyrosetta.Pose()
        params_paths = pyrosetta.rosetta.utility.vector1_string()
        params_paths.extend([params_file])
        pyrosetta.generate_nonstandard_residue_set(pose, params_paths)
        pyrosetta.rosetta.core.import_pose.pose_from_file(pose, pdbfile)
        return cls(pose, constraint_file, ligand_residue, key_residues)
Пример #8
0
def pose_from_file(pdb_filename: str,
                   params_filenames: Optional[Union[pyrosetta.rosetta.utility.vector1_string, List[str]]] = None) \
        -> pyrosetta.Pose:
    """
    Return a pose like pose_from_file but with params.

    :param pdb_filename:
    :param params_filenames:
    :return:
    """
    pose = pyrosetta.Pose()
    if params_filenames and isinstance(
            params_filenames, pyrosetta.rosetta.utility.vector1_string):
        pyrosetta.generate_nonstandard_residue_set(pose, params_filenames)
    if params_filenames and isinstance(params_filenames, list):
        params_filenames2 = pyrosetta.rosetta.utility.vector1_string()
        params_filenames2.extend(params_filenames)
        pyrosetta.generate_nonstandard_residue_set(pose, params_filenames2)
    else:
        pass
    pyrosetta.rosetta.core.import_pose.pose_from_file(pose, pdb_filename)
    return pose
 def replace_to_pose(self,
                     probe_name: str,
                     probe_smiles: str,
                     probe_resn: str = 'MMX') -> pyrosetta.Pose:
     pdb = self.replace(probe_smiles=probe_smiles,
                        probe_resn=probe_resn,
                        probe_name=probe_name)
     # pyrosetta.init(f'-extra_res_fa {probe_name}.params -mute all')
     pose = pyrosetta.Pose()
     params_paths = pyrosetta.rosetta.utility.vector1_string()
     params_paths.extend([f"{probe_name}.params"])
     nonstandard_residue_set = pyrosetta.generate_nonstandard_residue_set(
         pose, params_paths)
     pyrosetta.rosetta.core.import_pose.pose_from_pdbstring(pose, pdb)
     return pose
Пример #10
0
    def params_to_pose(paramsfile: str, name: str) -> pyrosetta.Pose:
        """
        Staticmethod to get a pose from a params file.

        :param paramsfile: params file.
        :param name: 3-letter residue name.
        :return:
        """
        pose = pyrosetta.Pose()
        params_paths = pyrosetta.rosetta.utility.vector1_string()
        params_paths.extend([paramsfile])
        resiset = pyrosetta.generate_nonstandard_residue_set(
            pose, params_paths)
        lig = pyrosetta.rosetta.core.conformation.ResidueFactory.create_residue(
            rts.name_map(name))
        pose.append_residue_by_jump(lig, 1)
        return pose
Пример #11
0
from sys import argv

fmt = dict(
    zip('ANDRCQEGHILKMPFSTWYV', [
        'ALA', 'ASN', 'ASP', 'ARG', 'CYS', 'GLN', 'GLU', 'GLY', 'HIS', 'ILE',
        'LEU', 'LYS', 'MET', 'PRO', 'PHE', 'SER', 'THR', 'TRP', 'TYR', 'VAL'
    ]))

with open('input_files/flags') as fn:
    flags = fn.read().replace('\n', ' ')

# init PyRosetta
pyrosetta.init(''.join(flags))

ligand_params = pyrosetta.Vector1(['input_files/pNPG.params'])
new_res_set = pyrosetta.generate_nonstandard_residue_set(ligand_params)

p = pyrosetta.Pose()
pyrosetta.pose_from_file(p, new_res_set, 'input_files/bglb.pdb')
scorefxn = pyrosetta.create_score_function('beta_cst')

add_cst = rosetta.protocols.enzdes.AddOrRemoveMatchCsts()
add_cst.cstfile('input_files/pNPG.enzdes.cst')
add_cst.set_cst_action(rosetta.protocols.enzdes.CstAction.ADD_NEW)
add_cst.apply(p)

target = int(mutant_name[1:-1])
new_res = fmt[mutant_name[-1]]
mut = rosetta.protocols.simple_moves.MutateResidue(target, new_res)
mut.apply(p)
Пример #12
0
from pyrosetta.rosetta.core.pack.task import TaskFactory
from pyrosetta.rosetta.core.pack.task.operation import ReadResfile
from pyrosetta import create_score_function
#from roseasy.standard_params.filters import FilterContainer

def get_workspace(root_dir, step):
    return pipeline.DesignWorkspace(root_dir, step)

if __name__=='__main__':
    workspace, job_info = big_jobs.initiate()
    test_run = job_info.get('test_run', False)
    init()

    # Create residue typeset
    pose = Pose()
    typeset = generate_nonstandard_residue_set(pose,
            workspace.ligand_params_paths)
    # Figure out input pdb and create a pose
    pdbpath = workspace.input_path(job_info)
    pose_from_file(pose, typeset, pdbpath)


    # Create FastDesign object
    fd = fastdesign.FastDesign()
    fd.pose = pose

    # Create task factory and read the resfile
    taskfactory = TaskFactory()
    readresfile = ReadResfile(workspace.resfile_path)
    taskfactory.push_back(readresfile)
    fd.task_factory = taskfactory
Пример #13
0
import rosetta 
from sys import argv

fmt = dict( zip( 'ANDRCQEGHILKMPFSTWYV', [
    'ALA','ASN','ASP','ARG','CYS','GLN','GLU',
    'GLY','HIS','ILE','LEU','LYS','MET','PRO','PHE','SER',
    'THR','TRP','TYR','VAL' ] ) ) 

with open( 'input_files/flags' ) as fn:
    flags = fn.read().replace( '\n', ' ' )

# init PyRosetta 
pyrosetta.init( ''.join( flags ) ) 

ligand_params = pyrosetta.Vector1( [ 'input_files/pNPG.params' ] )
new_res_set = pyrosetta.generate_nonstandard_residue_set( ligand_params )

p = pyrosetta.Pose()
pyrosetta.pose_from_file( p, new_res_set, 'input_files/bglb.pdb' ) 
scorefxn = pyrosetta.create_score_function( 'beta_cst' ) 

add_cst = rosetta.protocols.enzdes.AddOrRemoveMatchCsts()
add_cst.cstfile( 'input_files/pNPG.enzdes.cst' ) 
add_cst.set_cst_action( rosetta.protocols.enzdes.CstAction.ADD_NEW )
add_cst.apply( p ) 

target = int( mutant_name[ 1:-1 ] )
new_res = fmt[ mutant_name[ -1 ] ] 
mut = rosetta.protocols.simple_moves.MutateResidue( target, new_res )
mut.apply( p )