Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PairingStatistics.hh
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 /// @author Oliver Lange
11 
12 #ifndef INCLUDED_protocols_abinitio_PairingStatistics_hh
13 #define INCLUDED_protocols_abinitio_PairingStatistics_hh
14 
15 // Unit Headers
17 
18 
19 // Package Headers
20 // AUTO-REMOVED #include <protocols/abinitio/Templates.hh>
21 // AUTO-REMOVED #include <protocols/abinitio/Template.hh>
22 // AUTO-REMOVED #include <protocols/abinitio/TemplateJumpSetup.fwd.hh>
23 
24 // Project Headers
25 #include <core/pose/Pose.fwd.hh>
26 #include <core/types.hh>
27 
28 // AUTO-REMOVED #include <core/fragment/FragSet.fwd.hh>
29 // AUTO-REMOVED #include <core/fragment/FragData.fwd.hh>
30 // AUTO-REMOVED #include <core/fragment/FrameList.fwd.hh>
31 // AUTO-REMOVED #include <core/fragment/SingleResidueFragData.fwd.hh>
32 
33 // AUTO-REMOVED #include <core/scoring/constraints/AtomPairConstraint.fwd.hh>
34 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.fwd.hh>
35 
37 // AUTO-REMOVED #include <core/fragment/SecondaryStructure.fwd.hh>
39 
40 
41 // ObjexxFCL Headers
42 
43 // Utility headers
44 #include <utility/pointer/ReferenceCount.hh>
45 #include <utility/exit.hh>
46 
47 
48 //// C++ headers
49 // AUTO-REMOVED #include <cstdlib>
50 #include <string>
51 // AUTO-REMOVED #include <vector>
52 #include <map>
53 
55 #include <utility/vector1.hh>
56 #include <boost/unordered_map.hpp>
57 
58 namespace protocols {
59 namespace abinitio {
60 
61 
63 public:
64  typedef std::string Model;
66 
68  PairingStatEntry( core::scoring::dssp::StrandPairing const& strand, Model const& id );
69 
70  core::Size frequency() const { return models_.size(); };
73 
74  void show( std::ostream& ) const;
75 
76  void set_weight( core::Real setting ) {
77  weight_ = setting;
78  }
79 
80  core::Real weight() const {
81  return weight_;
82  }
83 
84  core::Size size() const {
85  return strand_pairing_.size();
86  }
87 
89  return pairing().contact_order();
90  }
91 
93  return strand_pairing_;
94  }
95 
96  ModelList const& models() const {
97  return models_;
98  }
99 
101  return models_;
102  }
103 
104  bool has_model( std::string const& ) const;
105 
106  friend std::istream& operator>> ( std::istream& is, PairingStatEntry& ps );
107 
108  bool operator==(PairingStatEntry const& other) const;
109  bool operator!=(PairingStatEntry const& other) const;
110 private:
114 };
115 
116 inline std::ostream& operator<< ( std::ostream& out, PairingStatEntry const& ps ) {
117  ps.show( out );
118  return out;
119 }
120 
121 inline std::size_t hash_value(PairingStatEntry const& val ) {
122  return val.pairing().hash_value();
123 }
124 inline std::size_t hash_value(core::scoring::dssp::StrandPairing const& val ) {
125  return val.hash_value();
126 }
127 
129 public:
130  bool operator() (
133  ) const;
134 };
135 class _HashEntry {
136 public:
137  std::size_t operator() ( core::scoring::dssp::StrandPairing const& ps) const {
138  return hash_value( ps );
139  }
140 };
141 
143 typedef boost::unordered_map<
146  _HashEntry,
149 
151 public:
152  typedef StatEntries::const_iterator const_iterator;
153  typedef PairingStatEntry::Model Model; //String ID !!!
154  typedef std::map< Model, core::scoring::dssp::StrandPairingSet > Topologies;
155  typedef std::map< Model, core::Size > ModelFreq;
157  typedef std::map< Model, core::Real > Weights;
158 
160  virtual ~PairingStatistics();
161 
162  PairingStatistics( Templates const& templates ) {
163  compute( templates );
164  };
165 
167 
170  }
171 
173  return native_topology_;
174  }
175 
177  return entries_.begin();
178  }
179 
180  const_iterator end() const {
181  return entries_.end();
182  }
183 
184  Model ranked_model( Size nr ) const {
185  if ( nr > model_weight_.size() ) return "BOGUS";
186  return model_weight_[ nr ].second;
187  }
188 
190  return model_weight_.size();
191  }
192 
193  core::Real weight( Size nr ) const {
194  runtime_assert( nr <= model_weight_.size() );
195  return model_weight_[ nr ].first;
196  }
197 
198  core::Real weight( Model id ) const;
199 
200 // return weights_[ id ];
201  // }
202 
204  Topologies::const_iterator iter ( topols_.find( id ) );
205  if ( iter == topols_.end() ) {
206  utility_exit_with_message("Model name not known: " + id );
207  }
208  return iter->second;
209  };
210 
212 
214 
215  friend std::ostream& operator<< ( std::ostream&, PairingStatistics const& ps );
216  friend std::istream& operator>> ( std::istream& is, PairingStatistics& ps );
217 
219  return native_topology_.has_pairing( pairing );
220  }
221 
222  static void register_options();
223  void add_entry(core::scoring::dssp::StrandPairing const& ps, Model const& id );
225 
227 
228  // void remove_stupid_strands();
229 
230 private:
231  void compute( Templates const& templates );
232 
235  ModelWeight model_weight_; // for each model (full length name) a weight
236  // Weights weights_; // same as in ModelWeight, but as a map MODEL --> weight
238 };
239 
240 extern std::ostream& operator<< ( std::ostream&, PairingStatistics const& ps );
241 
242 extern std::ostream& operator<< ( std::ostream&, StatEntries const& );
243 extern std::istream& operator<< ( std::istream&, StatEntries& );
244 
245 }
246 }
247 
248 #endif