I just started working with PyRosetta, and i stumbled upon a lot of questions.
I would like to introduce rotamers, and calculate their pairwise energies, and the total energy of the system with given rotamers.
To test, i created a very simple PDB that consist only 2 amino acid.
I have the following code:
from pyrosetta import * from pyrosetta.teaching import * import numpy as np from rosetta.core.pack.rotamer_set import * from rosetta.core.pack import * from rosetta.core.pack.interaction_graph import * from rosetta.core.pack.task import * # for using resfiles import sys init() # scorefxn = get_fa_scorefxn() # create_score_function() scorefxn = ScoreFunction() scorefxn.set_weight(fa_atr, 1.0) scorefxn.set_weight(fa_rep, 1.0) scorefxn.set_weight(fa_sol, 1.0) pose = pose_from_pdb(sys.argv) task_pack = TaskFactory.create_packer_task(pose) # print('Task pack is ',task_pack) rotsets = RotamerSets() 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.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.") rotsets.compute_energies(pose, scorefxn, packer_neighbor_graph, ig) n_rots_I = rotsets.nrotamers_for_moltenres(1) n_rots_J = rotsets.nrotamers_for_moltenres(2) # print(ig.get_two_body_energy_for_edge(1, 2, 299, 288)) E = np.zeros((n_rots_I, n_rots_J)) # print(rotsets.rotamer_set_for_residue(2)) for s_i in range(1, n_rots_I + 1): for s_j in range(1, n_rots_J + 1): E[s_i - 1, s_j - 1] = ig.get_two_body_energy_for_edge(1, 2, s_i, s_j) print(E[0, 1])
Some questions regarding the code.
1: What does a task_packer do? Why is update_residue_neightbors() needed? What is a packer_graph? What is an InteractionGraphFactory? What are sotred in these objects? I was searching through the API, however my lack of programming knowlegde keeps me from understanding.
2: The above code creats ALL rotamer for my two amino acid, however i would only like to use amino acids with certain type. For example, i would only like to compute ALA, LYS and ARG at position 1. How can i do this?
3: I (think) compute the pairwise energies of rotamers, and store it at variable E. Are these the pairwise energies of the two rotamers (s_i and s_j)?
4: How can i comupte the total energy of a state? For example i would like to calculate the total enery o the system with rotamer(1) at position (1) and rotamer(2) at position 2.
Thanks a lot!