Beispiel #1
0
 def apply(self, pose):
   position = self.sample_position(pose)
   while self.fixed_position(position):
     position = self.sample_position(pose)
   residue_name = self.sample_residue(pose, position)
   mutate_residue(pose, position + 1, residue_name)
   self.sample_rotamer(pose, position)
Beispiel #2
0
Datei: enz.py Projekt: UoMMIB/enz
    def fold_repack_mutate(pose, mutation_dict, pack_radius=5):

        for i in mutation_dict:
            print(i, mutation_dict[i])
            mutate_residue(pose,
                           i,
                           mutation_dict[i]['to'].upper(),
                           pack_radius=float(pack_radius))
        return pose
def main():
	# Destination folder for PDB files
	out_dir = 'ext_cat_tau_slide'
	if not isdir(out_dir):
		makedirs(out_dir)

	# Initialize Rosetta
	opts = '-enzdes::cstfile htra1_cat_general.cst \
			-cst_fa_weight 1.0 -run:preserve_header'
	init(opts)

	# Score function and starting PDB
	sf = create_score_function('ref2015_cst')
	pose = pose_from_pdb('ext_cat_relax.pdb')

	# Applying fold tree and constraints to the pose, deactivating by mutation
	pose.fold_tree(make_fold_tree())
	pose = apply_constraints(pose)
	mutate_residue(pose, 169, 'A') # Catalytic S328 (169 in pose) mutated to A 

	# Making FastRelax mover
	fr = setup_fastrelax(sf)

	# Going through all 6-residue frames in tau
	for frame in range(len(tau_seq))[:-8]:
		# Making name from position within tau sequence and the frame sequence
		position_name = '{:03d}'.format(frame + 279) # First res is V270
		# 275 selected so that name reflects which residue is downstream scissile
		seq = tau_seq[frame:frame + 9]
		set_name = '_'.join([position_name, seq])
		print(set_name)

		# Make threaded model
		threaded_pose = thread_to_htra1(seq, pose)
		threaded_name = 'threaded_htra1_tau_' + set_name + '.pdb'
		threaded_pose.dump_pdb(join(out_dir, threaded_name))

		# Creating relaxed decoys
		decoy_name = join(out_dir, 'relaxed_htra1_tau_' + set_name)
		jd = PyJobDistributor(decoy_name, 50, sf)
		while not jd.job_complete:
			pp = Pose()
			pp.assign(threaded_pose)
			fr.apply(pp)
			jd.output_decoy(pp)
Beispiel #4
0
  def __init__(self, net, pose, fix=None, glycinate=False, max_iter=100,
               n_moves=1, scorefxn=None, kT=0.1, k=15, dropout=0.5, relax=True):
    super(NetPackMover, self).__init__(net, pose, k=k, dropout=dropout)
    self.relax = relax
    self.n_moves = n_moves
    self.max_iter = max_iter
    self.kT = kT
    self.scorefxn = scorefxn
    self.fix = fix if fix is not None else []
    self.step = 0

    self.fastrelax = ...
    if relax or glycinate:
      fastrelax = FastRelax()
      fastrelax.set_scorefxn(self.scorefxn)
      mm = MoveMap()
      mm.set_bb(False)
      mm.set_chi(True)
      #for fixed in self.fix:
      #  mm.set_chi(fixed, False)
      fastrelax.set_movemap(mm)
      self.fastrelax = fastrelax

    if glycinate:
      self.dropout = 1.0
      mask = torch.tensor([
        1 - int(self.fixed_position(idx))
        for idx in range(len(pose.sequence()))
      ], dtype=torch.bool)
      for idx, residue in enumerate(pose.residues):
        residue_name = self.sample_residue(pose, idx, mask=mask, argmax=True)
        if not self.fixed_position(idx):
          mutate_residue(pose, idx + 1, residue_name, pack_radius=10.0, pack_scorefxn=scorefxn)
        mask[idx] = 0
      self.dropout = dropout
      self.fastrelax.apply(pose)
    self.monte_carlo = MonteCarlo(pose, scorefxn, kT)
    self.glycinate = glycinate
#mutate the residue to alanine
sfxn = get_fa_scorefxn()
fast_relax = pyrosetta.rosetta.protocols.relax.FastRelax(standard_repeats=2)
fast_relax.set_scorefxn(sfxn)
""" Fix the FastRelax and the ala scan is good """

from pyrosetta.toolbox import mutate_residue
for member in humanize(H_residues_to_design):
    #define the movers
    TF = pyrosetta.rosetta.core.pack.task.TaskFactory()
    #create pose copies
    mutant_pose = fa_working.clone()
    wt_pose = fa_working.clone()

    #make the alanine mutation at a single position
    mutate_residue(mutant_pose, member, 'A')
    mutation_site_selector = pyrosetta.rosetta.core.select.residue_selector.ResidueIndexSelector(
        '{}'.format(member))
    mutation_site = mutation_site_selector.apply(mutant_pose)
    #select neighbors
    neighbor_selector = pyrosetta.rosetta.core.select.residue_selector.NeighborhoodResidueSelector(
    )
    neighbor_selector.set_distance(6.0)
    neighbor_selector.set_focus(mutation_site)
    neighbors = neighbor_selector.apply(mutant_pose)
    #select not neighbors
    not_neighbor_selector = pyrosetta.rosetta.core.select.residue_selector.NotResidueSelector(
        neighbor_selector)
    not_neighbors = not_neighbor_selector.apply(mutant_pose)
    #defining the operations
    to_relax = pyrosetta.rosetta.core.pack.task.operation.OperateOnResidueSubset(
Beispiel #6
0
f = open("energies.txt", 'w')

pose_org = pose_from_pdb(args.pdb)
scorefx = get_fa_scorefxn()
f.write("org {}\n".format(scorefx(pose_org)))
errorlist = []

#loop starts here; first layer removed, would include looping through res_list
for res in res_list:
    try:
        cur_long = pose_org.residue(res - 13).name()
        cur_short = aa_short[cur_long]
        #for mut in aa_long: #["ALA"]
        for mut in aa_long:
            if mut != cur_long:
                new_pose = Pose()
                new_pose.assign(pose_org)
                for c in chains:
                    num = new_pose.pdb_info().pdb2pose(c, res)
                    mutate_residue(new_pose, num, aa_short[mut], 5, scorefx)
                f.write("{}{}{}.pdb {}\n".format(cur_short, res, aa_short[mut],
                                                 scorefx(new_pose)))
                new_pose.dump_pdb("full_results/{}{}{}.pdb".format(
                    cur_short, res, aa_short[mut]))
    except:
        errorlist.append(res)
        continue
f.close()
for i in errorlist:
    print("Res {} did not finish".format(i))
task_pack = standard_packer_task(pose)
task_pack.restrict_to_repacking()
task_pack.temporarily_fix_everything()
task_pack.temporarily_set_pack_residue(49, True)

print(task_pack)

pack_mover = PackRotamersMover(scorefxn, task_pack)

pack_mover.apply(pose)

import tempfile

# Design

# work around for windows permission problem
YY8_resfile1 = tempfile.mkstemp()[1]
YY8_resfile2 = tempfile.mkstemp()[1]

generate_resfile_from_pdb("../test/data/workshops/1YY8.clean.pdb",
                          YY8_resfile1)
generate_resfile_from_pose(pose, YY8_resfile2)

task_design = core.pack.task.TaskFactory.create_packer_task(pose)
core.pack.task.parse_resfile(pose, task_design, YY8_resfile2)

mutate_residue(pose, 49, 'E')

#os.remove(YY8_resfile1)
#os.remove(YY8_resfile2)