Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TemplateJumpClaimer.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 TopologyBroker
11 /// @brief top-class (Organizer) of the TopologyBroker mechanism
12 /// @detailed responsibilities:
13 /// @author Oliver Lange
14 
15 // Unit Headers
17 
18 // Package Headers
21 
22 #ifdef WIN32
23 #include <core/fragment/Frame.hh>
24 #endif
25 
26 // Project Headers
27 #include <core/pose/Pose.hh>
29 #include <core/fragment/FragSet.hh>
30 // AUTO-REMOVED #include <core/fragment/FrameList.hh>
31 // AUTO-REMOVED #include <protocols/simple_moves/FragmentMover.hh>
38 #include <basic/options/keys/templates.OptionKeys.gen.hh>
39 
40 
41 // ObjexxFCL Headers
42 
43 // Utility headers
44 #include <utility/io/izstream.hh>
45 //#include <utility/io/ozstream.hh>
46 //#include <utility/io/util.hh>
47 #include <basic/Tracer.hh>
48 #include <basic/options/option.hh>
49 
50 //// C++ headers
51 #include <fstream>
52 
53 #include <utility/vector1.hh>
54 #include <boost/algorithm/string/erase.hpp>
55 
56 
57 // option key includes
58 
59 static basic::Tracer tr("protocols.topo_broker",basic::t_info);
60 //static numeric::random::RandomGenerator RG(18828234);
61 
62 namespace protocols {
63 namespace topology_broker {
64 
65 using namespace core;
66 
68 {
70 }
71 
73  : JumpClaimer( NULL, "template-jumps", weight )
74 {
76  read_config_file( config_file );
77 }
78 
80  templates_ = new abinitio::Templates( file, NULL /* native_pose_*/ );
81  // templates_->target_sequence() = sequence_; // a hack until class SequenceMapping works better
82  // want to pick fragments from templates... make sure they are not initialized yet
83  //runtime_assert( !fragset_large_ );
84 
85  if( !templates_->is_good() ){
86  utility_exit_with_message("ERRORS occured during template setup. check BAD_SEQUENCES file!");
87  }
88  set_jump_def( templates_->create_jump_def( NULL ) );
89  /*NULL for ss_def_ ---- it will be determined from templates.. and is basically not used, since broker builds fold-tree himself;*/
90 
91 }
92 
94  utility::io::izstream is( file );
95  if ( !is.good() ) {
96  utility_exit_with_message(" did not find topology_file: " + file );
97  }
99  is >> *ps;
100  tr.Info << *ps << std::endl;
101  core::scoring::dssp::PairingList helix_pairings; //empty for now
103  ss_def->extend( 1500 ); //HACK number of residues
104  set_jump_def( new abinitio::TemplateJumpSetup( NULL, ss_def, ps, helix_pairings ) );
105 }
106 
107 bool TemplateJumpClaimer::read_tag( std::string tag, std::istream& is ) {
108  if ( tag == "file" ) {
109  std::string file;
110  is >> file;
111  if ( jump_def() ) EXCN_Input( "Define either template config-file or topology_file for " + type() );
112  read_config_file( file );
113  } else if ( tag == "PAIRING_FILE" ) {
114  // get pairings file
115  std::string file;
116  is >> file;
117  pairings_.clear();
118  read_pairing_list( file, pairings_ );
119  tr.Info << "found " << pairings_.size() << " pairings in file " << file << std::endl;
120  } else if ( tag == "SHEETS" || tag == "RANDOM_SHEETS" ) {
121  //interpret rest of line as sheet topology
122  std::string line;
123  getline( is, line );
124  std::istringstream is_line( line );
125  copy( std::istream_iterator< core::Size >( is_line ), std::istream_iterator< core::Size >(), std::back_inserter( sheets_ ) );
126 
127  if ( tag == "RANDOM_SHEETS" ) bRandomSheet_ = true;
128  else bRandomSheet_ = false;
129  } else if ( tag == "SS_INFO" ) {
130  std::string file;
131  is >> file;
133  ss_def_->read_psipred_ss2( file );
134  } else if ( tag == "mover_weight" ) {
135  read_mover_weight( is );
136  } else if ( tag == "topol_file" || tag == "TOPOL_FILE" ) {
137  std::string file;
138  is >> file;
139  if ( jump_def() ) EXCN_Input( "Define either template config-file or topology_file for " + type() );
140  read_topol_file( file );
141  } else return JumpClaimer::read_tag( tag, is );
142  return true;
143 }
144 
146  if ( !jump_def() && basic::options::option[ basic::options::OptionKeys::templates::config ].user() && !templates_ ) { //read from cmd-flag if not set explicitly
147  read_config_file( basic::options::option[ basic::options::OptionKeys::templates::config ]() );
148  }
149  if ( pairings_.size() ) {
150  if ( !ss_def_ ) EXCN_Input( "If you use PAIRING_FILE you also have to specify SS_INFO " );
151  if ( !sheets_.size() ) EXCN_Input( "If you use PAIRING_FILE you also have to specify SHEET or RANDOM_SHEET " );
154  }
155 }
156 
157 
158 } //topology_broker
159 } //protocols