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
fldsgn
CircularPermutation.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/fldsgn/CircularPermutation.cc
11
/// @brief perform circularpermutation give a pose ( under development )
12
/// @author Nobuyasu Koga ( nobuyasu@uw.edu )
13
14
// unit headers
15
#include <
protocols/fldsgn/CircularPermutation.hh
>
16
#include <
protocols/fldsgn/CircularPermutationCreator.hh
>
17
18
// projects headers
19
#include <
core/conformation/Conformation.hh
>
20
#include <
core/kinematics/MoveMap.hh
>
21
#include <
core/kinematics/FoldTree.hh
>
22
#include <
core/pose/Pose.hh
>
23
#include <
core/conformation/Residue.hh
>
24
#include <
core/chemical/ResidueTypeSet.hh
>
25
// AUTO-REMOVED #include <core/chemical/ResidueSelector.hh>
26
#include <
core/conformation/ResidueFactory.hh
>
27
28
#include <basic/Tracer.hh>
29
30
#include <
core/pose/util.hh
>
31
#include <
core/pose/symmetry/util.hh
>
32
// AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
33
34
35
#include <
protocols/forge/build/SegmentSwap.hh
>
36
#include <
protocols/forge/build/BuildManager.hh
>
37
#include <
protocols/forge/build/Interval.hh
>
38
// AUTO-REMOVED #include <protocols/forge/build/SegmentRebuild.hh>
39
40
#include <
protocols/forge/methods/fold_tree_functions.hh
>
41
42
// Headers for Paser block
43
#include <utility/tag/Tag.hh>
44
45
#include <
protocols/forge/build/SegmentRebuild.fwd.hh
>
46
#include <utility/vector0.hh>
47
#include <utility/vector1.hh>
48
49
//Auto Headers
50
//#include <protocols/moves/DataMap.hh>
51
52
53
namespace
protocols {
54
namespace
fldsgn {
55
56
static
basic::Tracer
TR
(
"protocols.fldsgn.CircularPermutation"
);
57
58
std::string
59
CircularPermutationCreator::keyname
()
const
60
{
61
return
CircularPermutationCreator::mover_name
();
62
}
63
64
protocols::moves::MoverOP
65
CircularPermutationCreator::create_mover
()
const
{
66
return
new
CircularPermutation
;
67
}
68
69
std::string
70
CircularPermutationCreator::mover_name
()
71
{
72
return
"CircularPermutation"
;
73
}
74
75
76
/// @brief default constructor
77
CircularPermutation::CircularPermutation
() :
78
Mover(
"CircularPermutation"
),
79
new_terminal_pos_( 0 ),
80
ignore_chain_( false ),
81
split_( 0 )
82
{}
83
84
85
/// @Brief copy constructor
86
CircularPermutation::CircularPermutation
(
CircularPermutation
const
& rval ) :
87
//utility::pointer::ReferenceCount(),
88
Super
( rval ),
89
new_terminal_pos_( rval.new_terminal_pos_ ),
90
split_( rval.split_ )
91
{}
92
93
94
/// @brief default destructor
95
CircularPermutation::~CircularPermutation
() {}
96
97
98
/// @brief clone this object
99
CircularPermutation::MoverOP
100
CircularPermutation::clone
()
const
101
{
102
return
new
CircularPermutation
( *
this
);
103
}
104
105
106
/// @brief create this type of object
107
CircularPermutation::MoverOP
108
CircularPermutation::fresh_instance
()
const
109
{
110
return
new
CircularPermutation
();
111
}
112
113
114
/// @brief new N- & C- terminal position
115
void
116
CircularPermutation::new_terminal_pos
(
Size
const
s )
117
{
118
new_terminal_pos_
= s;
119
}
120
121
122
/// @brief total number of cycles
123
CircularPermutation::Size
124
CircularPermutation::new_terminal_pos
()
const
125
{
126
return
new_terminal_pos_
;
127
}
128
129
/// @brief total number of cycles
130
CircularPermutation::Size
131
CircularPermutation::which_chain
(
Size
const
pos,
Pose
const
pose )
const
132
{
133
for
(
Size
i=1; i<=pose.
conformation
().
num_chains
(); i++ ) {
134
135
Size
chain_begin( pose.
conformation
().
chain_begin
( i ) );
136
Size
chain_end( pose.
conformation
().
chain_end
( i ) );
137
138
if
( chain_begin <= pos && chain_end >= pos ) {
139
return
i;
140
}
141
142
}
143
return
0;
144
}
145
146
std::string
147
CircularPermutation::get_name
()
const
{
148
return
CircularPermutationCreator::mover_name
();
149
}
150
151
152
/// @brief
153
void
154
CircularPermutation::split_chains
(
Pose
& pose,
utility::vector1< Size >
const
& pos )
155
{
156
157
using
core::kinematics::FoldTree
;
158
using
core::kinematics::MoveMap
;
159
using
core::pose::Pose
;
160
using
protocols::forge::methods::fold_tree_from_pose
;
161
162
// information of original fold tree completely overridded
163
FoldTree ft =
fold_tree_from_pose
( pose, pose.
fold_tree
().
root
(),
MoveMap
() );
164
165
// insert chain endings
166
for
(
Size
i=1; i<=pos.size(); i++ ) {
167
Size
position = pos[ i ];
168
runtime_assert( position >= 1 && position <= pose.
total_residue
() );
169
pose.
conformation
().
insert_chain_ending
( position );
170
}
171
172
// add terminals
173
for
(
Size
i=1; i<=pose.
conformation
().
num_chains
(); i++ ) {
174
Size
begin = pose.
conformation
().
chain_begin
( i );
175
Size
end
= pose.
conformation
().
chain_end
( i );
176
if
( pose.
residue
( begin ).
is_protein
() && !pose.
residue
( begin ).
is_lower_terminus
() ) {
177
core::pose::add_lower_terminus_type_to_pose_residue
( pose, begin );
178
}
179
if
( pose.
residue
( end ).
is_protein
() && !pose.
residue
( end ).
is_upper_terminus
() ) {
180
core::pose::add_upper_terminus_type_to_pose_residue
( pose, end );
181
}
182
}
183
184
// add jumps
185
for
(
Size
i=2; i<=pose.
conformation
().
num_chains
(); i++ ) {
186
Size
begin = pose.
conformation
().
chain_begin
( i );
187
Size
end
= pose.
conformation
().
chain_end
( i-1 );
188
ft.new_jump( end, begin, end );
189
}
190
191
pose.
fold_tree
( ft );
192
193
}
194
195
196
/// @brief main apply
197
void
CircularPermutation::apply
(
Pose
& pose )
198
{
199
using
protocols::forge::build::BuildManager
;
200
using
protocols::forge::build::SegmentSwap
;
201
using
protocols::forge::build::SegmentRebuild
;
202
using
protocols::forge::build::Interval
;
203
using
core::chemical::ResidueTypeSet
;
204
using
core::conformation::ResidueOP
;
205
using
core::conformation::ResidueFactory
;
206
using
core::kinematics::FoldTree
;
207
using
core::pose::symmetry::is_symmetric
;
208
using
core::pose::symmetry::make_asymmetric_pose
;
209
using
core::pose::symmetry::get_asymmetric_pose_copy_from_symmetric_pose
;
210
211
// make sure position of new terminal within chain lengths
212
if
(
new_terminal_pos_
== 0 ) {
213
TR
<<
"No position to be permutated was specified. "
<< std::endl;
214
return
;
215
}
216
runtime_assert(
new_terminal_pos_
> 1 &&
new_terminal_pos_
<= pose.
total_residue
() );
217
218
// make pose asymmetric if pose is symmetric
219
if
(
is_symmetric
( pose ) ) {
220
Pose
work_pose( pose );
221
pose =
get_asymmetric_pose_copy_from_symmetric_pose
( work_pose );
222
}
223
224
// prepare pose for latter swapped in region
225
Pose
swap_in( pose );
226
227
// determine begin and end positions of chain to be swapped
228
Size
chain_begin;
229
Size
chain( 0 );
230
if
(
ignore_chain_
) {
231
232
chain_begin = 1;
233
// find final chains
234
for
(
Size
i=1; i<=pose.
total_residue
(); i++ ) {
235
if
( pose.
residue
( i ).
is_protein
() &&
static_cast<
int
>
( chain )< pose.
chain
( i ) ) {
236
chain = pose.
chain
( i );
237
}
238
}
239
runtime_assert( chain != 0 );
240
241
}
else
{
242
chain =
which_chain
(
new_terminal_pos_
, pose );
243
chain_begin = pose.
conformation
().
chain_begin
( chain );
244
}
245
Size
chain_end = pose.
conformation
().
chain_end
( chain );
246
247
// add 4 residues at the end of chain
248
ResidueTypeSet
const
& rsd_set( pose.
residue
(1).
residue_type_set
() );
249
ResidueOP
ala(
ResidueFactory::create_residue
( rsd_set.name_map(
"ALA"
) ) );
250
for
(
Size
i=1; i<=4; i++ ) {
251
Size
pos = pose.
conformation
().
chain_end
( chain );
252
pose.
conformation
().
safely_append_polymer_residue_after_seqpos
( *ala, pos,
true
);
253
}
254
255
// Blow away the former parts of pose
256
pose.
conformation
().
delete_residue_range_slow
( chain_begin,
new_terminal_pos_
- 1 );
257
258
// Blow away the latter parts of swap_in pose
259
swap_in.
conformation
().
delete_residue_range_slow
(
new_terminal_pos_
, swap_in.
total_residue
() );
260
if
( chain_begin > 1 ) {
261
// Blow away the former parts of swap_in pose
262
swap_in.
conformation
().
delete_residue_range_slow
( 1, chain_begin - 1 );
263
}
264
265
// swap_in swapped into the 3 residues added at the terminal of the chain
266
MoveMap
movemap;
267
Size
nt = chain_end - (
new_terminal_pos_
- chain_begin ) + 1;
268
BuildManager manager;
269
manager.add(
new
SegmentSwap( Interval( nt, nt+2 ), movemap, swap_in ) );
270
manager.modify( pose );
271
272
// delete the final residues added at the terminal of the chain
273
pose.
conformation
().
delete_residue_range_slow
( chain_end + 1, chain_end + 1 );
274
275
// re-add terminus
276
if
( !pose.
residue
( chain_end - 1 ).
is_upper_terminus
() ) {
277
core::pose::add_upper_terminus_type_to_pose_residue
( pose, chain_end );
278
}
279
280
// re-add terminus
281
if
( !pose.
residue
( chain_begin ).
is_lower_terminus
() ) {
282
core::pose::add_lower_terminus_type_to_pose_residue
( pose, chain_begin );
283
}
284
285
TR
<<
"FoldTree after circular permutation: "
<< pose.
fold_tree
() << std::endl;
286
287
if
(
split_
!= 0 ) {
288
utility::vector1< Size >
positions;
289
positions.push_back(
split_
);
290
pose.
conformation
().
reset_chain_endings
();
291
split_chains
( pose, positions );
292
}
293
294
TR
<< pose.
fold_tree
() << std::endl;
295
296
}
297
298
299
/// @brief parse xml
300
void
301
CircularPermutation::parse_my_tag
(
302
TagPtr
const
tag,
303
DataMap
&,
304
Filters_map
const
&,
305
Movers_map
const
&,
306
Pose
const
& )
307
{
308
309
// set positions of new N- and C- terminal
310
new_terminal_pos_
= ( tag->getOption<
Size
>(
"pos"
, 0 ) );
311
312
// ignore chain
313
ignore_chain_
= ( tag->getOption<
bool
>(
"ignore_chain"
, 0 ) );
314
315
// split chain
316
split_
= ( tag->getOption<
Size
>(
"split_chain"
, 0 ) );
317
318
}
319
320
321
322
}
// namespace fldsgn
323
}
// namespace protocols
Generated on Sat Jun 1 2013 11:49:53 for Rosetta 3.5 by
1.8.4