Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseRNA_Base_Sugar_Rotamer.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 StepWiseRNA_Base_Sugar_Rotamer
11 /// @brief Parameters to be passed between different modules of stepwise RNA building.
12 /// @detailed
13 /// @author Parin Sripakdeevong
14 
15 
16 //////////////////////////////////
18 #include <core/id/TorsionID.hh>
19 #include <core/pose/Pose.hh>
22 #include <basic/Tracer.hh>
23 
24 #include <ObjexxFCL/FArray1D.hh>
25 #include <ObjexxFCL/format.hh>
26 #include <ObjexxFCL/string.functions.hh>
27 #include <numeric/angle.functions.hh>
28 
29 #include <string>
30 
31 using namespace core;
32 using core::Real;
33 using ObjexxFCL::fmt::F;
34 
35 static basic::Tracer TR( "protocols.swa.rna.stepwise_rna_base_sugar_rotamer" );
36 
37 namespace protocols {
38 namespace swa {
39 namespace rna {
40 
41  //////////////////////////////////////////////////////////////////////////////////////////
42  // Constructor
43  StepWiseRNA_Base_Sugar_Rotamer::StepWiseRNA_Base_Sugar_Rotamer(
44  BaseState const & base_state,
45  PuckerState const & pucker_state,
46  core::scoring::rna::RNA_FittedTorsionInfo const & rna_fitted_torsion_info,
47  core::Size const bin_size): //This is to determine the bin value for chi
48  base_state_(base_state),
49  pucker_state_(pucker_state),
50  rna_fitted_torsion_info_(rna_fitted_torsion_info),
51  inputted_bin_size_( bin_size ), // must be 20, 10, or 5
52  extra_anti_chi_(false),
53  extra_syn_chi_(false)
54  {
55  reset();
56 
57 // num_base_std_ID_act_= (1 + 40/bin_size_)
58 
59 
60  base_state_list_.clear(); //April 30, 2011
61  if(base_state_== BOTH){
62  base_state_list_.push_back(ANTI);
63  base_state_list_.push_back(SYN);
64  }else if(base_state_== ANTI){
65  base_state_list_.push_back(ANTI);
66  }else if(base_state == SYN){
67  base_state_list_.push_back(SYN);
68  }else if(base_state == NONE){
69  //std::cout << "BLAH: base_state == NONE" << std::endl;
70  }else{
71  utility_exit_with_message( "Invalid base_state_=" + ObjexxFCL::string_of(base_state_) );
72  }
73 
74  //WARNING..DO NOT TRY TO INTRODUCE "NONE" value. pucker_state needs alway be defined even if not sampled, since EPSILON (in Rotamer Generator) depends on value of pucker_state! April 30, 2011
75  pucker_state_list_.clear();
76  if(pucker_state_ == ALL){
77  pucker_state_list_.push_back(NORTH);
78  pucker_state_list_.push_back(SOUTH);
79  }else if(pucker_state_ == NORTH){
80  pucker_state_list_.push_back(NORTH);
81  }else if(pucker_state_ == SOUTH ){
82  pucker_state_list_.push_back(SOUTH);
83  }else{
84  utility_exit_with_message( "Invalid pucker_state_=" + ObjexxFCL::string_of(pucker_state_) );
85  }
86 
87  }
88 
89  //////////////////////////////////////////////////////////////////////////
90  //destructor
92  {}
93 
94  //////////////////////////////////////////////////////////////////////////
95  bool
97 
98  if(pucker_ID_ > pucker_state_list_.size()) return false;
99 
100  //old_ID is always consistent the stored chi_/delta_ value
104 
105  PuckerState const & curr_pucker_state=current_pucker_state();
106 
107 
108  Size base_center_ID=99;
109  if(base_state_list_.size()!=0){
111  // total_variation_=60; //+-30 Aug_29 to Sept 15 2010 //Mod out on May 06, 2011
112  // total_variation_=100; //+-50 //testing on Sept 15 2010
113  // bin_size_= std::min(int(inputted_bin_size_), 10); // Aug_29 to Sept 15 2010 //Mod out on May 06, 2011
114 
115  total_variation_=120;
117  num_base_std_ID_= Size(1 + (total_variation_/bin_size_) ); //-40,-20,0,20,40
118  }else{
119  total_variation_=40; //+-20
121  num_base_std_ID_= Size(1 + (total_variation_/bin_size_) ); //-20,0,20
122  }
123 
124  if(base_state_list_[base_ID_]==ANTI){
125  base_center_ID=1;
126  }else if(base_state_list_[base_ID_]==SYN){
127  base_center_ID=2;
128  }else{
129  utility_exit_with_message( "Invalid current_base_state" + ObjexxFCL::string_of(base_state_list_[base_ID_] ) );
130  }
131  }
132 
133  if (curr_pucker_state == NORTH) {
134 
135  if(base_state_list_.size()!=0){
137  }
138 
142  } else if(curr_pucker_state == SOUTH) {
143 
144  if(base_state_list_.size()!=0){
146  }
147 
151 
152 // delta_ =rna_fitted_torsion_info_.gaussian_parameter_set_delta_south()[ 1 ].center;
153 // nu2_ = rna_fitted_torsion_info_.gaussian_parameter_set_nu2_south()[ 1 ].center;
154 // nu1_ = rna_fitted_torsion_info_.gaussian_parameter_set_nu1_south()[ 1 ].center;
155 // nu2_ = -38.9; //2eew res A_19 torsion value
156 // nu1_ = 161.8; //2eew res A_19 torsion value
157 // delta_= 146.8; //1q9a res G_9 torsion value
158 // nu2_ = -41.6; //1q9a res G_9 torsion value
159 // nu1_ = 167.2; //1q9a res G_9 torsion value
160 
161  }else{
162  utility_exit_with_message( "Invalid current_pucker_state!" + ObjexxFCL::string_of(curr_pucker_state) );
163  }
164 
165  base_std_ID_++;
166 
167  if(base_state_list_.size()!=0){
169  base_std_ID_=1;
170  base_ID_++;
171  }
172  }
173 
174  if(base_ID_ > base_state_list_.size()){
175  base_ID_ = 1;
176  pucker_ID_++;
177  }
178 
179  return true;
180  }
181 
182  //////////////////////////////////////////////////////////////////////////
183  PuckerState const &
185 
186 // std::cout << "pucker_ID_old_= " << pucker_ID_old_ << std::endl;
187 // std::cout << "pucker_state_list_.size()= " << pucker_state_list_.size() << std::endl;
188 
189  PuckerState const & pucker_state=pucker_state_list_[pucker_ID_old_];
190 
191  if(pucker_state!=NORTH && pucker_state!=SOUTH) utility_exit_with_message( "pucker_state should equal NORTH or SOUTH!" );
192 
193  return pucker_state;
194  }
195 
196  //////////////////////////////////////////////////////////////////////////
197 
198  std::string const
200 
201  using namespace ObjexxFCL;
202 
203  Real const principal_chi=numeric::principal_angle_degrees(chi_);
204  std::string base_state_string;
205 
206  if(base_state_list_.size()==0){
207  base_state_string="ZZ";
208  }else{
209 
210  if(principal_chi>0.0){
211  if(base_state_list_[base_ID_old_]!=ANTI) utility_exit_with_message( "principal_chi>0 but base_state_list_(base_ID_old_)!=ANTI" );
212  base_state_string="A"; //anti
213  }else{
214  if(base_state_list_[base_ID_old_]!=SYN ) utility_exit_with_message( "principal_chi<=0 but base_state_list_(base_ID_old_)!=SYN" );
215  base_state_string="S"; //syn
216  }
217 
218  base_state_string+=string_of(base_std_ID_old_);
219  }
220 
221  return base_state_string;
222  }
223 
224  //////////////////////////////////////////////////////////////////////////
225  std::string const
227 
229 
231  tag+="N";
232  }else if(current_pucker_state()==SOUTH){
233  tag+="S";
234  }else{
235  utility_exit_with_message( "Invalid current_pucker_state!" );
236  }
237 
238  return tag;
239 
240  }
241  //////////////////////////////////////////////////////////////////////////
242  void
244 
245  pucker_ID_=1;
246  base_ID_=1;
247  base_std_ID_=1;
248 
252 
253 
254  chi_=0.0;
255  delta_=0.0;
256  nu2_=0.0;
257  nu1_=0.0;
258 
259  }
260 
261  //////////////////////////////////////////////////////////////////////////
262 
263 
264 
265 }
266 }
267 }