Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DecoySetEvaluation.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 /// @file
11 
12 #ifndef INCLUDED_protocols_toolbox_DecoySetEvaluation_hh
13 #define INCLUDED_protocols_toolbox_DecoySetEvaluation_hh
14 
16 
17 #include <ObjexxFCL/FArray3D.hh>
18 #include <ObjexxFCL/FArray2D.hh>
19 #include <ObjexxFCL/FArray2P.hh>
20 #include <ObjexxFCL/FArray2.hh>
21 #include <ObjexxFCL/FArray1D.hh>
22 // AUTO-REMOVED #include <utility/vector1.hh>
23 #include <core/types.hh>
24 #include <core/pose/Pose.hh>
26 
27 // AUTO-REMOVED #include <core/io/silent/silent.fwd.hh>
29 // AUTO-REMOVED #include <utility/exit.hh>
30 
31 #include <utility/vector1.hh>
32 
33 
34 
35 namespace protocols {
36 namespace toolbox {
37 
38 
39  /// @brief const_iterator class for SilentFileData container.
40 template< typename const_iterator, typename SomeOP >
42  typedef SomeOP value_type;
43  typedef value_type* pointer;
45  typedef std::ptrdiff_t difference_type;
46  typedef std::bidirectional_iterator_tag iterator_category;
47 
48 public:
49  /// @brief empty constructor
51 
52  /// @brief Constructor, given an iterator into the Structure_Map.
53  OP_const_iterator( const_iterator s_iter ) {
54  it_ = s_iter;
55  }
56 
58 
60  it_ = src.it_;
61  return (*this);
62  }
63 
64  bool operator==( const OP_const_iterator& other ) {
65  return ( it_ == other.it_ );
66  }
67 
68  bool operator!=( const OP_const_iterator& other ) {
69  return ( it_ != other.it_ );
70  }
71 
73  it_++;
74  return (*this);
75  }
76 
78  it_--;
79  return (*this);
80  }
81 
83  return *it_;
84  }
85 
87  return *it_;
88  }
89 
90 private:
91  const_iterator it_; // keeps track of my place in a Structure_Map
92 }; // class iterator
93 
94 
95 //template< typename Container >
96 //dereference_iterator< Container > dereference_iterator( typename Container::const_iterator );
97 
99 public:
101  virtual ~DecoySetEvaluation();
102 
103  static void register_options();
104 
105 
106  void reserve( core::Size n_decoys_ );
107 
108  void push_back( core::pose::Pose& pose );
109  //void push_back_CA_xyz( ObjexxFCL::FArray2D< core::Real > const&, core::Size nres );
110  void push_back_CA_xyz( ObjexxFCL::FArray2_double const&, core::Size nres );
111 
112  void pop_back_CA_xyz( );
113 
114  //get all CA from all structures in silent-file
115  void push_back_CA_xyz_from_silent_file( core::io::silent::SilentFileData const& sfd, bool store_energies );
116 
117  template< typename SilentStructIterator >
120  SilentStructIterator begin,
121  SilentStructIterator end,
122  bool store_energies
123  );
124 
125  void rmsf( utility::vector1< core::Real >& results );
126 
128  return n_decoys_max_;
129  }
131  return n_decoys_;
132  }
133  core::Size n_atoms() const {
134  return n_atoms_;
135  }
136 
137  void set_n_atom( core::Size natoms );
138 
140  return coords_;
141  }
142 
144 
145  //view on coords of structure i
146  ObjexxFCL::FArray2P_double coords( core::Size i ) const {
147  return ObjexxFCL::FArray2P_double( coords_( 1, 1, i ), 3, n_atoms_ );
148  }
149 
150  void rmsf( ObjexxFCL::FArray1_double& result );
151 
153  ObjexxFCL::FArray1_double const& weights,
154  ObjexxFCL::FArray2_double& xx_ref,
155  ObjexxFCL::FArray2_double& xx
156  ) const;
157  //returns the index of the structure used as reference (icenter)
158  core::Size wRMSD( core::Real sigma2, core::Real tolerance, ObjexxFCL::FArray1_double& weights );
159 
160  void set_weights( ObjexxFCL::FArray1_double const& weights );
161 
162  void superimpose( core::Size icenter = 1 ); //take icenter decoy as reference
163 
165  return ref_pose_;
166  }
167 
168  void clear() {
169  n_decoys_max_ = 0;
170  n_decoys_ = 0;
171  n_atoms_ = 0;
172  }
173 
174  void center_structure( core::Size i );
175  void center_structure( core::Size i, ObjexxFCL::FArray1_double const& weights );
176  void center_all( ObjexxFCL::FArray1_double const& weights );
177 
182  core::pose::Pose const& ref_pose,
183  core::Size root
184  ) const;
185  // void dump_coords() const;
186 
187  core::Size find_closest_to_average( ObjexxFCL::FArray2_double& average_structure ) const;
188  void compute_average_structure( ObjexxFCL::FArray2_double& average_structure ) const;
189 
192  store_energies_ = true;
194  };
195 
196 private:
197  void superimpose( ObjexxFCL::FArray1_double const& weights, core::Size icenter = 1 );
198  core::Real rmsf( core::Size pos );
199 
200  void prepare_push_back( core::Size nres );
201 
202 private:
204  ObjexxFCL::FArray1D_double COM;
210  ObjexxFCL::FArray1D_double weights_;
211 
214 
215  static bool options_registered_;
216 };
217 
218 }
219 }
220 
221 #endif