Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
option.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 basic/options/option.cc
11 /// @brief Program options global and initialization function
12 /// @author Stuart G. Mentzer (Stuart_Mentzer@objexx.com)
13 
14 
15 // Unit headers
16 #include <basic/options/option.hh>
17 #include <basic/options/option.cc.include.gen.hh> // for add_al...
18 
19 #include <utility/options/OptionCollection.hh> // for Option...
20 
21 #include <basic/Tracer.hh> // for Tracer
23 #include <basic/options/keys/chemical.OptionKeys.gen.hh> // for overri...
24 #include <basic/options/keys/in.OptionKeys.gen.hh> // for altern...
25 #include <basic/options/keys/out.OptionKeys.gen.hh> // for path, pdb
26 #include <basic/options/keys/score.OptionKeys.gen.hh> // for no_pro...
28 
29 #include <basic/options/option.cc.gen.hh> // for add_al...
30 
31 #include <iosfwd> // for string
32 #include <string> // for allocator
33 #include <utility/options/BooleanOption.hh> // for Boolea...
34 #include <utility/options/PathOption.hh> // for PathOp...
35 #include <utility/options/PathVectorOption.hh> // for PathVe...
36 #include <utility/options/StringVectorOption.hh> // for String...
37 #include <utility/options/VectorOption_T_.hh> // for Vector...
38 #include <utility/vector1.hh> // for vector1
39 
40 namespace basic {
41 namespace options {
42 
43 static THREAD_LOCAL basic::Tracer TR( "basic.options" );
44 
45 /// @details OptionCollection global
47 
48 
49 /// @brief Named verbosity levels
50 int const silent ( 0 ); // No messages output
51 int const quiet ( 1 );
52 int const standard( 2 );
53 int const inform ( 4 );
54 int const chat ( 6 );
55 int const yap ( 7 );
56 int const gush ( 8 );
57 int const verbose ( 9 ); // All messages output
58 
59 
60 /// @brief Initialize the options
63 {
64 
65  using namespace utility::options;
66  using namespace basic::options::OptionKeys;
68 #ifdef BOINC
69  std::cerr << "Options::initialize()" << std::endl; std::cerr.flush();
70 #endif
71  // Load the built-in options
73 #ifdef BOINC
74  std::cerr << "Options::adding_options()" << std::endl; std::cerr.flush();
75 #endif
76  // Include options generated by Python script
77 
79 #ifdef BOINC
80  std::cerr << "Options::initialize() Check specs." << std::endl; std::cerr.flush();
81 #endif
82  // Check for problems in the option specifications
84 #ifdef BOINC
85  std::cerr << "Options::initialize() End reached" << std::endl; std::cerr.flush();
86 #endif
87 
88  return option;
89 }
90 
91 
92 /// @brief Process the specified options.
93 /// @note Do more complex value setup and checks here than the option system provides.
96 {
97  using namespace utility::options;
98 
99  { // Input paths
100  using namespace basic::options::OptionKeys::in::path;
101 
102  option[ fragments ].default_to( option[ path ] );
103  option[ pdb ].default_to( option[ path ] );
104  option[ database ].default_to( option[ path ] );
105  }
106 
107  { // Output paths
109 
110  option[ pdb ].default_to( option[ path ] );
111  option[ score ].default_to( option[ path ] );
112  }
113 
114  { // Carbohydrate-related umbrella options to make life easier for users
115  using namespace basic::options::OptionKeys;
116 
117  if ( option[ in::include_sugars ] ) {
118  option[ chemical::override_rsd_type_limit ].value( true );
119  option[ score::no_pro_close_ring_closure ].value( true );
120  //option[ score::ring_close_shadow_constraint ].value( 0.1 );
121  }
123  utility::vector1< std::string > alt_codes_list;
124  if ( option[ in::alternate_3_letter_codes ].active() ) {
125  alt_codes_list.append( option[ in::alternate_3_letter_codes ]() );
126  }
127  alt_codes_list.push_back( "glycam.codes" );
128  option[ in::alternate_3_letter_codes ].value( alt_codes_list );
129  }
130  }
131 
132  //fd crystal stuff
133  {
134  using namespace basic::options::OptionKeys;
135 
137  if ( option[ symmetry::symmetry_definition ]() == "CRYST1" ) {
138  option[ in::preserve_crystinfo ].value( true );
139  }
140  }
141  }
142 
143  TR.flush();
144  return option;
145 }
146 
147 
148 } // namespace options
149 } // namespace basic
ocstream cerr(std::cerr)
Wrapper around std::cerr.
Definition: ocstream.hh:290
Program path option class.
basic::options::OptionKeys collection
#define THREAD_LOCAL
BooleanOptionKey const glycam_pdb_format("carbohydrates:glycam_pdb_format")
void check_specs() const
Check for problems in the option specifications.
int const yap
Program options collection.
BooleanOptionKey const include_sugars("in:include_sugars")
BooleanOptionKey const no_pro_close_ring_closure("score:no_pro_close_ring_closure")
Program string vector option class.
Program vector-valued option abstract base class.
BooleanOptionKey const override_rsd_type_limit("chemical:override_rsd_type_limit")
basic::options::OptionKeys collection
int const chat
OptionCollection & initialize()
Initialize the options.
Definition: option.cc:62
Program boolean option class.
basic::options::OptionKeys collection
Program options collection.
tuple database
vectorL & append(vectorL const &v)
Append another vectorL to the back of the vector.
Definition: vectorL.hh:284
Program path vector option class.
static THREAD_LOCAL basic::Tracer TR("basic.options")
OptionCollection & process()
Process the specified options.
Definition: option.cc:95
void add_all_rosetta_options(utility::options::OptionCollection &option)
PathVectorOptionKey const fragments
int const inform
StringOptionKey const symmetry_definition("symmetry:symmetry_definition")
Tracer IO system.
BooleanOptionKey const preserve_crystinfo("in:preserve_crystinfo")
PathVectorOptionKey const pdb
Definition: contacts.py:38
int const quiet
basic::options::OptionKeys collection
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
PathVectorOptionKey const path
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:46
StringVectorOptionKey const alternate_3_letter_codes("in:alternate_3_letter_codes")
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
Definition: Tracer.hh:134
int const gush
basic::options::OptionKeys collection
int const standard
Program options global and initialization function.
basic::options::OptionKeys collection
ocstream & flush()
Flush the stream.
Definition: ocstream.hh:143
int const silent
Named verbosity levels.
Path name class supporting Windows and UN*X/Linux format names.
Definition: PathName.hh:35
int const verbose
void add_built_in_options()
Add the built-in options.