Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictNonSurfaceToRepackingOperation.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/toolbox/task_operations/RestrictNonSurfaceToRepackingOperation.cc
11 /// @brief
12 /// @author Ron Jacak ronj@unc.edu
13 
14 // Unit Headers
17 
18 // Project Headers
19 #include <core/pose/Pose.hh>
23 
24 // Utility Headers
25 #include <core/types.hh>
26 #include <basic/Tracer.hh>
27 #include <utility/exit.hh>
28 #include <utility/tag/Tag.hh>
29 
30 // C++ Headers
31 #include <set>
32 
35 #include <utility/vector0.hh>
36 #include <utility/vector1.hh>
37 
38 
39 static basic::Tracer TR( "protocols.toolbox.TaskOperations.RestrictNonSurfaceToRepackingOperation" );
40 
41 namespace protocols {
42 namespace toolbox {
43 namespace task_operations {
44 
45 using namespace core::pack::task::operation;
46 
47 // Creator method
51 }
52 
53 // default constructor
55  surface_exposed_nb_cutoff_( 16 ) {}
56 
57 
58 // constructor with custom parameters
60  surface_exposed_nb_cutoff_ = nb_cutoff;
61 }
62 
63 // destructor
65 
66 // clone method, required by TaskOperation interface
68  return new RestrictNonSurfaceToRepackingOperation( *this );
69 }
70 
71 //
72 // setter for nb_count cutoff. this allows users to vary how surface exposed a residue must be for it to be designed.
73 // more specifically, if this value is very low (e.g. 10, or 5), only the most surface-exposed residues will be designed.
74 // very few residues will have 5 or fewer neighbors and remain designable. the rest will be set to repack only.
75 // the apply() method checks to see if a given pose position has GREATER THAN this number of neighbors using the tenA
76 // neighbor graph method num_neighbors_counting_self().
77 //
79  surface_exposed_nb_cutoff_ = nb_count;
80 }
81 
82 
83 //
84 // apply method
85 // Because there's no guarantee that the pose object has been scored at this point, we have to construct a "neighbor
86 // graph" ourselves. I'm going to use the implementation written by Steven L and John K in the PoseMetricCalculators
87 // for this task. The alternative would be to copy the pose object to a new pose (which is somewhat slow), score it
88 // (not trivial either), and lookup the information in the tenA_nb_graph. This alternative is better because it
89 // completely avoids the pose copy operation.
90 //
92 
95 
96  PointGraphOP pg( new PointGraph ); // create graph
98  core::conformation::find_neighbors<core::conformation::PointGraphVertexData,core::conformation::PointGraphEdgeData>( pg, 10.0 /* ten angstrom distance */ ); // create edges
99 
100  core::Size num_neighbors_ = 0;
101  for ( core::Size ii=1; ii <= pose.total_residue(); ++ii ) {
102 
103  // a PointGraph is a typedef of UpperEdgeGraph< PointGraphVertexData, PointGraphEdgeData >
104  // so any of the method in UpperEdgeGraph should be avail. here. The UpperEdgeGraph provides access to nodes
105  // via a get_vertex() method, and each vertex can report back how many nbs it has.
106  // So something that before was really complicated (nb count calculation) is done in <10 lines of code.
107  // the assumption we're making here is that a pose residue position ii is the same index as the point graph vertex
108  // that is indeed the case if you look at what the function residue_point_graph_from_pose().
109  num_neighbors_ = pg->get_vertex(ii).num_neighbors_counting_self();
110 
111  // what about non-canonicals? as long as the point graph can handle them, they should work fine.
112 
113  if ( num_neighbors_ > surface_exposed_nb_cutoff_ ) {
114  // it's not at or below our cutoff, so limit this position to repacking only
116  }
117 
118  // reset count for next position, just to be extra careful
119  num_neighbors_ = 0;
120 
121  }
122 
123 }
124 
125 // parse_tag method; I believe this needs to be implemented so that the TaskOperationFactory can read this particular
126 // TaskOperation out of an XML file specifying task operations to perform
128  surface_exposed_nb_cutoff_ = tag->getOption< core::Size >( "surface_exposed_nb_count_cutoff" );
129 }
130 
131 
132 } //namespace protocols
133 } //namespace toolbox
134 } //namespace task_operations