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
forge
build
GrowLeft.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/forge/build/GrowLeft.cc
11
/// @brief instruction to create an n-side extension
12
/// @author Yih-En Andrew Ban (yab@u.washington.edu)
13
14
// unit headers
15
#include <
protocols/forge/build/GrowLeft.hh
>
16
17
// package headers
18
#include <
protocols/forge/methods/pose_mod.hh
>
19
#include <
protocols/forge/methods/util.hh
>
20
21
// project headers
22
23
#include <
core/chemical/ResidueType.hh
>
24
#include <
core/conformation/Conformation.hh
>
25
#include <
core/conformation/signals/LengthEvent.hh
>
26
#include <
core/kinematics/MoveMap.hh
>
27
#include <
core/pose/Pose.hh
>
28
29
#include <
core/pose/annotated_sequence.hh
>
30
#include <utility/vector1.hh>
31
32
33
34
namespace
protocols {
35
namespace
forge {
36
namespace
build {
37
38
39
/// @brief default constructor
40
GrowLeft::GrowLeft
() :
41
Super
(
Interval
( 0, 0 ) ),
42
pos_( 0 )
43
{}
44
45
46
/// @brief constructor
47
/// @param[in] pos grow an n-side extension prior to this position
48
/// @param[in] ss the secondary structure desired, also defines length of extension
49
/// @param[in] aa the annotated amino acid sequence desired, default is poly-alanine
50
/// @param[in] rts the residue type set to use, default FA_STANDARD
51
/// @remarks length of the *one-letter* aa must equal the length of ss
52
GrowLeft::GrowLeft
(
53
Size
const
pos,
54
String
const
& ss,
55
String
const
& aa,
56
ResidueTypeSetCAP
rts
57
) :
58
Super
(
Interval
( pos, pos ), rts ),
59
pos_( pos ),
60
ss_( ss ),
61
aa_( aa )
62
{
63
// build poly-alanine if empty string
64
if
(
aa_
.empty() ) {
65
aa_
=
String
(
ss_
.length(),
'A'
);
66
}
67
68
assert(
ss_
.length() ==
core::pose::annotated_to_oneletter_sequence
(
aa_
).length() );
69
}
70
71
72
/// @brief copy constructor
73
GrowLeft::GrowLeft
(
GrowLeft
const
& rval ) :
74
Super
( rval ),
75
pos_( rval.pos_ ),
76
ss_( rval.ss_ ),
77
aa_( rval.aa_ )
78
{}
79
80
81
/// @brief default destructor
82
GrowLeft::~GrowLeft
() {}
83
84
85
/// @brief copy assignment
86
GrowLeft
&
GrowLeft::operator =
(
GrowLeft
const
& rval ) {
87
if
(
this
!= &rval ) {
88
Super::operator =
( rval );
89
90
pos_
= rval.
pos_
;
91
ss_
= rval.
ss_
;
92
aa_
= rval.
aa_
;
93
}
94
return
*
this
;
95
}
96
97
98
/// @brief clone this object
99
BuildInstructionOP
GrowLeft::clone
()
const
{
100
return
new
GrowLeft
( *
this
);
101
}
102
103
104
/// @brief return a copy of the set of positions within the new region
105
/// that were pre-existing in the original Pose prior to modify()
106
/// @return An empty set -- no positions are pre-existing.
107
GrowLeft::Positions
GrowLeft::preexisting_positions
()
const
{
108
return
Positions
();
109
}
110
111
112
/// @brief return a copy of the set of positions that are "new" and did
113
/// not exist in the original Pose.
114
/// @return A set of positions spanning the entire region -- all positions
115
/// are new.
116
GrowLeft::Positions
GrowLeft::new_positions
()
const
{
117
using
protocols::forge::methods::closed_range
;
118
119
Interval
const
ival =
interval
();
120
return
closed_range
( ival.
left
, ival.
right
);
121
}
122
123
124
/// @brief return a copy of the set of positions within the newly modified
125
/// region that has a defined conformation. E.g. copied residues.
126
/// @return An empty set -- no positions are defined.
127
/// @details This set can change wrt length changes in Pose/Conformation being
128
/// watched.
129
GrowLeft::Positions
GrowLeft::defined_positions
()
const
{
130
return
Positions
();
131
}
132
133
134
/// @brief return a copy of the set of positions within the newly modified
135
/// region that has an undefined conformation. E.g. existing or copied residues.
136
/// @return A set of positions spanning the entire region -- all positions
137
/// are undefined.
138
/// @details This set can change wrt length changes in Pose/Conformation being
139
/// watched.
140
GrowLeft::Positions
GrowLeft::undefined_positions
()
const
{
141
// for GrowLeft this is the same as the new positions
142
return
new_positions
();
143
}
144
145
146
/// @brief return a copy of the MoveMap that defines the moveable/fixed
147
/// positions/dofs for this instruction
148
/// @return a MoveMap with [interval.left, interval.right] bb & chi set to true
149
/// at the MoveMapTorsionID level
150
/// @details This set can change wrt length changes in Pose/Conformation being
151
/// watched.
152
GrowLeft::MoveMap
GrowLeft::movemap
()
const
{
153
Positions
const
newp =
new_positions
();
154
155
MoveMap
mm;
156
157
for
( Positions::const_iterator i = newp.begin(), ie = newp.end(); i != ie; ++i ) {
158
mm.
set_bb
( *i,
true
);
159
mm.
set_chi
( *i,
true
);
160
}
161
162
return
mm;
163
}
164
165
166
/// @brief update indexing on residue append
167
void
GrowLeft::on_residue_append
(
LengthEvent
const
& event ) {
168
if
( event.
position
<
pos_
) {
169
//++pos_;
170
pos_
+=
event
.length_change;
171
}
172
}
173
174
175
/// @brief update indexing on residue prepend
176
void
GrowLeft::on_residue_prepend
(
LengthEvent
const
& event ) {
177
if
( event.
position
<=
pos_
) {
178
//++pos_;
179
pos_
+=
event
.length_change;
180
}
181
}
182
183
184
/// @brief update indexing on residue delete
185
void
GrowLeft::on_residue_delete
(
LengthEvent
const
& event ) {
186
if
(
pos_
> 1 && event.
position
<=
pos_
&& (
int
(
pos_
) + event.
length_change
> 0) ) {
187
//--pos_;
188
if
(
int
(
pos_
) + event.
length_change
<
int
(event.
position
) )
pos_
=
event
.position - 1;
189
pos_
+=
event
.length_change;
190
}
191
}
192
193
194
/// @brief return the set of positions within the original interval that
195
/// will be kept in this BuildInstruction
196
/// @return An empty set -- no positions are kept.
197
GrowLeft::Positions
GrowLeft::original_kept_positions
()
const
{
198
return
Positions
();
199
}
200
201
202
/// @brief return set of positions within the original interval that will
203
/// be deleted in this BuildInstruction
204
/// @return An empty set -- no positions are deleted.
205
GrowLeft::Positions
GrowLeft::original_deleted_positions
()
const
{
206
return
Positions
();
207
}
208
209
210
/// @brief return set of any fixed positions necessary with respect to the original
211
/// interval and original Pose numbering
212
/// @remarks Used for ensuring build regions for instructions do not overlap and
213
/// so that jumps may be placed correctly.
214
/// @return empty set if no fixed positions
215
GrowLeft::Positions
GrowLeft::original_fixed_positions
()
const
{
216
Positions
fixed;
217
fixed.insert(
original_interval
().right );
218
return
fixed;
219
}
220
221
222
/// @brief return set of any mutable positions necessary with respect to the original
223
/// interval and original Pose numbering
224
/// @remarks Used for ensuring build regions for instructions do not overlap and
225
/// so that jumps may be placed correctly.
226
/// @return empty set if no mutable positions
227
GrowLeft::Positions
GrowLeft::original_mutable_positions
()
const
{
228
return
Positions
();
229
}
230
231
232
/// @brief do the actual work of modifying the Pose
233
void
GrowLeft::modify_impl
(
Pose
& pose ) {
234
using
core::chemical::ResidueTypeCOPs
;
235
using
protocols::forge::methods::grow_left_rtype
;
236
using
protocols::forge::methods::trans_omega
;
237
238
// grab residue types from aa string
239
ResidueTypeCOPs
r_types =
core::pose::residue_types_from_sequence
(
aa_
,
residue_type_set
(),
false
);
240
assert( r_types.size() ==
ss_
.length() );
241
242
// BEGIN POS SHIFT: after this point, pos_ will begin to shift due to length
243
// changes in the Pose
244
245
// grow extension
246
Size
left_endpoint =
grow_left_rtype
( pose,
pos_
, r_types.rbegin(), r_types.rend() );
247
assert( left_endpoint ==
pos_
-
ss_
.length() );
248
249
// END POS SHIFT: after this point, pos_ has stabilized
250
251
// assume proper omega
252
Interval
new_region =
interval
();
253
trans_omega
( new_region.left, new_region.right, pose );
254
255
// set the desired secondary structure
256
for
(
Size
r = left_endpoint, i = 0; r <=
pos_
- 1; ++r, ++i ) {
257
pose.
set_secstruct
( r,
ss_
.at( i ) );
258
}
259
}
260
261
262
/// @brief do the actual reset of intervals, positions, etc to initial state
263
void
GrowLeft::reset_accounting_impl
() {
264
pos_
=
original_interval
().
right
;
265
}
266
267
268
}
// namespace build
269
}
// namespace forge
270
}
// namespace protocols
Generated on Sat Jun 1 2013 11:51:17 for Rosetta 3.5 by
1.8.4