Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RDCScore.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 // This file is part of the Rosetta software suite && is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions && developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file protocols/frag_picker/scores/RDCScore.cc
10 /// @brief Object that scores a fragment by its RDC
11 /// @author Ray Wang (wangyr@u.washington.edu)
12 
15 
18 // AUTO-REMOVED #include <protocols/frag_picker/VallProvider.hh>
21 #ifdef WIN32
23 #endif
24 
25 // option key includes
26 // AUTO-REMOVED #include <basic/options/option.hh>
27 #include <basic/options/keys/OptionKeys.hh>
28 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
29 
30 // AUTO-REMOVED #include <core/conformation/Residue.hh>
32 // AUTO-REMOVED #include <core/chemical/ResidueTypeSet.hh>
33 
34 #include <basic/Tracer.hh>
35 
36 // utils
37 #include <core/kinematics/Jump.hh>
38 #include <core/pose/Pose.hh>
40 #include <utility/vector1.hh>
41 
42 
43 namespace protocols {
44 namespace frag_picker {
45 namespace scores {
46 
47 using namespace basic::options;
48 using namespace basic::options::OptionKeys;
49 
50 static basic::Tracer trRDCScore(
51  "protocols.frag_picker.scores.RDCScore");
52 
53 
55  Size priority,
56  Real lowest_acceptable_value,
57  bool use_lowest
58 ) :
60  priority,
61  lowest_acceptable_value,
62  use_lowest,
63  "RDCScore"
64  ) {
66  rdc_raw_data_ = rdc_file_->get_RDC_data();
67 }
68 
69 void RDCScore::do_caching(VallChunkOP current_chunk) {
70  std::string ctmp = current_chunk()->chunk_key();
71  if (ctmp.compare("change to 'cached_scores_id_' when ready") != 0) {
72  return; // CACHING NOT BUILT IN YET
73  }
74 }
75 
77  FragmentCandidateOP fragment,
78  FragmentScoreMapOP empty_map
79  ) {
80  return score( fragment, empty_map );
81 }
82 
84 }
85 
87  FragmentCandidateOP fragment,
88  FragmentScoreMapOP empty_map
89  ) {
90  ////////////////////////////////////////////////////////////////
91  //
92  // make a frag_pose
93  //
94  Size offset_query = fragment->get_first_index_in_query(); //index of the 1st rsd in a query sequence covered by this fragment
95  Size offset_vall = fragment->get_first_index_in_vall(); //index of the 1st rsd in a vall chunk covered by this fragment
96 
97  core::pose::Pose frag_pose;
100 
101  //get the whole vall chunk where the fragment from
102  VallChunkOP chunk = fragment->get_chunk();
103 
104  std::string fragment_seq ( fragment->get_length(), 'A' );
105  core::pose::make_pose_from_sequence( frag_pose, fragment_seq, *rsd_set);
106 
107  for (Size i = 1; i <= fragment->get_length(); ++i) {
108  Size vall_rsd_num = offset_vall + i - 1;
109 
110  VallResidueOP vall_rsd = chunk->at( vall_rsd_num );
111 
112  frag_pose.set_phi ( i, vall_rsd->phi() );
113  frag_pose.set_psi ( i, vall_rsd->psi() );
114  frag_pose.set_omega( i, vall_rsd->omega() );
115  }
116 
117  //////////////////////////////////////////////////////////////
118  //
119  // store rdc for a given query_sequence
120  //
121 
122  // rdc data handling
123  core::scoring::ResidualDipolarCoupling::RDC_lines rdc_data_given_fragment_lines;
124  for ( core::scoring::ResidualDipolarCoupling::RDC_lines::const_iterator it = rdc_raw_data_.begin(); it != rdc_raw_data_.end(); ++it ) {
125  //try to put RDC of a fragment into a place
126  if ( it->res1() >= offset_query && it->res1() <= offset_query + fragment->get_length() - 1 ) {
127  if ( it->res2() >= offset_query && it->res2() <= offset_query + fragment->get_length() - 1 ) {
128  core::scoring::RDC selected ( it->res1() - offset_query + 1, it->atom1(), it->res2() - offset_query + 1, it->atom2(), it->Jdipolar());
129  rdc_data_given_fragment_lines.push_back( selected );
130  }
131  }
132  }
133 
134  //read rdc data as lines
135  core::scoring::ResidualDipolarCouplingOP rdc_data_given_fragment =
136  new core::scoring::ResidualDipolarCoupling ( rdc_data_given_fragment_lines );
137  core::scoring::store_RDC_in_pose( rdc_data_given_fragment, frag_pose );
138 
139  ///////////////////////////////////////////////////////////////
140  //
141  // scoring the frag_pose using RDC in range
142  //
143  Real rdc_score = 0.0;
144  rdc_score = rdc_data_given_fragment->compute_dipscore( frag_pose );
145 
146  empty_map->set_score_component( rdc_score, id_ );
147  if (( rdc_score > lowest_acceptable_value_ ) && ( use_lowest_ == true ))
148  return false;
149  return true;
150 }
151 
152 
154  Size priority,
155  Real lowest_acceptable_value,
156  bool use_lowest,
157  FragmentPickerOP, //picker,
158  std::string
159  ) {
160  return ( FragmentScoringMethodOP )
161  new RDCScore(
162  priority,
163  lowest_acceptable_value,
164  use_lowest
165  );
166  }
167 
168 } // scores
169 } // frag_picker
170 } // protocols