Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
toolbox
task_operations
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
15
#include <
protocols/toolbox/task_operations/RestrictNonSurfaceToRepackingOperation.hh
>
16
#include <
protocols/toolbox/task_operations/RestrictNonSurfaceToRepackingOperationCreator.hh
>
17
18
// Project Headers
19
#include <
core/pose/Pose.hh
>
20
#include <
core/pack/task/PackerTask.hh
>
21
#include <
core/conformation/PointGraph.hh
>
22
#include <
core/conformation/find_neighbors.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
33
#include <
core/conformation/PointGraphData.hh
>
34
#include <
core/graph/UpperEdgeGraph.hh
>
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
48
core::pack::task::operation::TaskOperationOP
49
RestrictNonSurfaceToRepackingOperationCreator::create_task_operation
()
const
{
50
return
new
RestrictNonSurfaceToRepackingOperation
;
51
}
52
53
// default constructor
54
RestrictNonSurfaceToRepackingOperation::RestrictNonSurfaceToRepackingOperation
() :
55
surface_exposed_nb_cutoff_( 16 ) {}
56
57
58
// constructor with custom parameters
59
RestrictNonSurfaceToRepackingOperation::RestrictNonSurfaceToRepackingOperation
(
core::Size
nb_cutoff ) {
60
surface_exposed_nb_cutoff_
= nb_cutoff;
61
}
62
63
// destructor
64
RestrictNonSurfaceToRepackingOperation::~RestrictNonSurfaceToRepackingOperation
() {}
65
66
// clone method, required by TaskOperation interface
67
TaskOperationOP
RestrictNonSurfaceToRepackingOperation::clone
()
const
{
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
//
78
void
RestrictNonSurfaceToRepackingOperation::surface_exposed_nb_cutoff
(
core::Size
const
nb_count ) {
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
//
91
void
RestrictNonSurfaceToRepackingOperation::apply
(
core::pose::Pose
const
& pose,
core::pack::task::PackerTask
& task )
const
{
92
93
using
core::conformation::PointGraph
;
94
using
core::conformation::PointGraphOP
;
95
96
PointGraphOP
pg(
new
PointGraph
);
// create graph
97
core::conformation::residue_point_graph_from_conformation
( pose.
conformation
(), *pg );
// create vertices
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
115
task.
nonconst_residue_task
( ii ).
restrict_to_repacking
();
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
127
void
RestrictNonSurfaceToRepackingOperation::parse_tag
(
utility::tag::TagPtr
tag ) {
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
Generated on Sat Jun 1 2013 12:23:47 for Rosetta 3.5 by
1.8.4