# why two packing setting return different energy?

3 posts / 0 new
why two packing setting return different energy?
#1

Hello everyone,

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.

MY CODE:

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
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')

design_mover = PackRotamersMover(score, task_design)
design_mover.apply(pose)

def pack2(): #energy lower.
# Packing2
for res in active_id:
pack_mover = PackRotamersMover(score, task_pack)
pack_mover.apply(pose)

pack2() # or pack1()
print score(pose)

Category:
Post Situation:
Wed, 2019-01-30 00:18
zhangying1990

You are fixing everything in the second one and then turning many more residues on in the second than the first one.

Wed, 2019-01-30 09:09

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.

pack1():

core.pack.task: Packer task: initialize from command line()
core.scoring.ScoreFunctionFactory: SCOREFUNCTION: ref2015
core.pack.pack_rotamers: built 120 rotamers at 7 positions.
core.pack.interaction_graph.interaction_graph_factory: Instantiating DensePDInteractionGraph
core.pack.pack_rotamers: built 227 rotamers at 33 positions.
core.pack.interaction_graph.interaction_graph_factory: Instantiating DensePDInteractionGraph
-290.298509547

pack2():

core.pack.task: Packer task: initialize from command line()
core.scoring.ScoreFunctionFactory: SCOREFUNCTION: ref2015
core.pack.pack_rotamers: built 120 rotamers at 7 positions.
core.pack.interaction_graph.interaction_graph_factory: Instantiating DensePDInteractionGraph
core.pack.task: Packer task: initialize from command line()
core.pack.pack_rotamers: built 739 rotamers at 33 positions.
core.pack.interaction_graph.interaction_graph_factory: Instantiating DensePDInteractionGraph
energy = -320.261439796

Now they have the same 33 postion. but still return different energy.

Then i check the pack task.

pack1() return this:

resid    pack?    design?    allowed_aas
1    FALSE    FALSE
2    FALSE    FALSE
3    FALSE    FALSE
4    FALSE    FALSE
5    FALSE    FALSE
6    FALSE    FALSE
7    FALSE    FALSE
8    TRUE    FALSE    ARG
9    FALSE    FALSE

.....

but pack2() return this:

resid    pack?    design?    allowed_aas
1    FALSE    FALSE    PRO:NtermProteinFull
2    FALSE    FALSE    GLN
3    FALSE    FALSE    ILE
4    FALSE    FALSE    THR
5    FALSE    FALSE    LEU
6    FALSE    FALSE    TRP
7    FALSE    FALSE    LYS
8    TRUE    FALSE    ARG

.....


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().

----------------------

update:

It was caused by:

InitializeFromCommandline()

and the init() default call '-ex1 -ex2aro' and change the number of rotamers.

Fri, 2019-02-01 00:30
zhangying1990