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
scoring
ResidualDipolarCoupling.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/scoring/ResidualDipolarCoupling.hh
11
/// @brief Uses NMR RDC for scoring
12
/// @author Srivatsan Raman, Oliver Lange
13
14
#ifndef INCLUDED_core_scoring_ResidualDipolarCoupling_hh
15
#define INCLUDED_core_scoring_ResidualDipolarCoupling_hh
16
17
#include <
core/scoring/ResidualDipolarCoupling.fwd.hh
>
18
// AUTO-REMOVED #include <core/scoring/methods/ResidualDipolarCouplingEnergy.fwd.hh>
19
#include <
core/types.hh
>
20
#include <numeric/xyzVector.hh>
21
22
#include <basic/datacache/CacheableData.hh>
23
#include <numeric/numeric.functions.hh>
24
// AUTO-REMOVED #include <utility/vector1.hh>
25
#include <
core/pose/Pose.fwd.hh
>
26
27
#include <utility/vector1.hh>
28
29
namespace
core {
30
namespace
scoring {
31
32
void
store_RDC_in_pose
(
ResidualDipolarCouplingOP
,
core::pose::Pose
&);
33
ResidualDipolarCouplingOP
retrieve_RDC_from_pose
(
core::pose::Pose
&);
34
ResidualDipolarCouplingCOP
retrieve_RDC_from_pose
(
core::pose::Pose
const
&);
35
36
///@brief ResidualDipolarCouplings are mainly handled by this class
37
///@detail related classed: RDC --- a single line in an RDC file - representing a single dipolar coupling
38
/// ResidualDipolarCouplingEnergy -- an energy method which triggers computations handled by this class.
39
///
40
///
41
class
ResidualDipolarCoupling
:
public
basic::datacache::CacheableData {
42
// friend class ResidualDipolarCouplingEnergy;
43
public
:
44
// typedefs
45
typedef
core::Real
Real
;
46
typedef
core::Size
Size
;
47
typedef
utility::vector1<core::scoring::RDC>
RDC_lines
;
48
typedef
core::Real
Tensor
[3][3];
49
typedef
core::Real
rvec
[3];
50
51
public
:
52
/// @brief standard c'stor -- will access option -in:file:rdc to read RDC data
53
// ResidualDipolarCoupling() :
54
// nex_(0), nrows_(0) {
55
// reserve_buffers();
56
// read_RDC_file();
57
// }
58
59
ResidualDipolarCoupling
(
std::string
const
&
filename
=
""
) :
60
nex_
(0),
nrows_
(0) {
61
reserve_buffers
();
62
if
(
filename
!=
""
) {
63
read_RDC_file
( 1,
filename
);
64
release_buffers
();
65
preprocess_data
();
66
reserve_buffers
();
67
}
else
{
68
read_RDC_file
();
69
}
70
}
71
72
/// @brief alternative c'stor if you have a list of RDC lines
73
ResidualDipolarCoupling
(
RDC_lines
data_in) :
74
All_RDC_lines_
(data_in) {
75
preprocess_data
();
76
reserve_buffers
();
77
}
78
79
//explicit copy c'stor to initialize buffers
80
ResidualDipolarCoupling
(
ResidualDipolarCoupling
const
& other);
81
//explicit assignment operator to initialize buffers
82
ResidualDipolarCoupling
&
operator=
(
ResidualDipolarCoupling
const
& other);
83
84
//explicit destructor because we use raw pointers for buffers
85
virtual
~ResidualDipolarCoupling
();
86
87
//this class lives in the PoseCache.... need to provide clone()
88
basic::datacache::CacheableDataOP
clone
()
const
{
89
return
new
ResidualDipolarCoupling
(*
this
);
90
}
91
92
///@brief compute dipolar score for given pose
93
/// will set alignment tensor and force-fields in RDC
94
core::Real
compute_dipscore
(
core::pose::Pose
const
& pose);
95
96
/// fit rdc using RDC data
97
core::Real
compute_dipscore_nls
(
core::pose::Pose
const
& pose);
98
core::Real
compute_dipscore_nlsDa
(
core::pose::Pose
const
& pose,
utility::vector1<Real>
const
tensorDa);
99
core::Real
compute_dipscore_nlsR
(
core::pose::Pose
const
& pose,
utility::vector1<Real>
const
tensorR);
100
core::Real
compute_dipscore_nlsDaR
(
core::pose::Pose
const
& pose,
utility::vector1<Real>
const
tensorDa,
utility::vector1<Real>
const
tensorR);
101
102
//wRDC (like wRMSD .. iter i + 1 tensor weights are ~exp( - dev^2/sigma ))
103
Real
iterate_tensor_weights
(
core::pose::Pose
const
& pose,
104
core::Real
sigma2,
core::Real
tolerance,
bool
reset);
105
106
void
show
(std::ostream&)
const
;
107
108
///@brief read RDC data from file
109
void
read_RDC_file
();
110
111
///@brief fill internal buffers... call always when RDC lines change.
112
void
preprocess_data
();
113
114
///@brief free memory of buffers
115
void
release_buffers
();
116
117
///@brief get memory for buffers
118
void
reserve_buffers
();
119
120
///@brief get the raw RDC data
121
inline
RDC_lines
const
&
get_RDC_data
()
const
{
122
return
All_RDC_lines_
;
123
}
124
125
///@brief return the Q value ( cornilescu ) --- only valid after compute_dipscore
126
Real
Q
()
const
{
127
return
R
() * sqrt(2.0f);
128
}
129
130
///@brief return the R value ( M Clore ) --- only valid after compute_dipscore
131
Real
R
()
const
{
132
return
R_
;
133
}
134
135
//@brief return the number of experiments
136
core::Size
get_n_alignments
()
const
{
return
nex_
;}
137
138
///@brief return tensor of certain experiment... exp_id starts at 1
139
Tensor
*
tensor
( ) {
140
return
S_
;
141
}
142
143
144
/* core::Real get_fractional_anisotropy(core::Size ex) const {
145
// std::cout << "FFA " << FA_ <<std::endl;
146
return FA_[ex] != NULL ? FA_[ex] : -1;
147
}*/
148
149
core::Real
get_al_tensor_trace
(
core::Size
ex)
const
{
150
// std::cout << "FFA " << FA_ <<std::endl;
151
return
trace_
[ex];
152
}
153
154
155
core::Real
get_al_tensor_max_z
(
core::Size
ex)
const
{
156
// std::cout << "FFA " << FA_ <<std::endl;
157
return
maxz_
[ex];
158
}
159
160
void
compute_tensor_stats
();
161
void
show_tensor_stats
( std::ostream&,
core::Size
ex )
const
;
162
void
show_tensor_matrix
( std::ostream&,
core::Size
ex )
const
;
163
void
show_rdc_values
( std::ostream&,
core::Size
ex )
const
;
164
165
void
show_tensor_stats_nls
( std::ostream&,
core::Size
ex,
const
double
*par)
const
;
166
//void show_tensor_stats_nlsDa( std::ostream&, core::Size ex, const double tensorDa, const double *par) const;
167
//void show_tensor_stats_nlsR( std::ostream&, core::Size ex, const double tensorR, const double *par) const;
168
//void show_tensor_stats_nlsDaR( std::ostream&, core::Size ex, const double tensorDa, const double tensorR, const double *par) const;
169
private
:
170
///@brief read RDC data from file
171
void
read_RDC_file
(
Size
nex,
std::string
const
&
filename
);
172
173
///@brief non-const reference to RDC data private use only.
174
RDC_lines
&
get_RDC_data_ref
();
175
176
private
:
177
/// some internal buffers in
178
typedef
core::Real
rvec5
[5];
179
typedef
core::Real
Tensor5
[5][5];
180
RDC_lines
All_RDC_lines_
;
181
rvec
*
EV_
;
// rvec3
182
rvec5
*
D_
;
//rvec5 x nrows
183
rvec5
*
rhs_
;
//rvec5 x nrows
184
Tensor
*
S_
;
// 3 x 3 x nex
185
Tensor5
*
T_
;
// 5 x 5 x nex
186
core::Size
nex_
;
//number of alignment media, i.e., how many tensors
187
core::Size
nrows_
;
188
core::Real
R_
;
//clore R factor only valid after compute_dipscore...
189
core::Real
rmsd_
;
190
191
//stuff only computed for information purposes -- call compute_tensor_stats()
192
Tensor
*
SD_
;
//3 x 3 x nex
193
Tensor
*
EIG_
;
194
core::Real
*
FA_
;
//Fractional Anisotropy of the diffusion tensor - NGS
195
core::Real
*
trace_
;
196
core::Real
*
maxz_
;
197
198
//stuff for nls
199
core::Real
*
r0_
;
200
core::Real
*
r1_
;
201
core::Real
*
r2_
;
202
core::Real
*
exprdc_
;
203
core::Real
*
rdcconst_
;
204
core::Real
*
rdcweight_
;
205
core::Size
*
lenex_
;
206
};
207
208
/////////////////////////////////////////////////
209
//@brief short class that stores the RDC data lines
210
/////////////////////////////////////////////////
211
class
RDC
{
212
213
public
:
214
enum
RDC_TYPE
{
215
RDC_TYPE_NH
= 1,
RDC_TYPE_NC
,
RDC_TYPE_CH
,
RDC_TYPE_CC
216
};
217
218
RDC
() {
219
}
220
221
RDC
(
Size
res1
,
std::string
const
&
atom1
,
Size
res2
,
222
std::string
const
&
atom2
,
Real
Jdipolar
,
Real
weight
= 1.0,
//for alignment calculation
223
Size
expid
= 1
224
// core::Real Reduced_Jdipolar
225
) :
226
type_
(
get_RDC_data_type
(atom1, atom2)),
res1_
(res1),
res2_
(res2),
227
Jdipolar_
(Jdipolar),
weight_
(
weight
),
Jdipolar_computed_
(-999),
228
expid_
(
expid
),
atom1_
(atom1),
atom2_
(atom2)
229
// Reduced_Jdipolar_( Reduced_Jdipolar )
230
{
231
}
232
233
RDC_TYPE
type
()
const
{
234
return
type_
;
235
}
236
237
///@brief which type of RDC pairing are we dealing with ?
238
RDC_TYPE
get_RDC_data_type
(
std::string
const
&
atom1
,
239
std::string
const
&
atom2
);
240
241
inline
Size
expid
()
const
{
242
return
expid_
;
243
}
244
245
inline
Size
res1
()
const
{
246
return
res1_
;
247
}
248
249
inline
Size
res2
()
const
{
250
return
res2_
;
251
}
252
253
inline
Real
Jdipolar
()
const
{
254
return
Jdipolar_
;
255
}
256
257
Real
const
&
Jcomputed
()
const
{
258
return
Jdipolar_computed_
;
259
}
260
261
Real
&
Jcomputed
() {
262
return
Jdipolar_computed_
;;
263
}
264
265
Vector
fij
()
const
{
266
return
fij_
;
267
}
268
269
inline
Real
fixed_dist
()
const
{
270
//changed to reproduce constants from the DC server
271
//http://spin.niddk.nih.gov/bax/software/dc/#dc_di
272
runtime_assert( 0 );
///don't use this
273
if
(
type
() ==
RDC_TYPE_NH
)
274
return
1.041;
275
//return 1.042;
276
else
if
(
type
() ==
RDC_TYPE_NC
)
277
return
1.329;
278
//return 1.329;
279
else
if
(
type
() ==
RDC_TYPE_CH
)
280
return
1.107;
281
//return 1.08;
282
else
if
(
type
() ==
RDC_TYPE_CC
)
283
return
1.525;
284
//return 1.525;
285
//should never get here...
286
runtime_assert( 0 );
287
return
0;
288
}
289
290
inline
Real
Reduced_Jdipolar
()
const
{
291
using namespace
numeric;
292
return
Jdipolar_
*
Dconst
() * numeric::cube(
fixed_dist
());
293
294
}
295
296
Real
weight
()
const
{
297
return
weight_
;
298
}
299
300
void
weight
(
Real
w_in) {
301
weight_
= w_in;
302
}
303
304
inline
Real
Dconst
()
const
{
305
core::Real
Dcnst(0.0);
306
if
(
type
() ==
RDC_TYPE_NH
)
307
//Concepts in Magnetic Resonance Part A, 21, 10-21
308
Dcnst = 36.5089;
309
if
(
type
() ==
RDC_TYPE_NC
)
310
Dcnst = 9.179532;
311
if
(
type
() ==
RDC_TYPE_CH
)
312
Dcnst = 90.55324;
313
//Dcnst = -90.55324;
314
if
(
type
() ==
RDC_TYPE_CC
)
315
Dcnst = 22.76805;
316
//Dcnst = -22.76805;
317
// std::cout << Dcnst <<std::endl;
318
runtime_assert( Dcnst != 0 );
// at this position the type() should already
319
return
Dcnst;
320
}
321
friend
class
ResidualDipolarCoupling
;
322
323
std::string
const
&
atom1
()
const
{
324
return
atom1_
;
325
}
326
327
std::string
const
&
atom2
()
const
{
328
return
atom2_
;
329
}
330
331
void
show
(std::ostream&)
const
;
332
333
334
private
:
335
RDC_TYPE
type_
;
336
Size
res1_
,
res2_
;
337
Real
Jdipolar_
,
Reduced_Jdipolar_
;
338
Real
weight_
;
339
340
public
:
341
Real
Jdipolar_computed_
;
342
core::Vector
fij_
;
343
344
private
:
345
Size
expid_
;
346
std::string
atom1_
;
347
std::string
atom2_
;
348
};
349
350
extern
std::ostream&
operator<<
(std::ostream&,
ResidualDipolarCoupling
const
&);
351
extern
std::ostream&
operator<<
(std::ostream&,
RDC
const
&);
352
353
}
//scoring
354
}
//core
355
356
#endif
Generated on Sat Jun 1 2013 11:39:46 for Rosetta 3.5 by
1.8.4