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
22 #include <basic/options/keys/carbohydrates.OptionKeys.gen.hh> // for glycam...
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...
27 
28 #include <basic/options/option.cc.gen.hh> // for add_al...
29 
30 #include <iosfwd> // for string
31 #include <string> // for allocator
32 #include <utility/options/BooleanOption.hh> // for Boolea...
33 #include <utility/options/PathOption.hh> // for PathOp...
34 #include <utility/options/PathVectorOption.hh> // for PathVe...
35 #include <utility/options/StringVectorOption.hh> // for String...
36 #include <utility/options/VectorOption_T_.hh> // for Vector...
37 #include <utility/vector1.hh> // for vector1
38 
39 namespace basic {
40 namespace options {
41 
42 static THREAD_LOCAL basic::Tracer TR( "basic.options" );
43 
44 /// @details OptionCollection global
46 
47 
48 /// @brief Named verbosity levels
49 int const silent ( 0 ); // No messages output
50 int const quiet ( 1 );
51 int const standard( 2 );
52 int const inform ( 4 );
53 int const chat ( 6 );
54 int const yap ( 7 );
55 int const gush ( 8 );
56 int const verbose ( 9 ); // All messages output
57 
58 
59 /// @brief Initialize the options
62 {
63 
64  using namespace utility::options;
65  using namespace basic::options::OptionKeys;
67 #ifdef BOINC
68  std::cerr << "Options::initialize()" << std::endl; std::cerr.flush();
69 #endif
70  // Load the built-in options
72 #ifdef BOINC
73  std::cerr << "Options::adding_options()" << std::endl; std::cerr.flush();
74 #endif
75  // Include options generated by Python script
76 
77  add_all_rosetta_options( option );
78 #ifdef BOINC
79  std::cerr << "Options::initialize() Check specs." << std::endl; std::cerr.flush();
80 #endif
81  // Check for problems in the option specifications
83 #ifdef BOINC
84  std::cerr << "Options::initialize() End reached" << std::endl; std::cerr.flush();
85 #endif
86 
87  return option;
88 }
89 
90 
91 /// @brief Process the specified options.
92 /// @note Do more complex value setup and checks here than the option system provides.
95 {
96  using namespace utility::options;
97 
98  { // Input paths
100 
101  option[ fragments ].default_to( option[ path ] );
102  option[ pdb ].default_to( option[ path ] );
103  option[ database ].default_to( option[ path ] );
104  }
105 
106  { // Output paths
108 
109  option[ pdb ].default_to( option[ path ] );
110  option[ score ].default_to( option[ path ] );
111  }
112 
113  { // Carbohydrate-related umbrella options to make life easier for users
114  using namespace basic::options::OptionKeys;
115 
116  if ( option[ in::include_sugars ] ) {
117  option[ chemical::override_rsd_type_limit ].value( true );
118  option[ score::no_pro_close_ring_closure ].value( true );
119  //option[ score::ring_close_shadow_constraint ].value( 0.1 );
120  }
121  if ( option[ carbohydrates::glycam_pdb_format ] ) {
122  utility::vector1< std::string > alt_codes_list;
123  if ( option[ in::alternate_3_letter_codes ].active() ) {
124  alt_codes_list.append( option[ in::alternate_3_letter_codes ]() );
125  }
126  alt_codes_list.push_back( "glycam.codes" );
127  option[ in::alternate_3_letter_codes ].value( alt_codes_list );
128  }
129  }
130 
131  TR.flush();
132  return option;
133 }
134 
135 
136 } // namespace options
137 } // namespace basic
ocstream cerr(std::cerr)
Wrapper around std::cerr.
Definition: ocstream.hh:290
Program path option class.
#define THREAD_LOCAL
void check_specs() const
Check for problems in the option specifications.
int const yap
Program options collection.
Program string vector option class.
Program vector-valued option abstract base class.
int const chat
OptionCollection & initialize()
Initialize the options.
Definition: option.cc:61
Program boolean option class.
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:94
int const inform
Tracer IO system.
int const quiet
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
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
int const standard
Program options global and initialization function.
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.