Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResidueTypesFeatures.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/ResidueTypesFeatures.cc
11 /// @brief report ResidueTypes to features Statistics Scientific Benchmark
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
16 
17 // Project Headers
18 #include <basic/Tracer.hh>
23 #include <core/pose/Pose.hh>
24 #include <core/types.hh>
25 #include <basic/database/sql_utils.hh>
26 
27 // Utility Headers
28 #include <utility/sql_database/DatabaseSessionManager.hh>
29 #include <utility/vector1.hh>
30 
31 // External Headers
32 #include <cppdb/frontend.h>
33 
34 // Boost Headers
35 #include <boost/foreach.hpp>
36 #define foreach BOOST_FOREACH
37 
38 // C++ Headers
39 #include <set>
40 #include <sstream>
41 
42 namespace protocols{
43 namespace features{
44 
45 using std::string;
46 using std::stringstream;
47 using std::endl;
48 using std::pair;
49 using std::set;
50 using core::Size;
51 using core::Real;
52 using core::pose::Pose;
57 using utility::sql_database::sessionOP;
58 using utility::vector1;
59 using basic::Tracer;
60 
61 static Tracer TR("protocols.features.ResidueTypesFeatures");
62 
64 {
66 }
67 
69 
70 string
71 ResidueTypesFeatures::type_name() const { return "ResidueTypesFeatures"; }
72 
73 void
75  sessionOP db_session
76 ) const {
77  // NOTE: To support building feature databases in parallel, the
78  // ResidueTypeSet and ResidueType objects must be identified by
79  // their names rather then assigning them a unique id.
80  return residue_dbio_.write_schema_to_db(db_session);
81 }
82 
85  utility::vector1<std::string> dependencies;
86  return dependencies;
87 }
88 
89 
90 Size
92  Pose const & pose,
93  vector1< bool > const & relevant_residues,
94  boost::uuids::uuid const,
95  sessionOP db_session
96 ){
97 
98  // Get a set of the unique residue types that are used in this pose
99  set< ResidueTypeCOP > res_types;
100  for(Size i=1; i <= pose.n_residue(); ++i){
101  if(!relevant_residues[i]) continue;
102  res_types.insert(&pose.residue_type(i));
103  }
104 
105  foreach( ResidueTypeCOP res_type, res_types){
106  string const & residue_type_set_name(res_type->residue_type_set().name());
107 
108  // Is this residue type already in the database?
109 
110  residue_dbio_.write_residuetype_to_database(residue_type_set_name,*res_type,db_session);
111  }
112  return 0;
113 }
114 
115 
116 } // namesapce
117 } // namespace