Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mr_protocols.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 
13 
14 #include <protocols/hybridization/MRMover.hh>
15 
16 #include <protocols/viewer/viewers.hh>
17 #include <basic/Tracer.hh>
18 #include <protocols/moves/Mover.hh>
19 #include <protocols/moves/Mover.fwd.hh>
20 #include <protocols/moves/MoverContainer.hh>
21 
22 #include <devel/init.hh>
23 #include <protocols/jd2/JobDistributor.hh>
24 #include <core/pose/Pose.hh>
25 #include <core/scoring/ScoreFunction.hh>
26 #include <core/scoring/ScoreFunctionFactory.hh>
27 #include <core/fragment/ConstantLengthFragSet.hh>
28 #include <core/fragment/util.hh>
29 #include <core/fragment/FragmentIO.hh>
30 #include <core/fragment/BBTorsionSRFD.hh>
31 
32 //options
33 #include <basic/options/option.hh>
36 #include <basic/options/keys/loops.OptionKeys.gen.hh>
37 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
38 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
39 #include <basic/options/keys/in.OptionKeys.gen.hh>
40 
41 
42 #include <iostream>
43 #include <string>
44 #include <sstream>
45 
46 
47 OPT_1GRP_KEY(Integer, MR, max_gaplength_to_model)
48 OPT_1GRP_KEY(Real, MR, cen_dens_wt)
49 OPT_1GRP_KEY(Real, MR, fa_dens_wt)
50 OPT_1GRP_KEY(Real, MR, cst_wt)
51 OPT_1GRP_KEY(Real, MR, relax_cst_wt)
52 OPT_1GRP_KEY(Boolean, MR, fast)
53 OPT_1GRP_KEY(Real, MR, censcale)
54 OPT_1GRP_KEY(StringVector, MR, disulf)
56 
57 static THREAD_LOCAL basic::Tracer TR( "rosetta_MR" );
58 
59 void*
60 my_main( void* ) {
61  using namespace basic::options;
62  using namespace basic::options::OptionKeys;
63  using namespace protocols::moves;
64  using namespace core::fragment;
65 
66 
67  if ( option[ OptionKeys::MR::mode ].user() ) {
68  TR << "The flag -MR::mode is no longer used. Ignoring." << std::endl;
69  }
70 
71  protocols::hybridization::MRMoverOP do_MR( new protocols::hybridization::MRMover );
72 
73  do_MR->set_max_gaplength_to_model( option[ OptionKeys::MR::max_gaplength_to_model ]() );
74  if ( option[ OptionKeys::symmetry::symmetry_definition ].user() ) {
75  do_MR->set_symmdef_file( option[ OptionKeys::symmetry::symmetry_definition ]() );
76  }
77  if ( option[ OptionKeys::MR::disulf ].user() ) {
78  do_MR->set_disulf( option[ OptionKeys::MR::disulf ]() );
79  }
80 
81  do_MR->set_disulf( option[ OptionKeys::MR::disulf ]() ); // force disulfides
82  do_MR->set_censcale( option[ OptionKeys::MR::censcale ]() ); // scale # centroid cycles
83  do_MR->set_cen_cst_weight( option[ OptionKeys::MR::cst_wt ]() );
84  do_MR->set_fa_cst_weight( option[ OptionKeys::MR::relax_cst_wt ]() );
85 
86  // fragment files: BACKWARDS COMPATABILITY with -loop options
87  if ( option[ OptionKeys::loops::frag_files ].user() ) {
88  FileVectorOption frag_files( option[ OptionKeys::loops::frag_files ] );
89  for ( core::Size i=1; i<=frag_files.size(); ++i ) {
90  if ( frag_files[i] == std::string("none") ) continue;
91 
92  FragSetOP frag_lib_op = (FragmentIO().read_data( frag_files[i] ));
93  if ( frag_lib_op->max_frag_length() >= 7 ) {
94  do_MR->set_big_fragments( frag_lib_op );
95  } else {
96  do_MR->set_small_fragments( frag_lib_op );
97  }
98  }
99  }
100 
101  if ( option[ OptionKeys::edensity::mapfile ].user() ) {
102  do_MR->set_centroid_density_weight( option[ OptionKeys::MR::cen_dens_wt ]() );
103  do_MR->set_fullatom_density_weight( option[ OptionKeys::MR::fa_dens_wt ](), option[ OptionKeys::MR::fast ]() );
104  }
105 
106  // run
107  protocols::jd2::JobDistributor::get_instance()->go( do_MR );
108 
109  return 0;
110 }
111 
112 ///////////////////////////////////////////////////////////////////////////////
113 
114 int
115 main( int argc, char * argv [] ) {
116  try {
117  NEW_OPT(MR::max_gaplength_to_model, "max gaplength to rebuild", 8);
118  NEW_OPT(MR::cen_dens_wt, "centroid density weight", 4.0);
119  NEW_OPT(MR::fa_dens_wt, "fullatom density weight", 1.0);
120  NEW_OPT(MR::cst_wt, "add constraints to centroid stage", false);
121  NEW_OPT(MR::relax_cst_wt, "add constraints to fullatom stage", false);
122  NEW_OPT(MR::fast, "fast mode", false);
123  NEW_OPT(MR::censcale, "scale # of centroid cycles", 1.0);
124  NEW_OPT(MR::disulf, "force a disulfide patterning", utility::vector1<std::string>());
125  NEW_OPT(MR::mode, "legacy flag; unused", "X");
126 
127  devel::init( argc, argv );
128 
129  protocols::viewer::viewer_main( my_main );
130  }
131 catch ( utility::excn::EXCN_Base const & e) {
132  std::cout << "caught exception " << e.msg() << std::endl;
133  return -1;
134 }
135 }
#define THREAD_LOCAL
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
std::string String
Definition: remodel.cc:69
void init(int argc, char *argv[])
Command line init() version.
Definition: init.cc:23
BooleanOptionKey const user("options:user")
Definition: OptionKeys.hh:40
static THREAD_LOCAL basic::Tracer TR("rosetta_MR")
int main(int argc, char *argv[])
static THREAD_LOCAL basic::Tracer TR("basic.options")
Tracer IO system.
basic::options::OptionKeys collection
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
double Real
Definition: types.hh:39
Program file vector option class.
#define NEW_OPT(akey, help, adef)
ocstream cout(std::cout)
Wrapper around std::cout.
Definition: ocstream.hh:287
void * my_main(void *)
Definition: mr_protocols.cc:60
#define OPT_1GRP_KEY(type, grp, key)
string mode
Definition: contacts.py:32
Program options global and initialization function.
platform::Size Size
Definition: random.fwd.hh:30
Size size() const
Size (number of values)