What is the most elegant way to display rotamers in PyMol?
This is a spin-off from this question.
I have a basic implementation working here. I had the most problems since doing r.pose_from_sequence(‘Z’) was not working.
Any suggestions about improving this are welcome.
_______________________
def display_rotamers(pose, rotamers, pymol_mover):
“””Displays al the rotamers (allready built) at a given rotamers.resid()
using the given pymol_mover
“””
#there must be a better way to create a one amino acid pose, but I can’t find it
#Problem is with R1A or Z residue. pose_from_sequence does not seem to work
#doing r.pose_from_sequence(‘Z’) reports that residue can not be found
short_pose = r.pose_from_sequence(‘G’, auto_termini=False)
mut = r.MutateResidue(1 , rotamers.rotamer(1).name3())
mut.apply(short_pose)
short_pose.copy_segment(1, pose, 1, rotamers.resid())
old_keep_history = pymol_mover.keep_history()
#add the rotamers as pymol states. remember the old keep_history setting
pymol_mover.keep_history(True)
short_pose.pdb_info().name(rotamers.rotamer(1).name1()+str( rotamers.resid()))
for i in range1(rotamers.num_rotamers()):
#print rotamers.rotamer(i).chi()
short_pose.residue(1).set_all_chi(rotamers.rotamer(i).chi())
#short_pose.pdb_info().name(rotamers.rotamer(i).name1()+str(i))
pymol_mover.apply(short_pose)
pymol_mover.keep_history(old_keep_history)