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
kinematics
Edge.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
//
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 core/kinematics/Edge.hh
11
/// @brief Fold tree edge class
12
/// @author Phil Bradley
13
14
15
#ifndef INCLUDED_core_kinematics_Edge_hh
16
#define INCLUDED_core_kinematics_Edge_hh
17
18
19
// Unit headers
20
#include <
core/kinematics/Edge.fwd.hh
>
21
22
// AUTO-REMOVED #include <basic/OStream.fwd.hh>
23
24
25
// // C++ Headers
26
#include <cassert>
27
#include <string>
28
29
//#include <iosfwd>
30
31
32
namespace
core {
33
namespace
kinematics {
34
35
36
///////////////////////////////////////////////////////////////////////////////
37
/// \brief single edge of the fold_tree
38
///
39
/// an edge is a path between two vertices(start and end residues). it can be
40
/// either a continuous segement like a normal piece of polymer ("PEPTIDE" edge,
41
/// index label as "-1"), a chemical connection between two residues ("CHEMICAL
42
/// edge), or a rigid-body transformation between two residues ("JUMP" edge,
43
/// index label as "1", "2",...). The edge is the basic unit of te fold tree
44
/// as it stores info on how to build coordinates of the end residue given that
45
/// of the starting residue and degrees of freedom between these two
46
/// vertices.
47
class
Edge
48
{
49
public
:
50
51
/// APL -- CODE DUPLICATION -- FIX THIS IN A BETTER WAY TO RESOLVE THE CIRCULAR DEPENDENCY
52
static
int
const
PEPTIDE
= -1;
// must be negative, see Edge::is_jump()
53
static
int
const
CHEMICAL
= -2;
// for fold-tree edges that connect two chemically-bound residues
54
55
public
:
56
57
/////////////////////////////////////////////////////////////////////////////
58
// member access
59
60
/// @brief start vertex, return by value
61
inline
62
int
63
start
()
const
64
{
65
return
start_
;
66
}
67
68
/// @brief start vertex, return by reference
69
inline
70
int
&
71
start
()
72
{
73
return
start_
;
74
}
75
76
77
/// @brief stop vertex, return by value
78
inline
79
int
80
stop
()
const
81
{
82
return
stop_
;
83
}
84
85
/// @brief stop vertex, return by reference
86
inline
87
int
&
88
stop
()
89
{
90
return
stop_
;
91
}
92
93
94
/// @brief start_atom, return by value
95
inline
96
std::string
97
start_atom
()
const
98
{
99
return
start_atom_
;
100
}
101
102
/// @brief start atom, return by reference
103
inline
104
std::string
&
105
start_atom
()
106
{
107
return
start_atom_
;
108
}
109
110
111
/// @brief stop_atom, return by value
112
inline
113
std::string
114
stop_atom
()
const
115
{
116
return
stop_atom_
;
117
}
118
119
/// @brief stop_atom, return by reference
120
inline
121
std::string
&
122
stop_atom
()
123
{
124
return
stop_atom_
;
125
}
126
127
/// @brief start-atom, alt name, return by value
128
inline
129
std::string
130
upstream_atom
()
const
131
{
132
return
start_atom_
;
133
}
134
135
/// @brief start-atom, alt name, return by reference
136
inline
137
std::string
&
138
upstream_atom
()
139
{
140
return
start_atom_
;
141
}
142
143
/// @brief stop-atom, alt name, return by value
144
inline
145
std::string
146
downstream_atom
()
const
147
{
148
return
stop_atom_
;
149
}
150
151
/// @brief stop-atom, alt name, return by reference
152
inline
153
std::string
&
154
downstream_atom
()
155
{
156
return
stop_atom_
;
157
}
158
159
/// @brief label (edge type), return by value
160
inline
161
int
162
label
()
const
163
{
164
return
label_
;
165
}
166
167
/// @brief label (edge type), return by reference
168
inline
169
int
&
170
label
()
171
{
172
return
label_
;
173
}
174
175
176
// properties
177
178
/// @brief edge is a jump?
179
inline
180
bool
181
is_jump
()
const
182
{
183
return
(
label_
> 0 );
184
}
185
186
///
187
inline
188
bool
189
is_chemical_bond
()
const
190
{
191
return
(
label_
==
CHEMICAL
);
192
}
193
194
/// @brief Edge is peptide edge?
195
inline
196
bool
197
is_polymer
()
const
198
{
199
return
(
label_
==
PEPTIDE
);
200
}
201
202
/// @brief Edge is peptide edge?
203
/// deprecated
204
inline
205
bool
206
is_peptide
()
const
207
{
208
return
(
label_
==
PEPTIDE
);
209
}
210
211
/// @brief edge has start and stop atoms?
212
inline
213
bool
214
has_atom_info
()
const
215
{
216
return
(
start_atom_
.size() &&
stop_atom_
.size() );
217
}
218
219
inline
220
bool
221
keep_stub_in_residue
()
const
222
{
223
return
bKeepStubInResidue_
;
224
}
225
226
inline
227
bool
&
228
keep_stub_in_residue
()
229
{
230
return
bKeepStubInResidue_
;
231
}
232
233
// only one use in all the code
234
// returns 1 if start<stop, -1 if stop<start, dies if jump or a chemical edge
235
//
236
/// @brief direction for a continuous-segement edge. 1 if start residue number < stop residue number and -1 otherwise
237
inline
238
int
239
polymer_direction
()
const
240
{
241
assert(
label_
==
PEPTIDE
);
242
return
(
start_
<
stop_
? 1 : -1 );
243
}
244
245
246
/// @brief Is this edge valid (false for default-constructed edges)
247
inline
248
bool
249
valid
()
const
250
{
251
return
(
start_
> 0 &&
stop_
> 0 &&
label_
!= 0 );
252
}
253
254
/////////////////////////////////////////////////////////////////////////////
255
// construction
256
257
/// @brief default constructor
258
Edge
():
259
start_
(0),
260
stop_
(0),
261
label_
(0),
262
start_atom_
(
""
),
263
stop_atom_
(
""
),
264
bKeepStubInResidue_
( false )
265
{}
266
267
/// @brief constructor without atomno info
268
Edge
(
int
const
start_in,
int
const
stop_in,
int
const
label_in):
269
start_
( start_in ),
270
stop_
( stop_in ),
271
label_
( label_in ),
272
start_atom_
(
""
),
273
stop_atom_
(
""
),
274
bKeepStubInResidue_
( false )
275
{}
276
277
278
/// @brief CHEMICAL Edge constructor (requires atomno info) -- note: a chemical
279
/// edge may be built from any constructor, this one is for convenience only
280
Edge
(
int
const
start_in,
int
const
stop_in,
std::string
const
&
start_atom
,
std::string
const
&
stop_atom
):
281
start_
( start_in ),
282
stop_
( stop_in ),
283
label_
(
CHEMICAL
),
284
start_atom_
( start_atom ),
285
stop_atom_
( stop_atom ),
286
bKeepStubInResidue_
( false )
287
{}
288
289
/// @brief JUMP Edge constructor (requires atomno info) -- note: a chemical
290
/// edge may be built from any constructor, this one is for convenience only
291
Edge
(
int
const
start_in,
int
const
stop_in,
int
label
,
292
std::string
const
&
start_atom
,
std::string
const
&
stop_atom
,
293
bool
bKeepStubInResidue ):
294
start_
( start_in ),
295
stop_
( stop_in ),
296
label_
( label ),
297
start_atom_
( start_atom ),
298
stop_atom_
( stop_atom ),
299
bKeepStubInResidue_
( bKeepStubInResidue )
300
{}
301
302
// stream I/O ////////////////////////
303
// these two should be inverses!
304
305
/// @brief input operator
306
friend
std::istream &
operator >>
(std::istream & is,
Edge
& e);
307
308
/// @brief output operator
309
friend
std::ostream &
operator <<
(std::ostream & os,
const
Edge
& e);
310
311
/// @brief less than operator
312
friend
bool
operator <
(
Edge
const
& a,
Edge
const
&
b
);
313
314
/// @brief equal to operator
315
friend
bool
operator ==
(
Edge
const
& a,
Edge
const
&
b
);
316
317
/// @brief not equal to operator
318
friend
bool
operator !=
(
Edge
const
& a,
Edge
const
&
b
);
319
320
private
:
321
322
#ifdef USEBOOSTSERIALIZE
323
friend
class
boost::serialization::access;
324
325
template
<
class
Archive>
326
void
serialize(Archive & ar,
const
unsigned
int
version) {
327
ar &
start_
;
328
ar &
stop_
;
329
ar &
label_
;
330
ar &
start_atom_
;
331
ar &
stop_atom_
;
332
// yeaaaaa hungarian notation
333
ar &
bKeepStubInResidue_
;
334
}
335
#endif
336
///////
337
// data
338
339
/// start vertex (residue)
340
int
start_
;
341
/// stop vertex (residue)
342
int
stop_
;
343
/// type of the edge, continuous segement(-1) or rigid-body jump(1,2,...)
344
int
label_
;
345
/// start atom
346
std::string
start_atom_
;
347
/// stop atom
348
std::string
stop_atom_
;
349
350
/// STUB Info for jumps
351
bool
bKeepStubInResidue_
;
352
353
};
// Edge
354
355
356
}
// namespace kinematics
357
}
// namespace core
358
359
360
#endif // INCLUDED_core_kinematics_Edge_HH
Generated on Sat Jun 1 2013 11:33:05 for Rosetta 3.5 by
1.8.4