Rosetta 3.4
|
Defines the interaction graph that will keep track of changes to the surface score. More...
#include <SurfaceInteractionGraph.hh>
Public Types | |
typedef AdditionalBackgroundNodesInteractionGraph < V, E, G > | parent |
Public Member Functions | |
SurfaceInteractionGraph (int num_nodes) | |
Main constructor. | |
virtual | ~SurfaceInteractionGraph () |
void | initialize (rotamer_set::RotamerSetsBase const &rot_sets) |
virtual void | prepare_for_simulated_annealing () |
Prepares the graph to begin simulated annealing. | |
virtual void | blanket_assign_state_0 () |
assigns state 0 -- the unassigned state -- to all (first class) vertices in the graph | |
virtual core::PackerEnergy | set_state_for_node (int node_ind, int new_state) |
Assign new_state to the first class node with index node_ind. | |
virtual core::PackerEnergy | set_network_state (FArray1_int &node_states) |
Switch the state assignment of every first class node in the graph. Useful, for instance, if you want to switch to the best network state that you've found so far. Like after simulated annealing is done with! | |
virtual void | consider_substitution (int node_ind, int new_state, core::PackerEnergy &delta_energy, core::PackerEnergy &prev_energy_for_node) |
returns the change in energy induced by switching a particular node from its currently assigned state to some alternate state. | |
virtual core::PackerEnergy | commit_considered_substitution () |
Commits the substitution that the sim annealer had previously asked the graph to consider. Returns the accurate total energy for the graph. | |
virtual core::PackerEnergy | get_energy_current_state_assignment () |
returns the energy of the entire graph under the current network state assignment. | |
virtual void | set_errorfull_deltaE_threshold (Real deltaE) |
Allows the sim-annealer to specify a deltaE threshold above which, it is no longer necessary to be very accurate. | |
void | set_num_residues_in_protein (int num_res) |
tells the graph how many residues there are total in the protein | |
void | set_num_background_residues (int num_background_residues) |
tells the graph how many residues there are as part of the protein that are not part of the combinatorial optimization process -- they are part of the background | |
void | set_residue_as_background_residue (int residue) |
informs the graph that a particular residue is part of the background. first class residues, in terms of surface, will be residues that are surface exposed and are varying. background residues will be ones that are surface exposed but not varying since they will contribute to the surface score of the first class residues and whose own surface score will change depending on the first class residues. | |
void | print_internal_energies_for_current_state_assignment () |
Prints out the one and two-body energies for every node and bgnode in the graph. | |
virtual int | get_edge_memory_usage () const |
Should return a measurement of the memory used by the interaction graph to store the rotamer pair energies. Unimplemented. | |
virtual unsigned int | count_static_memory () const |
virtual unsigned int | count_dynamic_memory () const |
void | print () const |
useful for debugging | |
pose::Pose const & | pose () const |
void | set_pose (pose::Pose const &pose) |
task::PackerTask const & | packer_task () const |
void | set_packer_task (task::PackerTask const &task) |
We need a copy of the packer task for 2 reasons: 1) to figure out what (if any) the weight on the surface score is; and 2) to determine which residues are being packed and/or designed. We have to figure the packing options because it determines whether a residue becomes a FirstClass (SurfaceNode) node or a background node. | |
void | set_surface_score_weight (Real weight) |
Real | surface_score_weight () |
rotamer_set::RotamerSets const & | rotamer_sets () const |
void | set_rotamer_sets (rotamer_set::RotamerSets const &rotsets) |
int | bg_node_2_resid (int node_index) |
Provides read access to the bg to resid array. Returns -1 if the index is not in bounds. | |
std::vector< int > | get_network_state () const |
Returns the state on each FCNode, but not necessarily in pose resid order. Only used by the unit tests. | |
void | set_observed_sufficient_boolean_true () |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests. | |
std::vector< Real > | get_hASA_for_node_and_nbs (int index) |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests. | |
std::vector< Real > | get_alt_state_hASA_for_node_and_nbs (int index) |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests. | |
Protected Member Functions | |
virtual core::pack::interaction_graph::NodeBase * | create_new_node (int node_index, int num_states) |
factory method pattern for instantiation of SurfaceNode objects, used by InteractionGraphBase class. | |
virtual core::pack::interaction_graph::EdgeBase * | create_new_edge (int index1, int index2) |
factory method pattern for instantiation of SurfaceEdge objects, used by InteractionGraphBase class. | |
virtual BackgroundNode< V, E, G > * | create_background_node (int node_index) |
factory method pattern for instantiation of SurfaceBackgroundResidueNode objects, used by AdditionalBackgroundNodesInteractionGraph class. | |
virtual BackgroundToFirstClassEdge< V, E, G > * | create_background_edge (int fc_node_index, int bg_node_index) |
factory method pattern for instantiation of SurfaceBackgroundEdge objects, used by AdditionalBackgroundNodesInteractionGraph class. | |
SurfaceNode< V, E, G > * | get_surface_node (int index) const |
SurfaceBackgroundNode< V, E, G > * | get_surface_bg_node (int index) const |
void | update_internal_energy_totals_surface () |
After every 2^10 commits, the graph traverses its nodes and edges and re-tallies the total energy of the current state assignment. This update prevents the accumulation of numerical drift, increasing accuracy. |
Defines the interaction graph that will keep track of changes to the surface score.
typedef AdditionalBackgroundNodesInteractionGraph< V, E, G > core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::parent |
core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::SurfaceInteractionGraph | ( | int | num_nodes | ) |
Main constructor.
SurfaceInteractionGraph::SurfaceInteractionGraph
num_nodes | - [in] - the number of first class nodes in the graph. The number of second class nodes is reported to the graph much later. |
core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::~SurfaceInteractionGraph | ( | ) | [virtual] |
int core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::bg_node_2_resid | ( | int | node_index | ) |
Provides read access to the bg to resid array. Returns -1 if the index is not in bounds.
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::blanket_assign_state_0 | ( | ) | [virtual] |
assigns state 0 -- the unassigned state -- to all (first class) vertices in the graph
SurfaceInteractionGraph::blanket_assign_state_0
References TR_SIG().
core::PackerEnergy core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::commit_considered_substitution | ( | ) | [virtual] |
Commits the substitution that the sim annealer had previously asked the graph to consider. Returns the accurate total energy for the graph.
SurfaceInteractionGraph::commit_considered_substitution
References TR_SIG().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::consider_substitution | ( | int | node_ind, |
int | new_state, | ||
core::PackerEnergy & | delta_energy, | ||
core::PackerEnergy & | prev_energy_for_node | ||
) | [virtual] |
returns the change in energy induced by switching a particular node from its currently assigned state to some alternate state.
SurfaceInteractionGraph::consider_substitution
node_ind | - [in] - the index of the (first class) node new_state - [in] - the alternate state that the node should consider delta_energy - [out] - the change in energy induced on the entire graph by substituting a node's current state with the alternate. This energy may be inaccurate if it exceeds a threshold set by the sim-annealer. prev_energy_for_node - [out] - the sum of the pair-wise decomposable portion of the energy function for the node's currently assigned state |
References TR_SIG().
unsigned int core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::count_dynamic_memory | ( | ) | const [virtual] |
unsigned int core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::count_static_memory | ( | ) | const [virtual] |
BackgroundToFirstClassEdge< V, E, G > * core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::create_background_edge | ( | int | fc_node_index, |
int | bg_node_index | ||
) | [protected, virtual] |
factory method pattern for instantiation of SurfaceBackgroundEdge objects, used by AdditionalBackgroundNodesInteractionGraph class.
SurfaceInteractionGraph::create_background_edge
fc_node_index | - [in] - the index of the first class node sc_node_index - [in] - the index of the second class node |
Implements core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G >.
BackgroundNode< V, E, G > * core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::create_background_node | ( | int | node_index | ) | [protected, virtual] |
factory method pattern for instantiation of SurfaceBackgroundResidueNode objects, used by AdditionalBackgroundNodesInteractionGraph class.
SurfaceInteractionGraph::create_background_node
node_index | - [in] - the index of the (second class) node |
Implements core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G >.
References TR_SIG().
core::pack::interaction_graph::EdgeBase * core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::create_new_edge | ( | int | index1, |
int | index2 | ||
) | [protected, virtual] |
factory method pattern for instantiation of SurfaceEdge objects, used by InteractionGraphBase class.
SurfaceInteractionGraph::create_new_edge
index1 | - [in] - the index of the lower-indexed (first class) node index2 - [in] - the index of the higher-indexed (first class) node |
References TR_SIG().
core::pack::interaction_graph::NodeBase * core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::create_new_node | ( | int | node_index, |
int | num_states | ||
) | [protected, virtual] |
factory method pattern for instantiation of SurfaceNode objects, used by InteractionGraphBase class.
SurfaceInteractionGraph::create_new_node
node_index | - [in] - the index of the (first class) node num_states - [in] - the number of states for that node |
References TR_SIG().
std::vector< Real > core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_alt_state_hASA_for_node_and_nbs | ( | int | index | ) |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests.
SurfaceInteractionGraph::get_alt_state_hASA_for_node_and_nbs
int core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_edge_memory_usage | ( | ) | const [virtual] |
Should return a measurement of the memory used by the interaction graph to store the rotamer pair energies. Unimplemented.
core::PackerEnergy core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_energy_current_state_assignment | ( | ) | [virtual] |
returns the energy of the entire graph under the current network state assignment.
SurfaceInteractionGraph::get_energy_current_state_assignment
std::vector< Real > core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_hASA_for_node_and_nbs | ( | int | index | ) |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests.
std::vector< int > core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_network_state | ( | ) | const |
Returns the state on each FCNode, but not necessarily in pose resid order. Only used by the unit tests.
SurfaceBackgroundNode< V, E, G >* core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_surface_bg_node | ( | int | index | ) | const [inline, protected] |
SurfaceNode< V, E, G >* core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::get_surface_node | ( | int | index | ) | const [inline, protected] |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::initialize | ( | rotamer_set::RotamerSetsBase const & | rot_sets_base | ) |
SurfaceInteractionGraph::initialize()
In ++, there's a file InteractionGraphSupport.cc which is an analog of the InteractionGraphFactory in mini. In ++, the InteractionGraphSupport file instantiates and initializes, depending on the command line switches, the right interaction graph. For the SASAInteractionGraph, it first initializes the PDInteractionGraph (which is the base) and then calls the SASAIG initialize method.
The thing is that this initialize method can't be called when the graph is constructed in the InteractionGraphFactory. The reason is that the PDInteractionGraph base initialize() method is NOT called until later in the pack rotamers process. (Actually it's called from within rotsets->compute_energies().) Only after the rotsets->compute energies returns can I stick in an initialize() method call for the SurfaceInteractionGraph (SIG). But then that's too late because the rotsets object has already computed some energies. Perhaps that's ok though. The rotsets object only calculates the PD energy terms - it doesn't do anything with non-PD terms.
If a SIG init method is called during construction of the SIG, then the init method that's called by the rotsets object causes all the node info that was set in the SIG init method to be lost because the rotsets init method recreates all the nodes in the interaction graph when it runs. (That was a fun behaviour to figure out.)
So the solution I'm going for is to call this init method in the prepare for simulated annealing method of this class. That gets called just before SA starts, so it will do tasks 1) and 2) above then. It doesn't really matter when the tasks get done as long as it happens before SA starts. This also means that the SIG will now have to keep a reference to the Pose, the Task, and the RotamerSets objects since it needs all of these things to do tasks 1) and 2).
prepare_for_simulated_annealing gets called by the FixbbSA::run() method. Before this method, the rotamersets object has called compute_energies() (the whole process being started in pack_rotamers) which calls initialize() on the IG. I need to place the SIG init method directly after the IG init method that the RS object calls.
Older comments: This interaction graph is templated so that it can be used with the original PD or the OTF graphs. If it's an OTF graph, then a reference to the pose object is available with the pose() method. However, I can't rely on having that method for the case when an OTF graph is not used. Thus, take the pose reference in as a parameter and refactor later if necessary.
Newest comments: Don't call the parent classes initialize method because that calls create_new_node for all designable position, making every node in the graph a first class residue (erroneously!). Then after that, some residues are set as background residues so I'm surprised things were even working at all! Unfortunately, the class hierarchy makes setting designable residues that are surface-exposed be the only FirstClassNodes difficult. What has to happen is that non-designable positions will be the BGNodes and molten positions will be FCNodes. Then, each type of node will store a boolean flagging whether it is surface-exposed or not. Then, when a consider sub call is made, the nodes will immediately check the value of the boolean and return 0 immediately if it's not surface-exposed.
07/16/2008- Unfortunately, I can't just replicate all of the functionality of the parent classes initialize method here because it's different for PDIGs and LMIGs. And some of the their corresponding function calls are not defined in both classes so I get compile errors if I try to do it this way. There are a few possible solutions I could use for the problem of schizophrenic node (nodes which are getting assigned as BG and FC nodes). 1) I could just use Andrew's LFs designation that any designable or packable node is a FC node and any node not being packed or designed is a BGNode. This approach is the easiest to implement but since nodes that are only being packed aren't changing in sequence, their surface score shouldn't be changing so it's an inefficiency. 2) I could change the "create_node" call in this class to return either a Node or BGNode depending on what the packer_task has in it. Then the parent templated IG classes would get the right kind of node. But then, I would have to potentially change the AddtlBGNodesIG class method "setNumResiduesAsBackground" because in that call is a for loop which creates background nodes. This would complicate creating new non-PD terms in mini, because it would be specific for this case (surface). 3) Figure out some OO way of handling the distinction between packable and nonpackable residues. The OO-correct way to do this would probably be to subclass AdditionalBackgroundNodesInteractionGraph to something like SurfaceExposedNodesInteractionGraph and then make the SurfaceInteractionGraph inherit that one. Then "FirstClassNodes" would be nodes that are designable and surface-exposed; all other nodes would be "BackgroundNodes".
Since it would require alot of work to write another derived class for probably not that significant (or necessary) performance improvement, I'll just make packable residues be FC nodes also. So continue to call the parent classes initialize() method. Just set residues which are not packable nor designable to BG nodes.
References core::pack::rotamer_set::RotamerSets::nmoltenres(), and TR_SIG().
task::PackerTask const& core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::packer_task | ( | ) | const [inline] |
pose::Pose const& core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::pose | ( | ) | const [inline] |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::prepare_for_simulated_annealing | ( | ) | [virtual] |
Prepares the graph to begin simulated annealing.
SurfaceInteractionGraph::prepare_for_simulated_annealing
Reimplemented from core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G >.
References TR_SIG().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::print | ( | ) | const |
useful for debugging
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::print_internal_energies_for_current_state_assignment | ( | ) |
Prints out the one and two-body energies for every node and bgnode in the graph.
SurfaceInteractionGraph::print_internal_energies_for_current_state_assignment
References core::scoring::surface, and TR_SIG().
rotamer_set::RotamerSets const& core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::rotamer_sets | ( | ) | const [inline] |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_errorfull_deltaE_threshold | ( | Real | deltaE | ) | [virtual] |
Allows the sim-annealer to specify a deltaE threshold above which, it is no longer necessary to be very accurate.
SurfaceInteractionGraph::set_errorfull_deltaE_threshold
References core::pack::interaction_graph::SurfaceNode< V, E, G >::print_surface_avoidance_stats(), core::pack::interaction_graph::SurfaceNode< V, E, G >::reset_surface_avoidance_stats(), and TR_SIG().
core::PackerEnergy core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_network_state | ( | FArray1_int & | node_states | ) | [virtual] |
Switch the state assignment of every first class node in the graph. Useful, for instance, if you want to switch to the best network state that you've found so far. Like after simulated annealing is done with!
SurfaceInteractionGraph::set_network_state
node_states | - [in] - the array of states, one for each vertex in the graph |
References TR_SIG().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_num_background_residues | ( | int | num_background_residues | ) |
tells the graph how many residues there are as part of the protein that are not part of the combinatorial optimization process -- they are part of the background
SurfaceInteractionGraph::set_num_background_residues
num_background_residues | - [in] - the number of background residues in the protein. |
References TR_SIG().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_num_residues_in_protein | ( | int | num_res | ) |
tells the graph how many residues there are total in the protein
SurfaceInteractionGraph::set_num_residues_in_protein
How does this method handle cofactors, ligands that get included in pose().total_residue()? It definitely allocates space in the array for them, and those residues will apparently be made into first-class nodes. But when it comes time to do the packing, they don't matter because they're not hydrophobic - they're not even amino acids - so they don't get updated.
num_res | - [in] - the total number of residues |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_observed_sufficient_boolean_true | ( | ) |
Sets the observed_sufficient_surface_E_to_predict_min_ to true. Only used by the unit tests.
SurfaceInteractionGraph::set_observed_sufficient_boolean_true
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_packer_task | ( | task::PackerTask const & | the_task | ) |
We need a copy of the packer task for 2 reasons: 1) to figure out what (if any) the weight on the surface score is; and 2) to determine which residues are being packed and/or designed. We have to figure the packing options because it determines whether a residue becomes a FirstClass (SurfaceNode) node or a background node.
SurfaceInteractionGraph::set_packer_task
References core::pack::task::PackerTask::clone().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_pose | ( | pose::Pose const & | pose | ) |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_residue_as_background_residue | ( | int | residue | ) |
informs the graph that a particular residue is part of the background. first class residues, in terms of surface, will be residues that are surface exposed and are varying. background residues will be ones that are surface exposed but not varying since they will contribute to the surface score of the first class residues and whose own surface score will change depending on the first class residues.
SurfaceInteractionGraph::set_residue_as_background_residue
residue | - [in] - the residue identifier |
References TR_SIG().
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_rotamer_sets | ( | rotamer_set::RotamerSets const & | rotsets | ) |
core::PackerEnergy core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_state_for_node | ( | int | node_ind, |
int | new_state | ||
) | [virtual] |
Assign new_state to the first class node with index node_ind.
SurfaceInteractionGraph::set_state_for_node
node_ind | - [in] - the index of the (first class) node new_state - [in] - the new state assigned to the node |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::set_surface_score_weight | ( | Real | weight | ) | [inline] |
Real core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::surface_score_weight | ( | ) | [inline] |
void core::pack::interaction_graph::SurfaceInteractionGraph< V, E, G >::update_internal_energy_totals_surface | ( | ) | [protected] |
After every 2^10 commits, the graph traverses its nodes and edges and re-tallies the total energy of the current state assignment. This update prevents the accumulation of numerical drift, increasing accuracy.
SurfaceInteractionGraph::update_internal_energy_totals_surface
References core::pack::interaction_graph::SurfaceNode< V, E, G >::print_surface_avoidance_stats(), and TR_SIG().