Member Site › Forums › PyRosetta › PyRosetta – General › Rotamer bin vector from chi angles of a residue in pose not found in Dunbrack rotamer library
 This topic has 3 replies, 2 voices, and was last updated 10 years, 5 months ago by Anonymous.

AuthorPosts


February 25, 2014 at 6:18 am #1839Anonymous
I calculate the rotamer vector for a residue in a specific position in a pose using the rotamer_from_chi function with the following code:
rota = RotamerFromAngles(pose, moltenresid);
def RotamerFromAngles(pose, residue_number):
residueType = pose.residue_type(residue_number);
angles = pose.residue(residue_number).chi();
rotv = rosetta.utility.vector1_Size();
rotamer_from_chi(residueType,angles,rotv)
print ‘Residue type: ‘, pose.residue(residue_number)
print ‘Residue chi angles: ‘, angles
print ‘Residue rotamer vector: ‘, rotv
return rotvUsing the above code, for residue position 4 in the 1pga pdb protein, I got a residue type of LYS at position 4 with chi angles [177.012, 160.811, 95.4862, 178.743, ] and rotamer vector [2, 2, 1, 2, ].
Residue type: LYS 4:
Residue chi angles: [177.012, 160.811, 95.4862, 178.743, ]
Residue rotamer vector: [2, 2, 1, 2, ]However, when I iterate over all the possible rotamers for this residue in a design scenario, I don’t find the [2, 2, 1, 2, ] rotamer conformation in the list of rotamers from the Dunbrack rotamer library. The code I use to iterate over all possible rotamer states is as follows:
def SingletonEnergy( ig, rotsets, moltenresid, rota ):
E = [];
rotamers = rotsets.rotamer_set_for_moltenresidue(moltenresid)
n_rots = rotamers.num_rotamers()
for state in range(1, n_rots+1):
rots = rotsets.rotamer_for_moltenres(moltenresid,state);
#print ‘Amino acid type is ‘,rots,’nCurrent chi angles are ‘, rots.chi()
#residueType = rots.residue_type; print ‘Residue type is ‘, residueType
chi_rots = rots.chi();
rotv = rosetta.utility.vector1_Size();
rotamer_from_chi(rots,rotv) #rotamer_from_chi(residueType,chi_rots,rotv)
print ‘State ‘, state,’: angles – ‘, chi_rots, ‘and rotamer – ‘, rotv
rotvnp = ConvertToArray(rotv);
rotanp = ConvertToArray(rota); #print ‘Input rotamer array is : ‘, rota
if (rotvnp == rotanp):
E = ig.get_one_body_energy_for_node_state(moltenresid, state)
print ‘Found Match’
print ‘Input rotamer is ‘, rotanp, ‘and current rotamer is ‘, rotvnp
print ‘Energy is ‘, E
print ‘nRotamer ‘, state,’ of residue ‘, moltenresid, ‘ is the match.’
print ‘Completed Singleton Energy Calculation’
if not E:
print ‘Energy E = ‘, E
code.interact(local=locals());
return EI could not find a matching Dunbrack rotamer for rotamer conformation [2, 2, 1, 2, ] in the output:
State 1 : angles – [] and rotamer – []
State 2 : angles – [63.1152, 60, ] and rotamer – [1, 0, ]
State 3 : angles – [63.1152, 60, ] and rotamer – [1, 0, ]
State 4 : angles – [63.1152, 180, ] and rotamer – [1, 0, ]
State 5 : angles – [62.7068, 60, ] and rotamer – [3, 0, ]
State 6 : angles – [63.1252, 32.8924, ] and rotamer – [1, 2, ]
State 7 : angles – [63.1252, 62.6262, ] and rotamer – [1, 3, ]
State 8 : angles – [69.5011, 48.8296, ] and rotamer – [3, 6, ]
State 9 : angles – [63.1252, 5.21905, ] and rotamer – [1, 1, ]
State 10 : angles – [65.1135, 70.9135, 32.7642, ] and rotamer – [3, 3, 1, ]
State 11 : angles – [61.6758, 69.4831, ] and rotamer – [1, 6, ]
State 12 : angles – [] and rotamer – []
State 13 : angles – [64.4815, 158.763, ] and rotamer – [1, 9, ]
State 14 : angles – [64.4815, 74.7652, ] and rotamer – [1, 6, ]
State 15 : angles – [57.5488, 62.7553, ] and rotamer – [3, 3, ]
State 16 : angles – [69.2, 86.7, 174.9, 178.1, ] and rotamer – [1, 3, 2, 2, ]
State 17 : angles – [71.3006, 165.913, ] and rotamer – [1, 2, ]
State 18 : angles – [176.623, 62.0891, 67.9775, ] and rotamer – [2, 1, 1, ]
State 19 : angles – [64.1312, 67.507, ] and rotamer – [1, 3, ]
State 20 : angles – [64.1312, 39.1553, ] and rotamer – [1, 2, ]
State 21 : angles – [64.1312, 110.796, ] and rotamer – [1, 9, ]
State 22 : angles – [64.1312, 154.552, ] and rotamer – [1, 6, ]
State 23 : angles – [64.1312, 140.478, ] and rotamer – [1, 8, ]
State 24 : angles – [27.3, 34.5, 27.8, ] and rotamer – [1, 1, 1, ]
State 25 : angles – [60.2508, 76.7321, 30.3, ] and rotamer – [1, 3, 1, ]
State 26 : angles – [72.2, 92.2, 179.2, 91.7, ] and rotamer – [1, 3, 2, 1, ]
State 27 : angles – [66.3365, 0, ] and rotamer – [1, 0, ]
State 28 : angles – [66.3365, 20, ] and rotamer – [1, 0, ]
State 29 : angles – [66.3365, 40, ] and rotamer – [1, 0, ]
State 30 : angles – [66.3365, 60, ] and rotamer – [1, 0, ]
State 31 : angles – [66.3365, 80, ] and rotamer – [1, 0, ]
State 32 : angles – [66.3365, 100, ] and rotamer – [1, 0, ]
State 33 : angles – [66.3365, 120, ] and rotamer – [1, 0, ]
State 34 : angles – [66.3365, 140, ] and rotamer – [1, 0, ]
State 35 : angles – [66.3365, 160, ] and rotamer – [1, 0, ]
State 36 : angles – [66.3365, 180, ] and rotamer – [1, 0, ]
State 37 : angles – [66.3365, 200, ] and rotamer – [1, 0, ]
State 38 : angles – [66.3365, 220, ] and rotamer – [1, 0, ]
State 39 : angles – [66.3365, 240, ] and rotamer – [1, 0, ]
State 40 : angles – [66.3365, 260, ] and rotamer – [1, 0, ]
State 41 : angles – [66.3365, 280, ] and rotamer – [1, 0, ]
State 42 : angles – [66.3365, 300, ] and rotamer – [1, 0, ]
State 43 : angles – [66.3365, 320, ] and rotamer – [1, 0, ]
State 44 : angles – [66.3365, 340, ] and rotamer – [1, 0, ]
State 45 : angles – [179.776, 0, ] and rotamer – [2, 0, ]
State 46 : angles – [179.776, 20, ] and rotamer – [2, 0, ]
State 47 : angles – [179.776, 40, ] and rotamer – [2, 0, ]
State 48 : angles – [179.776, 60, ] and rotamer – [2, 0, ]
State 49 : angles – [179.776, 80, ] and rotamer – [2, 0, ]
State 50 : angles – [179.776, 100, ] and rotamer – [2, 0, ]
State 51 : angles – [179.776, 120, ] and rotamer – [2, 0, ]
State 52 : angles – [179.776, 140, ] and rotamer – [2, 0, ]
State 53 : angles – [179.776, 160, ] and rotamer – [2, 0, ]
State 54 : angles – [179.776, 180, ] and rotamer – [2, 0, ]
State 55 : angles – [179.776, 200, ] and rotamer – [2, 0, ]
State 56 : angles – [179.776, 220, ] and rotamer – [2, 0, ]
State 57 : angles – [179.776, 240, ] and rotamer – [2, 0, ]
State 58 : angles – [179.776, 260, ] and rotamer – [2, 0, ]
State 59 : angles – [179.776, 280, ] and rotamer – [2, 0, ]
State 60 : angles – [179.776, 300, ] and rotamer – [2, 0, ]
State 61 : angles – [179.776, 320, ] and rotamer – [2, 0, ]
State 62 : angles – [179.776, 340, ] and rotamer – [2, 0, ]
State 63 : angles – [60.9423, 0, ] and rotamer – [3, 0, ]
State 64 : angles – [60.9423, 20, ] and rotamer – [3, 0, ]
State 65 : angles – [60.9423, 40, ] and rotamer – [3, 0, ]
State 66 : angles – [60.9423, 60, ] and rotamer – [3, 0, ]
State 67 : angles – [60.9423, 80, ] and rotamer – [3, 0, ]
State 68 : angles – [60.9423, 100, ] and rotamer – [3, 0, ]
State 69 : angles – [60.9423, 120, ] and rotamer – [3, 0, ]
State 70 : angles – [60.9423, 140, ] and rotamer – [3, 0, ]
State 71 : angles – [60.9423, 160, ] and rotamer – [3, 0, ]
State 72 : angles – [60.9423, 180, ] and rotamer – [3, 0, ]
State 73 : angles – [60.9423, 200, ] and rotamer – [3, 0, ]
State 74 : angles – [60.9423, 220, ] and rotamer – [3, 0, ]
State 75 : angles – [60.9423, 240, ] and rotamer – [3, 0, ]
State 76 : angles – [60.9423, 260, ] and rotamer – [3, 0, ]
State 77 : angles – [60.9423, 280, ] and rotamer – [3, 0, ]
State 78 : angles – [60.9423, 300, ] and rotamer – [3, 0, ]
State 79 : angles – [60.9423, 320, ] and rotamer – [3, 0, ]
State 80 : angles – [60.9423, 340, ] and rotamer – [3, 0, ]
State 81 : angles – [173.798, 0, ] and rotamer – [2, 0, ]
State 82 : angles – [173.798, 20, ] and rotamer – [2, 0, ]
State 83 : angles – [173.798, 40, ] and rotamer – [2, 0, ]
State 84 : angles – [173.798, 60, ] and rotamer – [2, 0, ]
State 85 : angles – [173.798, 80, ] and rotamer – [2, 0, ]
State 86 : angles – [173.798, 100, ] and rotamer – [2, 0, ]
State 87 : angles – [173.798, 120, ] and rotamer – [2, 0, ]
State 88 : angles – [173.798, 140, ] and rotamer – [2, 0, ]
State 89 : angles – [173.798, 160, ] and rotamer – [2, 0, ]
State 90 : angles – [173.798, 180, ] and rotamer – [2, 0, ]
State 91 : angles – [173.798, 200, ] and rotamer – [2, 0, ]
State 92 : angles – [173.798, 220, ] and rotamer – [2, 0, ]
State 93 : angles – [173.798, 240, ] and rotamer – [2, 0, ]
State 94 : angles – [173.798, 260, ] and rotamer – [2, 0, ]
State 95 : angles – [173.798, 280, ] and rotamer – [2, 0, ]
State 96 : angles – [173.798, 300, ] and rotamer – [2, 0, ]
State 97 : angles – [173.798, 320, ] and rotamer – [2, 0, ]
State 98 : angles – [173.798, 340, ] and rotamer – [2, 0, ]
State 99 : angles – [62.5433, ] and rotamer – [3, ]
State 100 : angles – [61.588, 61.8578, ] and rotamer – [1, 6, ]
State 101 : angles – [62.6258, 68.5707, 0, ] and rotamer – [1, 6, 0, ]
Completed Singleton Energy Calculation
Energy E = [] 
February 25, 2014 at 4:04 pm #9838Anonymous
How did you generate the rotamer set which you passed to the function? (e.g. how did you set up the packer task you used to generate it?)
You’re getting very few four chi samples, which indicates to me that you’re possibly not designing to lysine, which means you wouldn’t get the desired lysine rotamer. You may want to add printing of the residue name for the rotamer to your state output, so you can see which rotamer corresponds to which amino acid identity.

February 25, 2014 at 8:08 pm #9839Anonymous
The code I am using is a modified version of Jason Pacheco’s code. I have attached my code SumProteinEnergy.py (extension renamed to .txt because .py file not being uploaded) and also attached the 1PGA.pdb file (extension renamed to 1PGA.txt) and the sample_resfile file (extension renamed to .txt). The function that generates the rotamer set and sets up the packer task to generate it is the process_pdb function (see code below). This function takes in the in_file (1PGA.pdb) and the resfile (sample_resfile) to setup the packer task and generate the rotamer set:
def process_pdb(in_file, resfile):
# init stuff
pose = pose_from_pdb(in_file)
nRes = pose.n_residue()
scorefxn = get_fa_scorefxn() # create_score_function()# create packer task
if resfile:
task_pack = TaskFactory.create_packer_task(pose)
parse_resfile(pose, task_pack, resfile)
print ‘Created packer task from resfile’
else:
task_pack = standard_packer_task(pose)
print ‘Created packer task from standard’#task_pack.restrict_to_repacking()
print ‘Task pack is ‘,task_pack
# init rotamer sets
pack_scorefxn_pose_handshake( pose, scorefxn )
pose.update_residue_neighbors()
scorefxn.setup_for_packing( pose, task_pack.designing_residues(), task_pack.designing_residues() )
packer_neighbor_graph = create_packer_graph( pose, scorefxn, task_pack )
rotsets = RotamerSets()
rotsets.set_task( task_pack )
rotsets.build_rotamers( pose, scorefxn, packer_neighbor_graph )
rotsets.prepare_sets_for_packing( pose, scorefxn )
ig = InteractionGraphFactory.create_interaction_graph( task_pack, rotsets, pose, scorefxn )
print “built”, rotsets.nrotamers(), “rotamers at”, rotsets.nmoltenres(), “positions.”# compute energies
rotsets.compute_energies( pose, scorefxn, packer_neighbor_graph, ig )return pose, task_pack, scorefxn, rotsets, ig

February 26, 2014 at 5:40 pm #9840Anonymous
Looking at your resfile, you don’t have LYS4 set to be repacked/designed in the first place. Thus, you shouldn’t be building rotamers for it in any case.
It looks like you have a moltenresid/residue number mismatch. In SumEnergies(), you pass moltenresid to RotamerFromAngles(), but RotamerFromAngles() is expecting a full residue number, not a molten residue number.
So while residue 4 is a lysine, molten residue 4 is an ALA, and has a full residue number of 20. It’s the ALA20 position that your rotamer set is for, and the reason you’re not seeing the same rotamer for LYS4 (even though you’re doing a design that can go to lysine) is that ALA20 is somewhat buried, and the rotamer which corresponds to the one which is currently at position 4 will clash with the backbone (and as such will be pruned from the rotamer set).


AuthorPosts
 You must be logged in to reply to this topic.