In [1]:
import os
import numpy as np
import rosetta as r
import random
r.init()
r.__version__
Out[1]:
'56891:56891:6efc58f8abb54611ace5a6cdd7e69e6c970a01ef'
In [14]:
#Makin a mutation after the helix is created also works
#Create sequence 
seq = 'R'*5 + 'K'+'R'*5; print seq
pose = r.pose_from_sequence(seq, res_type="fa_standard") 
scorefxn = r.get_fa_scorefxn()

#Create perfect alpha helix
#phi = -57.8, Psi -47.0
for i in range(1, pose.total_residue()+1):
    pose.set_phi(i, -57.9)
    pose.set_psi(i, -47.9)


    #pack side chains
packer_task = r.standard_packer_task(pose)
packer_task.restrict_to_repacking() 
print packer_task
pack_mover = r.PackRotamersMover(scorefxn, packer_task) 
pack_mover.apply(pose) 

#show the resuls
print scorefxn(pose)
RRRRRKRRRRR
#Packer_Task

resid	pack?	design?	allowed_aas
1	TRUE	FALSE	ARG:NtermProteinFull
2	TRUE	FALSE	ARG
3	TRUE	FALSE	ARG
4	TRUE	FALSE	ARG
5	TRUE	FALSE	ARG
6	TRUE	FALSE	LYS
7	TRUE	FALSE	ARG
8	TRUE	FALSE	ARG
9	TRUE	FALSE	ARG
10	TRUE	FALSE	ARG
11	TRUE	FALSE	ARG:CtermProteinFull

-0.165960801682
In [15]:
pose.residue(6).chi(r.Vector1([1.,2.,3.,4.]))
print scorefxn(pose)
#As expected energy not updated
-0.165960801682
In [11]:
pack_mover.apply(pose) 
print scorefxn(pose)
pose.residue(6).set_chi(1, 90.)
print scorefxn(pose)
#Energy still not updated??
0.121413424414
0.121413424414
In [12]:
pack_mover.apply(pose) 
print scorefxn(pose)
pose.residue(6).set_all_chi(r.Vector1([1.,2.,3.,4.]))
print scorefxn(pose)
#Energy still not updated??
0.112666631125
0.112666631125
In [13]:
pack_mover.apply(pose) 
print scorefxn(pose)
pose.set_chi(1,6,90.)
print scorefxn(pose)
#Ahh, energy finally updated
-0.165960801682
11.3687762064
In [ ]: