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
nonlocal
HelixRotate.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/nonlocal/HelixRotate.cc
11
/// @author Christopher Miles (cmiles@uw.edu)
12
13
// Unit headers
14
#include <
protocols/nonlocal/HelixRotate.hh
>
15
16
// C/C++ headers
17
#include <iostream>
18
#include <string>
19
20
// Utility header
21
#include <basic/Tracer.hh>
22
#include <numeric/xyzVector.hh>
23
24
// Project headers
25
#include <
core/conformation/Conformation.hh
>
26
#include <
core/id/NamedAtomID.hh
>
27
#include <
core/kinematics/FoldTree.hh
>
28
#include <
core/kinematics/Jump.hh
>
29
#include <
core/kinematics/Stub.hh
>
30
#include <
core/pose/Pose.hh
>
31
#include <
protocols/loops/Loop.hh
>
32
#include <
protocols/loops/Loops.hh
>
33
#include <
protocols/nonlocal/StarTreeBuilder.hh
>
34
35
// Package headers
36
#include <
protocols/moves/Mover.hh
>
37
38
//Auto Headers
39
#include <utility/vector1.hh>
40
namespace
protocols {
41
namespace
nonlocal {
42
43
static
basic::Tracer
TR
(
"protocols.nonlocal.HelixRotate"
);
44
45
HelixRotate::HelixRotate
() {
46
initialize
(
protocols::loops::Loop
(), 0.0);
47
}
48
49
HelixRotate::HelixRotate
(
const
protocols::loops::Loop
& helix,
double
degrees) {
50
initialize
(helix, degrees);
51
}
52
53
void
HelixRotate::initialize
(
const
protocols::loops::Loop
& helix,
double
degrees) {
54
helix_
= helix;
55
degrees_
= degrees;
56
}
57
58
void
HelixRotate::apply
(
core::pose::Pose
& pose) {
59
using
core::id::NamedAtomID
;
60
using
core::kinematics::FoldTree
;
61
using
core::kinematics::Jump
;
62
using
core::kinematics::Stub
;
63
using
numeric::xyzVector
;
64
using
protocols::loops::Loops
;
65
using
protocols::nonlocal::StarTreeBuilder
;
66
67
if
(!
is_valid
()) {
68
TR
.Warning <<
"HelixRotate::apply() invoked with invalid or incomplete information."
<< std::endl;
69
TR
.Warning <<
" helix_ => "
<<
get_helix
() << std::endl;
70
TR
.Warning <<
" degrees_ => "
<<
get_degrees
() << std::endl;
71
return
;
72
}
73
74
// Retain a copy of the input fold tree, since we're responsible for restoring it
75
FoldTree input_tree = pose.
fold_tree
();
76
77
// Configure new kinematics
78
Loops
chunks;
79
decompose_structure
(pose.
total_residue
(), &chunks);
80
81
StarTreeBuilder
builder;
82
builder.
set_up
(chunks, &pose);
83
84
// Define the axis of translation
85
xyzVector<double>
axis, point;
86
get_rotation_parameters
(pose, &axis, &point);
87
88
// Rotation about the axis
89
unsigned
jump_num =
jump_containing_helix
(chunks);
90
Jump jump = pose.
jump
(jump_num);
91
jump.
rotation_by_axis
(pose.
conformation
().
upstream_jump_stub
(jump_num), axis, point,
get_degrees
());
92
pose.
set_jump
(jump_num, jump);
93
94
// Restore input fold tree
95
builder.tear_down(&pose);
96
pose.
fold_tree
(input_tree);
97
}
98
99
void
avg_ca_position
(
100
const
core::pose::Pose
& pose,
101
const
protocols::loops::Loop
& region,
102
numeric::xyzVector<double>
* point
103
) {
104
assert(point);
105
106
point->zero();
107
for
(
unsigned
i = region.
start
(); i <= region.
stop
(); ++i) {
108
(*point) += pose.
xyz
(
core::id::NamedAtomID
(
"CA"
, i));
109
}
110
111
(*point) /= region.
length
();
112
}
113
114
void
HelixRotate::get_rotation_parameters
(
115
const
core::pose::Pose
& pose,
116
numeric::xyzVector<double>
* axis,
117
numeric::xyzVector<double>
* point
118
)
const
119
{
120
using
core::id::NamedAtomID
;
121
using
numeric::xyzVector
;
122
using
protocols::loops::Loop
;
123
assert(axis);
124
assert(point);
125
126
// Define the point of rotation to be the average of the midpoint +/- 1 residue
127
avg_ca_position
(pose,
Loop
(
helix_
.
midpoint
() - 1,
helix_
.
midpoint
() + 1), point);
128
129
if
(
helix_
.
length
() < 6) {
130
*axis = pose.
xyz
(NamedAtomID(
"CA"
,
helix_
.
stop
())) - pose.
xyz
(NamedAtomID(
"CA"
,
helix_
.
start
()));
131
return
;
132
}
133
134
// Given a sufficient number of points, define the axis of rotation by the
135
// average position of the first and last 3 CA atoms.
136
xyzVector<double>
a,
b
;
137
avg_ca_position
(pose,
Loop
(
helix_
.
start
(),
helix_
.
start
() + 2), &a);
138
avg_ca_position
(pose,
Loop
(
helix_
.
stop
() - 2,
helix_
.
stop
()), &b);
139
*axis = b - a;
140
}
141
142
unsigned
HelixRotate::jump_containing_helix
(
const
protocols::loops::Loops
& chunks)
const
{
143
for
(
unsigned
i = 1; i <= chunks.
num_loop
(); ++i) {
144
if
(chunks[i].
start
() ==
helix_
.
start
())
145
return
i;
146
}
147
return
0;
// invalid
148
}
149
150
void
HelixRotate::decompose_structure
(
unsigned
num_residues,
protocols::loops::Loops
* chunks)
const
{
151
using
protocols::loops::Loop
;
152
assert(chunks);
153
assert(num_residues > 0);
154
155
const
unsigned
start
=
get_helix
().
start
();
156
const
unsigned
stop
=
get_helix
().
stop
();
157
158
// Residues 1 to (helix - 1)
159
if
(start > 1) {
160
chunks->
add_loop
(
Loop
(1, start - 1));
161
}
162
163
// Helix
164
chunks->
add_loop
(
Loop
(start, stop));
165
166
// Residues (helix + 1) to end
167
if
(stop < num_residues) {
168
chunks->
add_loop
(
Loop
(stop + 1, num_residues));
169
}
170
171
chunks->
sequential_order
();
172
}
173
174
bool
HelixRotate::is_valid
()
const
{
175
return
helix_
.
start
() > 0 &&
helix_
.
start
() <
helix_
.
stop
();
176
}
177
178
const
protocols::loops::Loop
&
HelixRotate::get_helix
()
const
{
179
return
helix_
;
180
}
181
182
void
HelixRotate::set_helix
(
const
protocols::loops::Loop
& helix) {
183
helix_
= helix;
184
}
185
186
double
HelixRotate::get_degrees
()
const
{
187
return
degrees_
;
188
}
189
190
void
HelixRotate::set_degrees
(
double
degrees) {
191
degrees_
= degrees;
192
}
193
194
std::string
HelixRotate::get_name
()
const
{
195
return
"HelixRotate"
;
196
}
197
198
moves::MoverOP
HelixRotate::fresh_instance
()
const
{
199
return
new
HelixRotate
();
200
}
201
202
moves::MoverOP
HelixRotate::clone
()
const
{
203
return
new
HelixRotate
(*
this
);
204
}
205
206
}
// namespace nonlocal
207
}
// namespace protocols
Generated on Sat Jun 1 2013 12:01:43 for Rosetta 3.5 by
1.8.4