Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RBSegmentRelax_main.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
11 /// @brief
12 /// @author Srivatsan Raman
13 /// @author Frank DiMaio
14 
15 //#include <protocols/jobdist/JobDistributors.hh>
16 //#include <protocols/jobdist/Jobs.hh>
18 #include <core/types.hh>
19 
20 #include <core/kinematics/Jump.hh>
21 #include <core/fragment/FragSet.hh>
22 #include <core/pose/Pose.hh>
23 #include <core/pose/util.hh>
24 #include <basic/Tracer.hh>
25 
29 
32 
35 
37 
38 #include <protocols/boinc/boinc.hh> // required for boinc build
39 
40 // C++ headers
41 #include <fstream>
42 #include <iostream>
43 #include <string>
44 
45 // option key includes
46 #include <basic/options/keys/out.OptionKeys.gen.hh>
47 #include <basic/options/keys/RBSegmentRelax.OptionKeys.gen.hh>
48 #include <basic/options/keys/in.OptionKeys.gen.hh>
49 #include <basic/options/keys/loops.OptionKeys.gen.hh>
50 
51 //Auto Headers
52 #include <utility/vector1.hh>
57 #include <basic/options/option.hh>
58 
59 using basic::T;
60 using basic::Error;
61 using basic::Warning;
62 
63 basic::Tracer TRb("rbsegmove_main");
64 
65 namespace protocols {
66 // namespace rbsegment_relax {
67 
68 ////////////////////////////////////////////////
69 ///////////////////////////////////////////////////////////////////////////////
70 
72  //////////////////
73  // rbmover scorefn
75  basic::options::option[ basic::options::OptionKeys::RBSegmentRelax::rb_scorefxn ]()
76  );
77  core::pose::Pose native_pose;
78 
79  // native structure
80  if ( basic::options::option[ basic::options::OptionKeys::in::file::native ].user() ) {
81  core::import_pose::pose_from_pdb( native_pose, basic::options::option[ basic::options::OptionKeys::in::file::native ]() );
82  core::pose::set_ss_from_phipsi( native_pose );
83 
84 #ifdef BOINC_GRAPHICS
85  // set native for graphics
86  boinc::Boinc::set_graphics_native_pose( native_pose );
87 #endif
88 
90  }
91 
92 }
93 
95 
97  core::pose::set_ss_from_phipsi( pose ); // TODO is this line really necessary? is this not already in import_pose.cc
98 
99  // Read RB segs, auto generate loops
103  std::string rbfilename( basic::options::option[ basic::options::OptionKeys::RBSegmentRelax::rb_file ]().name() );
104 
105  for (int i=1; i<=pose.fold_tree().num_cutpoint() ; ++i)
106  cutpts.push_back( pose.fold_tree().cutpoint(i) );
107  int last_peptide_res = pose.total_residue();
108  while ( !pose.residue( last_peptide_res ).is_protein() )
109  last_peptide_res--;
110  read_RBSegment_file( rbsegs, loops, rbfilename, true, last_peptide_res , cutpts );
111 
112  // read fragments
114  if ( basic::options::option[ basic::options::OptionKeys::loops::frag_files ].user() )
116 
117 #ifdef BOINC_GRAPHICS
118  // attach boinc graphics pose observer
119  protocols::boinc::Boinc::attach_graphics_current_pose_observer( pose );
120 #endif
121 
122  rbsegment_relax::RBSegmentRelax shaker( scorefxn_rb_, rbsegs, loops );
123  shaker.initialize( frag_libs );
124  shaker.set_randomize( 2 ); //???
125  shaker.apply( pose );
126 
127 
128 }
129 
132  return "RBSegmentRelaxImpl";
133 }
134 
135 int
137 // using namespace rbsegment_relax;
138 // using namespace jobdist;
139 // using namespace basic::options;
140 // using namespace basic::options::OptionKeys;
141 // using namespace core::scoring;
142 // using namespace core::chemical;
143 // using namespace core::id;
144 
145 
146  //core::pose::Pose start_pose, pose;
147  //core::chemical::ResidueTypeSetCAP rsd_set;
148 
149  //std::string pdbfilename;
150  //if ( option[ OptionKeys::RBSegmentRelax::input_pdb ].user() )
151  // pdbfilename = option[ OptionKeys::RBSegmentRelax::input_pdb ]().name();
152  //else
153  // pdbfilename = option[ OptionKeys::in::file::s ]()[1];
154 
155  // if full-atom load starting structure as full-atom to recover sidechains later
156  //if ( option[ in::file::fullatom ]() ) {
157  // core::import_pose::pose_from_pdb( start_pose, pdbfilename );
158  //} else {
159  // core::import_pose::centroid_pose_from_pdb( start_pose, pdbfilename );
160  //}
161 
162  // roughly guess at secondary structure
163  //core::pose::set_ss_from_phipsi( start_pose );
164 
165 
166 
167 
168  ////////////////////////
169  ////////////////////////
170  // job distributor initialization
171  //utility::vector1< protocols::jobdist::BasicJobOP > input_jobs;
172  //int const nstruct_flag = option[ out::nstruct ];
173  //int const nstruct = std::max( 1, nstruct_flag );
174  //protocols::jobdist::BasicJobOP job = new protocols::jobdist::BasicJob("S", "rbseg", nstruct);
175  //input_jobs.push_back( job );
176  //protocols::jobdist::BaseJobDistributorOP jobdist;
177 
178  // output nonidealized silent file or PDBs?
179  //bool silent_output;
180  //if ( boinc_mode || option[ OptionKeys::out::file::silent ].user() ) {
181  // TRb.Debug << "Outputting silent file\n";
182  // jobdist = new protocols::jobdist::PlainSilentFileJobDistributor( input_jobs );
183  // silent_output = true;
184  //} else {
185  // TRb.Debug << "Outputting PDBs\n";
186  // jobdist = new protocols::jobdist::PlainPdbJobDistributor( input_jobs );
187  // silent_output = false;
188  //}
189 
190  //protocols::jobdist::BasicJobOP prev_job, curr_job;
191  //int curr_nstruct;
192  //jobdist->startup();
193 
194 
195 
196  /////
197  /////
198  //while ( jobdist->next_job(curr_job, curr_nstruct) ) { // loop over jobs
199  // std::string curr_job_tag = curr_job->output_tag( curr_nstruct );
200 
201  // pose = start_pose;
202 // if ( option[ in::file::fullatom ]() )
203 // core::util::switch_to_residue_type_set( pose, core::chemical::CENTROID );
204 
205 //#ifdef BOINC_GRAPHICS
206 // attach boinc graphics pose observer
207 // protocols::boinc::Boinc::attach_graphics_current_pose_observer( pose );
208 //#endif
209 
210  // the rigid body movement mover
211 // RBSegmentRelax shaker( scorefxn_rb, rbsegs, loops );
212 // shaker.initialize( frag_libs );
213 // shaker.set_randomize( 2 ); //???
214 // shaker.apply( pose );
215 
216  ////
217  //// output
218 // if ( silent_output ) {
219 // PlainSilentFileJobDistributor *jd =
220 // dynamic_cast< PlainSilentFileJobDistributor * > (jobdist());
221 
222 // std::string silent_struct_type( "binary" ); // default to binary
223 // if ( option[ out::file::silent_struct_type ].user() ) {
224 // silent_struct_type = option[ OptionKeys::out::file::silent_struct_type ];
225 // }
226 
227 // core::io::silent::SilentStructOP ss
228 // = core::io::silent::SilentStructFactory::get_instance()->get_silent_struct( silent_struct_type );
229 
230 // ss->fill_struct( pose, curr_job_tag );
231 
232 // jd->dump_silent( curr_nstruct, *ss );
233 // } else {
234 // jobdist->dump_pose_and_map( curr_job_tag, pose ); // output PDB
235 // }
236 // }
237 // jobdist->shutdown();
238 
239  RBSegmentRelaxImplOP rb_segment_relax_impl= new RBSegmentRelaxImpl();
240  protocols::jd2::JobDistributor::get_instance()->go( rb_segment_relax_impl );
241 
242  return 0;
243 }
244 
245 //}
246 } // namespace protocols
247 
248 ////////////////////////////////////////////////////////
249