recently, i doing the Exercises of workshop6, but i found i was confused about the packing and design in rosetta...
Anybody can help to figure out why the two setting method of PACK （def pack1 and def pack2) return different energy？it should be the same as i think！
if i run pack1 followed by pack2, then it return the same(lower) energy. it seens that the design energy is not optimized. so should i set another packing after the design?
thanks if anyone can help.
import os, sys, random, math import numpy as np from pyrosetta import * from pyrosetta.teaching import * from pyrosetta.rosetta import core, protocols from pyrosetta.rosetta.protocols.simple_moves import * from pyrosetta.rosetta.protocols.moves import * from rosetta.protocols.relax import * from pyrosetta.toolbox import cleanATOM from pyrosetta.toolbox import generate_resfile_from_pose from rosetta.core.pack.task import TaskFactory init() pymover = PyMOLMover() min_mover = MinMover() pymover.keep_history(True) # make traj in pymol score = create_score_function('ref2015') pose = pose_from_pdb('1kjg.pdb') #pymover.apply(pose) # get pose_id of active center; pose_id =  active_center = [8, 23, 25, 29, 30, 32, 45, 47, 50, 53, 82, 84] chainID = ['A','B'] for c in chainID: for i in active_center: pose_id.append(pose.pdb_info().pdb2pose(c, i)) print pose_id # get peptide pose id pep_id =  peptide = [2, 3, 4, 5, 6, 7, 8, 9] # 201, 202, 203, 204, 205, 206, 207, 208 chainID = ['P'] for c in chainID: for i in peptide: pep_id.append(pose.pdb_info().pdb2pose(c, i)) print pep_id active_id = pose_id + pep_id # pack and min the active center and peptide energy =  for i in range(1): # 10 decoys pose = pose_from_pdb('1kjg.pdb') def pack1(): generate_resfile_from_pose(pose, 'pose.resfile', False) with open('pose.resfile', 'a') as f: for res in [2, 3, 4, 5, 6, 7, 8, 9, 10]: f.write(str(res) + ' P NATAA\n') with open('pose.resfile', 'a') as f: for n in [8, 23, 25, 29, 30, 32, 45, 47, 50, 53, 82, 84]: f.write(str(n) + ' A NATAA\n') f.write(str(n) + ' B NATAA\n') task_design = TaskFactory.create_packer_task(pose) core.pack.task.parse_resfile(pose, task_design, 'pose.resfile') design_mover = PackRotamersMover(score, task_design) design_mover.apply(pose) print task_design def pack2(): #energy lower. # Packing2 task_pack = standard_packer_task(pose) task_pack.restrict_to_repacking() task_pack.temporarily_fix_everything() for res in active_id: task_pack.temporarily_set_pack_residue(res, True) pack_mover = PackRotamersMover(score, task_pack) pack_mover.apply(pose) print task_pack pack2() # or pack1() print score(pose)
You are fixing everything in the second one and then turning many more residues on in the second than the first one.
Thanks for that mistake，then i adjust the peptide list. now the number are totally equal.
However, it still return the different energy.
I notice that, the pack did not built the same number rotamer at this allowed position.
Now they have the same 33 postion. but still return different energy.
Then i check the pack task.
pack1() return this:
but pack2() return this:
In the pack task, the resid allowed_aas columns are different. It make me confused..
temporarily_fix_everything() + temporarily_set_pack_residue() should output the same pack task as using the resifile( all residue NATRO + specific residue NATAA)
Additionally, in the pack2() core.pack.task: Packer task: initialize twice! but only one in the pack1().
It was caused by:
and the init() default call '-ex1 -ex2aro' and change the number of rotamers.