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
core
fragment
Frame.hh
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
// :noTabs=false:tabSize=4:indentSize=4:
4
//
5
// (c) Copyright Rosetta Commons Member Institutions.
6
// (c) This file is part of the Rosetta software suite and is made available under license.
7
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10
11
/// @file core/fragments/Frame.hh
12
/// @brief set of fragments for a certain alignment frame
13
/// @author Oliver Lange (olange@u.washington.edu)
14
/// @author James Thompson
15
/// @date Wed Oct 20 12:08:31 2007
16
///
17
#ifndef INCLUDED_core_fragment_Frame_HH
18
#define INCLUDED_core_fragment_Frame_HH
19
20
// Unit Headers
21
#include <
core/fragment/Frame.fwd.hh
>
22
23
// Package Headers
24
// AUTO-REMOVED #include <core/fragment/FragData.hh>
25
#include <
core/fragment/BaseCacheUnit.hh
>
26
27
// Project Headers
28
#include <
core/fragment/SingleResidueFragData.fwd.hh
>
29
30
#include <
core/chemical/ResidueTypeSet.fwd.hh
>
31
#include <
core/pose/Pose.fwd.hh
>
32
#include <
core/kinematics/MoveMap.fwd.hh
>
33
//#include <core/io/pdb/pose_io.hh> //needed for hack in fragment_as_pose
34
#include <
core/id/SequenceMapping.fwd.hh
>
35
36
// Utility headers
37
#include <utility/vector1.fwd.hh>
38
#include <utility/pointer/ReferenceCount.hh>
39
#ifdef BOINC
40
#include <utility/fix_boinc_read.hh>
41
42
#endif
43
44
#ifdef WIN32
45
#include <string>
46
#include <
core/fragment/FragData.hh
>
47
#endif
48
49
// C++ STL Headers
50
#include <map>
51
// AUTO-REMOVED #include <set>
52
// AUTO-REMOVED #include <ostream>
53
54
#include <
core/types.hh
>
55
#include <
core/fragment/FragData.fwd.hh
>
56
#include <utility/vector1.hh>
57
58
59
namespace
core {
60
namespace
fragment {
61
62
/* How to make a top_N_frag thingy, i.e., get a Frame that does only use a certain subset of the
63
available FragData
64
clearly that will be a copy of a Frame with less elements.
65
tex: not necessarily. we could just set weights of certain fragments to zero and do weight-based
66
sampling.
67
68
Frame contains only FragDataCOPs so it can refer to the same elements but less of them ...
69
70
ERROR Handling: have to think about that. So far I often return a bool
71
Raising Exceptions would be better. But I think we are still free of exceptions...
72
*/
73
//WARNING: when fragments inside of a frame are deleted the FragID of that frame will be fucked up
74
//
75
76
// if deleting of fragments in a frame is really needed a lot one could
77
// introduce a second class with a slightly different implementation
78
// DeletableFrame that maps frag_id --> frag_nr
79
// but for most purposes it will probably suffice to make a new frame that contains all wanted fragments
80
//
81
82
83
84
/// @brief Frame couples a list of FragData-instances to a certain alignment frame, i.e., position in sequence space
85
/// @detail A frame may be continous, i.e., its fragment data will be applied to all residues between start() and end()
86
/// or ( in a specialized version inheriting this interface) may contain a loose list of sequence positions.
87
///
88
/// Instances of FragData (e.g., the Torsion-Angles of a specific Fragment) can be
89
/// added and deleted via add_- or delete_fragment() methods.
90
///
91
/// a fragment is inserted into the structure via the apply() method
92
/// and the steal() method is its inverse: an instance of FragData is created from the structure of the pose
93
/// at the dof's specified in the other FragData's of the Frame. The new FragData is added as last fragment to the frame.
94
///
95
/// accessors to underlying FragData-instances are available as fragment() or fragment_ptr().
96
///
97
/// Frame supports the FragCache --> see FragCache for documentation.
98
///
99
/// MoveMaps: It should be possible to specify which dofs can be moved. In this case fragment-insertions should
100
/// a) only be allowed if all dofs affected are moveable or b) only change those dofs that are moveable.
101
/// this information could be handled by an extended version of the kinematics::movemap.
102
/// The movemap would then have to functions: 1) which dofs are changed by a certain FragData/Frame
103
/// 2) which dofs are moveable
104
/// comparison of movemaps, i.e., M1 <= M2 could tell us if dofs tagged in M1 are also tagged in M2:
105
/// i.e., the M_fragdata<= M_pose would tell us that the fragment is applicable to the Pose.
106
107
108
109
class
Frame
:
public
utility::pointer::ReferenceCount
{
110
typedef
std::map<std::string, BaseCacheUnitOP >
CacheMap
;
111
public
:
112
///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
113
virtual
~Frame
();
114
115
Frame
();
116
117
Frame
(
core::Size
begin,
core::Size
end
,
core::Size
nr_res );
118
119
Frame
(
core::Size
start
,
core::Size
length
);
120
121
Frame
(
core::Size
start
);
122
123
Frame
(
core::Size
start
,
FragDataOP
frag1 );
124
125
Frame
(
core::Size
start
,
core::Size
length
,
SingleResidueFragDataOP
srfd );
126
127
/// @brief clone method, new frame with same alignment position, fragments are not copied!
128
virtual
FrameOP
clone
()
const
;
129
130
/// @brief clone method, new frame with same alignment position, fragments are not copied!
131
virtual
FrameOP
clone_with_frags
();
132
133
/// @brief clone method, new frame with same alignment position, one fragments is copied as template ( valid() == false )
134
virtual
FrameOP
clone_with_template
();
135
136
///@brief type() is specifying the output name of the Frame in FragmentIO ("FRAME", "JUMPFRAME", etc)
137
virtual
std::string
type
()
const
;
138
139
static
std::string
_static_type_name
();
140
141
142
/// @brief add a fragment .. return new frag_nr
143
core::Size
add_fragment
(
FragDataOP
new_frag );
144
145
/// @brief add all fragments in list
146
bool
add_fragment
(
FragDataList
new_frags );
147
148
/// @brief delete a fragment: Attention: all data in the FragCache is invalidated ( and deleted )
149
/// it would be complicated to change this behaviour. Thus, it is desirable to avoid using delete_fragment() altogether.
150
/// Faster: Make a new Frame and add all fragments you are interested in.
151
//void delete_fragment( core::Size frag_num );
152
153
/// @brief accesors for underlying FragData
154
FragData
const
&
fragment
(
core::Size
frag_num )
const
;
155
156
/// @brief accessor for underlying FragData
157
FragData
&
fragment
(
core::Size
frag_num );
158
159
/// @brief accessor for underlying FragData as owning ptr
160
FragDataCOP
fragment_ptr
(
core::Size
frag_num )
const
;
161
162
/// @brief accessor for underlying FragData as owning ptr
163
FragDataOP
fragment_ptr
(
core::Size
frag_num );
164
165
/// @brief a frame is considered valid if at least one fragment is contained and this fragment is also valid
166
/// (not an empty template fragment)
167
bool
is_valid
()
const
;
168
169
170
/// @brief insert fragment frag_num into pose
171
core::Size
apply
(
kinematics::MoveMap
const
&,
core::Size
frag_num,
pose::Pose
& pose )
const
;
172
173
/// @brief insert fragment frag_num into pose --- ignore movemap
174
core::Size
apply
(
core::Size
frag_num,
pose::Pose
& pose )
const
;
175
176
/// @brief change ss-string according to sec-struct info in fragments
177
core::Size
apply_ss
(
kinematics::MoveMap
const
&,
core::Size
frag_num,
std::string
& ss )
const
;
178
179
/// @brief obtain fragment from pose at frame position
180
// ATTENTION: functionality of steal is different for FRAMES than for FragData.
181
// since many frames can own the same FragData, we make a new clone of FragData for the stolen frame
182
bool
steal
(
pose::Pose
const
& pose);
183
184
/// @brief is the Frame applicable to the pose with the given movemap?
185
core::Size
is_applicable
(
kinematics::MoveMap
const
&
/*trial_move_map*/
)
const
;
186
187
188
/// @brief translate intra-frame position into sequence position. (trivial for base-class)
189
virtual
core::Size
seqpos
(
core::Size
intra_pos )
const
;
// BaseClass --> continuous frames
190
191
/// @brief a unique id for every fragment in the list.
192
/// his is silly, but would enable later on to avoid cache_clearence on deletion of FragData entries
193
/// in this case, we would require that the ID of a certain fragment never changes, even if the position in FragList changes
194
core::Size
frag_id
(
core::Size
frag_num )
const
;
195
196
/// @brief returns a (small) pose with fragment ( continous from seqpos 1 ... nr_res_affected() )
197
void
fragment_as_pose
(
198
core::Size
frag_num,
199
pose::Pose
& pose,
200
chemical::ResidueTypeSetCAP
restype_set
201
)
const
;
202
203
////////// properties of the Frame///////////////////
204
205
/// @brief true if frame is continuous (always true for base class)
206
virtual
bool
is_continuous
()
const
;
// base class can only handle continuous frames
207
208
/// @brief number of fragments attached to this frame
209
core::Size
nr_frags
()
const
;
210
211
/// @brief remove all valid fragments, a template fragment will be left over
212
void
clear
();
213
214
/// @brief whether this fragment contains a certain position
215
bool
contains_seqpos
(
core::Size
seqpos
)
const
;
216
217
/// @brief first seqpos of this frame
218
core::Size
start
()
const
;
219
220
/// @brief set start position
221
// inline
222
// void start( core::Size setting );
223
224
/// @brief shift to new start position ( change end accordingly )
225
void
shift_to
(
core::Size
setting );
// this should be made virtual ... so that it also applies to NonContinuousFrame
226
227
/// @brief last sequence position affected by this frame
228
core::Size
end
()
const
;
229
230
/// ///@brief set stop position
231
// core::Size stop( core::Size setting );
232
233
/// @brief last sequence position affected by this frame
234
core::Size
stop
()
const
;
235
236
virtual
bool
moves_residue
(
core::Size
pos )
const
;
237
238
/// @brief number of residues affected by this frame
239
core::Size
nr_res_affected
(
kinematics::MoveMap
const
& mm )
const
;
240
241
/// @brief number of residues in this frame ( for continuous frames it is the same as end()-start() + 1 )
242
core::Size
length
()
const
;
243
244
245
// can we make this private and accessible via
246
// a friend BaseCacheUnit statement --> are derived classes of a friend still a friend
247
/// @brief return handle to cached data stored under "tag"
248
/// shouldn't be called directly
249
BaseCacheUnit
&
cache
(
std::string
tag,
BaseCacheUnitOP
const
& new_cache )
const
;
250
251
/// @brief copies all entries in the Frame-Cache for fragment "sid" of Frame "source" to fragment "nid" of "this" frame
252
void
clone_cache_data
(
Frame
const
& source,
core::Size
sid,
core::Size
nid );
253
254
virtual
255
void
show_classic
( std::ostream& out )
const
;
256
257
//@brief prints frame to stream -- multiline object
258
virtual
259
void
show
( std::ostream& out )
const
;
260
261
virtual
262
void
show_header
( std::ostream& out )
const
;
263
264
virtual
265
void
read
( std::istream& in );
266
267
bool
is_mergeable
(
Frame
const
& other )
const
;
268
269
bool
merge
(
Frame
const
& other );
270
271
///@brief change frames residue numbers accoriding to map
272
virtual
273
bool
align
(
core::id::SequenceMapping
const
& map );
274
275
///@brief generate_sub_frame of length from start ( internal numbers )
276
FrameOP
generate_sub_frame
(
Size
length
,
Size
start
= 1 );
277
278
///@brief NOT IMPLEMENTED YET: generate_sub_frame according to mapping ( residue numbers ) returns NULL if mapping invalid
279
// Commenting out to make Python bindings compile
280
//FrameOP generate_sub_frame( core::id::SequenceMapping const& map );
281
282
protected
:
283
284
//@brief called by show() to iterate over fragments
285
virtual
286
void
show_fragments
( std::ostream& out )
const
;
287
288
/// @brief is a FragData object compatible with the already stored ones ?
289
/// @detail you can only add instances of FragData to the same Frame that are compatible, i.e., that contain the same
290
/// class of FragData, e.g., based on BBTorsionSRFD,
291
/// if you want to have different fragment for other dof's at the same sequence position create a new Frame.
292
/// Users of the fragment-core are aware that multiple Frames for the same sequence position may exist.
293
virtual
bool
is_compatible
(
FragDataCOP
new_frag )
const
;
294
295
void
init_length
(
core::Size
start
,
core::Size
end
,
core::Size
length
);
296
297
298
299
300
301
private
:
302
// first seqpos of frame
303
core::Size
start_
;
304
305
// last seqpos of frame
306
mutable
core::Size
end_
;
307
308
// nr of residues affected ( start_ - end_ + 1, for continuous frames )
309
mutable
core::Size
nr_res_
;
310
311
// not used right now..
312
//kinematics::MoveMap move_map_;
313
314
// cache data for FragCache and FragStore functionality
315
mutable
CacheMap
cache_
;
316
317
// a list of fragments for this frame
318
FragDataList
frag_list_
;
319
320
//static pose::PoseOP my_static_pose_for_testing_; //replace that with something more sensible ...
321
};
322
323
inline
std::ostream&
operator<<
( std::ostream& out,
Frame
const
& frame ) {
324
frame.
show
( out );
325
return
out;
326
}
327
328
329
330
331
332
333
}
//fragment
334
}
//core
335
336
#endif
Generated on Sat Jun 1 2013 11:32:35 for Rosetta 3.5 by
1.8.4