Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HBondParameterFeatures.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 protocols/features/HBondParameterFeatures.cc
11 /// @brief report HBond Parameters to features Statistics Scientific Benchmark
12 /// @author Matthew O'Meara
13 
14 // Unit Headers
16 
17 // Project Headers
18 #include <basic/Tracer.hh>
23 #include <core/types.hh>
25 
26 // Utility Headers
27 #include <utility/sql_database/DatabaseSessionManager.hh>
28 #include <utility/tag/Tag.hh>
29 #include <utility/vector1.hh>
30 
31 // External Headers
32 #include <cppdb/frontend.h>
33 
34 // Boost Headers
35 #define foreach BOOST_FOREACH
36 
37 // C++ Headers
38 #include <sstream>
39 
42 #include <utility/excn/Exceptions.hh>
43 #include <utility/vector0.hh>
44 
45 
46 namespace protocols{
47 namespace features{
48 
49 
50 using std::string;
51 using std::stringstream;
52 using std::endl;
53 using core::Size;
54 using core::Real;
55 using core::pose::Pose;
67 using utility::sql_database::sessionOP;
69 using utility::vector1;
70 using cppdb::statement;
71 using cppdb::result;
72 using basic::Tracer;
73 
74 static Tracer TR("protocols.features.HBondParameterFeatures");
75 
78  scfxn_(getScoreFunction())
79 {}
80 
82  ScoreFunctionOP ) :
84  scfxn_(getScoreFunction())
85 {}
86 
88  HBondParameterFeatures const & src) :
90  scfxn_(src.scfxn_)
91 {}
92 
94 
95 string
96 HBondParameterFeatures::type_name() const { return "HBondParameterFeatures"; }
97 
98 void
100  sessionOP db_session
101 ) const {
103  return hb_database->report_parameter_features_schema_to_db(db_session);
104 }
105 
108  utility::vector1<std::string> dependencies;
109  dependencies.push_back("HBondFeatures");
110  return dependencies;
111 }
112 
113 void
115  TagPtr const tag,
116  DataMap & data,
117  Filters_map const & /*filters*/,
118  Movers_map const & /*movers*/,
119  Pose const & /*pose*/
120 ) {
121  if(tag->hasOption("scorefxn")){
122  string scorefxn_name = tag->getOption<string>("scorefxn");
123  scfxn_ = data.get<ScoreFunction*>("scorefxns", scorefxn_name);
124  } else {
125  stringstream error_msg;
126  error_msg
127  << "The " << type_name() << " reporter requires a 'scorefxn' tag:" << endl
128  << endl
129  << " <feature name=" << type_name() <<" scorefxn=(name_of_score_function) />" << endl;
130  throw utility::excn::EXCN_RosettaScriptsOption(error_msg.str());
131  }
132 }
133 
134 Size
136  Pose const &,
137  vector1< bool > const &,
138  boost::uuids::uuid const,
139  sessionOP db_session
140 ){
141 
142  string const & database_tag(
143  scfxn_->energy_method_options().hbond_options().params_database_tag());
144  HBondDatabaseCOP hb_database(HBondDatabase::get_database(database_tag));
145  return hb_database->report_parameter_features(db_session);
146 }
147 
148 } // namesapce
149 } // namespace