Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RNA_DataBackboneEnergy.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 core/scoring/rna/RNA_DataBackboneEnergy.cc
11 /// @brief Statistically derived rotamer pair potential class implementation
12 /// @author Rhiju Das
13 
14 
15 // Unit headers
18 
19 // Package headers
25 // AUTO-REMOVED #include <core/scoring/rna/RNA_Util.hh>
26 #include <core/scoring/Energies.hh>
28 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
29 // AUTO-REMOVED #include <core/scoring/ScoringManager.hh>
30 #include <core/id/AtomID.hh>
31 
32 // Project headers
33 #include <core/pose/Pose.hh>
40 
41 // Utility headers
42 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
43 #include <ObjexxFCL/FArray1D.hh>
44 #include <utility/exit.hh>
45 
46 
47 // C++
48 #include <numeric/xyzVector.hh>
49 
50 #include <utility/vector1.hh>
51 
52 
53 namespace core {
54 namespace scoring {
55 namespace rna {
56 
58 
59 /// @details This must return a fresh instance of the RNA_DataBackboneEnergy class,
60 /// never an instance already in use
64 ) const {
65  return new RNA_DataBackboneEnergy;
66 }
67 
70  ScoreTypes sts;
71  sts.push_back( rna_data_backbone );
72  return sts;
73 }
74 
75 
76 /// c-tor
79  dist_cutoff_( 9.0 ),
80  dist_fade_( 1.0 ),
81  well_depth_burial_( -0.05 ),
82  well_depth_exposed_( 0.01 ),
83  burial_function_( new constraints::FadeFunc( -10.0 /*cutoff_lower*/, dist_cutoff_, dist_fade_, 1.0 /*well_depth*/ ) )
84 {
86 }
87 
88 
89 //clone
92 {
93  return new RNA_DataBackboneEnergy;
94 }
95 
96 ///////////////////////////////////////////////////////////
97 void
99 
100  using namespace core::chemical;
101  ResidueTypeSetCAP rsd_set;
103  ResidueTypeCOP const & rsd_type( rsd_set->aa_map( na_rad )[ 1 ] ); //Check out adenine.
104 
105  atom_numbers_sugar_.clear();
106  atom_numbers_sugar_.push_back( rsd_type->atom_index( " C1*" ) );
107  atom_numbers_sugar_.push_back( rsd_type->atom_index( " C2*" ) );
108  atom_numbers_sugar_.push_back( rsd_type->atom_index( " C3*" ) );
109  atom_numbers_sugar_.push_back( rsd_type->atom_index( " C4*" ) );
110  atom_numbers_sugar_.push_back( rsd_type->atom_index( " C5*" ) );
111 
113  ResidueTypeCOP const & rsd_type_coarse( rsd_set->aa_map( na_rad )[ 1 ] ); //Check out adenine.
114 
116  atom_numbers_sugar_coarse_.push_back( rsd_type_coarse->atom_index( " S " ) );
117 
118 }
119 
120 /////////////////////////////////////////////////////////////////////////////
121 // scoring
122 /////////////////////////////////////////////////////////////////////////////
123 
124 
125 ///
126 void
128 {
129  // need to make sure scoring info is in there...
131  // Commented out - unused variable warning
132  //rna::RNA_ScoringInfo & rna_scoring_info( rna::nonconst_rna_scoring_info_from_pose( pose ) );
133 
135 }
136 
137 ///
138 void
140 {
142 }
143 
144  /////////////////////////////////////////////////////////////////
145 void
147  pose::Pose & pose,
148  utility::vector1< bool > const &,
150 ) const
151 {
153 }
154 
155 
156 
157 //////////////////////////////////////////////////////////////////////////////////////////
158 //
159 //
160 //
161 void
163  conformation::Residue const & rsd1,
164  conformation::Residue const & rsd2,
165  pose::Pose const & pose,
166  ScoreFunction const &,
167  EnergyMap & emap
168 ) const
169 {
170 
171  if ( !rsd1.is_RNA() ) return;
172  if ( !rsd2.is_RNA() ) return;
173 
174  // if ( std::abs( static_cast<int>( rsd1.seqpos() ) - static_cast<int>( rsd2.seqpos() ) ) < 2 ) return;
175 
176  // rna_filtered_base_base_info.set_calculated( false );
177  rna::RNA_ScoringInfo const & rna_scoring_info( rna::rna_scoring_info_from_pose( pose ) );
178  rna::RNA_DataInfo const & rna_data_info( rna_scoring_info.rna_data_info() );
179  ObjexxFCL::FArray1D <bool> const & rna_data_backbone_burial( rna_data_info.backbone_burial() );
180  ObjexxFCL::FArray1D <bool> const & rna_data_backbone_exposed( rna_data_info.backbone_exposed() );
181 
182  if (rna_data_backbone_burial.size() == 0.0 ) return;
183 
184  assert( rna_data_backbone_burial.size() == pose.total_residue() );
185 
186  if ( rna_data_backbone_burial( rsd1.seqpos() ) ) {
187  emap[ rna_data_backbone ] += well_depth_burial_ * get_sugar_env_score( rsd1 /*buried sugar*/, rsd2 /*other*/);
188  } else if ( rna_data_backbone_exposed( rsd1.seqpos() ) ) {
189  emap[ rna_data_backbone ] += well_depth_exposed_ * get_sugar_env_score( rsd1 /*buried sugar*/, rsd2 /*other*/);
190  }
191 
192 
193  if ( rna_data_backbone_burial( rsd2.seqpos() ) ) {
194  emap[ rna_data_backbone ] += well_depth_burial_ * get_sugar_env_score( rsd2 /*buried sugar*/, rsd1 /*other*/);
195  } else if ( rna_data_backbone_exposed( rsd2.seqpos() ) ) {
196  emap[ rna_data_backbone ] += well_depth_exposed_ * get_sugar_env_score( rsd2 /*buried sugar*/, rsd1 /*other*/);
197  }
198 
199 }
200 
201 /////////////////////////////////////////////////////////////////////////////////////////////
202 Real
204 {
205 
206  Real score( 0.0 );
207 
208  // Vector const mean_sugar_pos = get_mean_sugar_pos( rsd_buried );
209  bool is_coarse = ( rsd_buried.is_coarse() );
210 
211  utility::vector1< Size > const & atom_numbers_sugar = ( is_coarse ? atom_numbers_sugar_coarse_ : atom_numbers_sugar_ );
212 
213  Size const num_sugar_atoms( atom_numbers_sugar.size() );
214 
215  for ( Size j = 1; j <= num_sugar_atoms; j++ ) {
216 
217  numeric::xyzVector< Real > const & sugar_atom( rsd_buried.xyz( atom_numbers_sugar[j] ) );
218 
219  for ( Size m = 1; m <= rsd_other.nheavyatoms(); m++ ) {
220 
221  numeric::xyzVector< Real > const & other_atom( rsd_other.xyz( m ) );
222  Real const dist = ( other_atom - sugar_atom ).length();
223 
224  Real const burial_score = burial_function_->func( dist );
225  score += burial_score;
226 
227  }
228 
229  }
230 
231  return score;
232 
233 }
234 
235 
236 // Need to define atom derivative!!
237 ///////////////////////////////////////////////////////////////////////////////////////////////
238 ////////////////////////////////////////////////////////////////////////
239 bool
241 
242  for (Size i=1; i <= atom_numbers_sugar_.size(); i++ ) {
243  if ( atom_numbers_sugar_[i] == n ) return true;
244  }
245  return false;
246 }
247 
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 void
252  id::AtomID const & atom_id,
253  pose::Pose const & pose,
254  kinematics::DomainMap const & domain_map,
255  ScoreFunction const &,
256  EnergyMap const & weights,
257  Vector & F1,
258  Vector & F2
259  ) const
260 {
261 
262  Size const i( atom_id.rsd() );
263  Size const m( atom_id.atomno() );
264  conformation::Residue const & rsd1( pose.residue( i ) );
265 
266  if ( ! rsd1.is_RNA() ) return;
267 
268  if ( m > rsd1.nheavyatoms() ) return;
269 
270  rna::RNA_ScoringInfo const & rna_scoring_info( rna::rna_scoring_info_from_pose( pose ) );
271  rna::RNA_DataInfo const & rna_data_info( rna_scoring_info.rna_data_info() );
272  ObjexxFCL::FArray1D <bool> const & rna_data_backbone_burial( rna_data_info.backbone_burial() );
273  ObjexxFCL::FArray1D <bool> const & rna_data_backbone_exposed( rna_data_info.backbone_exposed() );
274 
275  if (rna_data_backbone_burial.size() == 0.0 ) return;
276 
277  assert( rna_data_backbone_burial.size() == pose.total_residue() );
278 
279  Vector const heavy_atom_i( rsd1.xyz( m ) );
280 
281  bool const pos1_fixed( domain_map( i ) != 0 );
282 
283  // cached energies object
284  Energies const & energies( pose.energies() );
285 
286  // the neighbor/energy links
287  EnergyGraph const & energy_graph( energies.energy_graph() );
288 
290  iter = energy_graph.get_node( i )->const_edge_list_begin(),
291  itere = energy_graph.get_node( i )->const_edge_list_end();
292  iter != itere; ++iter ) {
293 
294  Size const j( (*iter)->get_other_ind( i ) );
295 
296  if ( pos1_fixed && domain_map(i) == domain_map(j) ) continue; //Fixed w.r.t. one another.
297 
298  conformation::Residue const & rsd2( pose.residue( j ) );
299 
300  if ( ! rsd2.is_RNA() ) continue;
301 
302  // This could be faster if split into separate loops.
303  if ( rna_data_backbone_burial( i ) && check_sugar_atom( m )) { // other heavy atoms are possible buriers
304 
305  for ( Size n = 1; n <= rsd2.nheavyatoms(); ++n ) {
306  Vector const heavy_atom_j( rsd2.xyz( n ) );
307  Vector r = heavy_atom_j - heavy_atom_i;
308  Real const dist = r.length();
309  Real const deriv = burial_function_->dfunc( dist );
310 
311  Vector const force_vector_i = deriv * r / dist;
312  Vector const f1 = cross( force_vector_i, heavy_atom_j );
313  Vector const f2 = force_vector_i;
314  F1 += -1.0 * well_depth_burial_ * weights[ rna_data_backbone ] * f1;
315  F2 += -1.0 * well_depth_burial_ * weights[ rna_data_backbone ] * f2;
316  }
317 
318  }
319 
320 
321  if ( rna_data_backbone_exposed( i ) && check_sugar_atom( m )) { // other heavy atoms are possible buriers
322 
323  for ( Size n = 1; n <= rsd2.nheavyatoms(); ++n ) {
324  Vector const heavy_atom_j( rsd2.xyz( n ) );
325  Vector r = heavy_atom_j - heavy_atom_i;
326  Real const dist = r.length();
327  Real const deriv = burial_function_->dfunc( dist );
328 
329  Vector const force_vector_i = deriv * r / dist;
330  Vector const f1 = cross( force_vector_i, heavy_atom_j );
331  Vector const f2 = force_vector_i;
332  F1 += -1.0 * well_depth_exposed_ * weights[ rna_data_backbone ] * f1;
333  F2 += -1.0 * well_depth_exposed_ * weights[ rna_data_backbone ] * f2;
334  }
335 
336  }
337 
338 
339 
340  if ( rna_data_backbone_burial( j ) ) { // other residue's sugar atoms might be buried.
341 
342  for ( Size n = 1; n <= rsd2.nheavyatoms(); ++n ) {
343 
344  if (! check_sugar_atom( n ) ) continue;
345 
346  Vector const heavy_atom_j( rsd2.xyz( n ) );
347  Vector r = heavy_atom_j - heavy_atom_i;
348  Real const dist = r.length();
349  Real const deriv = burial_function_->dfunc( dist );
350 
351  Vector const force_vector_j = deriv * (-r) / dist;
352  Vector const f1 = -1.0 * cross( force_vector_j, heavy_atom_i );
353  Vector const f2 = -1.0 * force_vector_j;
354  F1 += -1.0 * well_depth_burial_ * weights[ rna_data_backbone ] * f1;
355  F2 += -1.0 * well_depth_burial_ * weights[ rna_data_backbone ] * f2;
356  }
357 
358  }
359 
360 
361  if ( rna_data_backbone_exposed( j ) ) { // other residue's sugar atoms might be buried.
362 
363  for ( Size n = 1; n <= rsd2.nheavyatoms(); ++n ) {
364 
365  if (! check_sugar_atom( n ) ) continue;
366 
367  Vector const heavy_atom_j( rsd2.xyz( n ) );
368  Vector r = heavy_atom_j - heavy_atom_i;
369  Real const dist = r.length();
370  Real const deriv = burial_function_->dfunc( dist );
371 
372  Vector const force_vector_j = deriv * (-r) / dist;
373  Vector const f1 = -1.0 * cross( force_vector_j, heavy_atom_i );
374  Vector const f2 = -1.0 * force_vector_j;
375  F1 += -1.0 * well_depth_exposed_ * weights[ rna_data_backbone ] * f1;
376  F2 += -1.0 * well_depth_exposed_ * weights[ rna_data_backbone ] * f2;
377  }
378 
379  }
380 
381 
382  }
383 
384 }
385 
386 
387 
388 
389 /// @brief RNA_DataBackboneEnergy distance cutoff
390 Distance
392 {
393  return 0.0; /// Uh, I don't know.
394 }
397 {
398  return 1; // Initial versioning
399 }
400 
401 }
402 }
403 }