Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ABEGOManager.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 core/util/ABEGOManager.hh
11 /// @brief header file for class of ABEGO plus
12 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
13 
14 #ifndef INCLUDED_core_util_ABEGOManager_hh
15 #define INCLUDED_core_util_ABEGOManager_hh
16 
18 
19 // package headers
20 #include <core/pose/Pose.fwd.hh>
21 
22 // utility headers
23 #include <core/types.hh>
24 #include <utility/exit.hh>
25 #include <utility/vector1.hh>
26 #include <utility/pointer/owning_ptr.hh>
27 #include <utility/pointer/ReferenceCount.hh>
28 
29 // C++ headers
30 #include <string>
31 #include <map>
32 
33 namespace core {
34 namespace util {
35 
36 /// @brief struct
37 struct Line {
38 
39 
40  /// @brief default constructor
41  inline
42  Line() :
43  slope( 0.0 ),
44  intercept( 0.0 ),
45  region( true ) // true means region above the line is indicated
46  {}
47 
48 
49  /// @brief value constructor
50  inline
52  Real const r1,
53  Real const r2,
54  bool const b // true means region above the line is indicated
55  ) :
56  slope( r1 ),
57  intercept( r2 ),
58  region( b )
59  {}
60 
61  /// @brief copy constructor
62  inline
63  Line( Line const & rval ) :
64  slope( rval.slope ),
65  intercept( rval.intercept ),
66  region( rval.region )
67  {}
68 
69 
70  /// @brief default destructor
71  inline
72  ~Line() {}
73 
74 
75  /// @brief copy assignment
76  inline
77  Line & operator =( Line const & rval ) {
78  if ( this != &rval ) {
79  slope = rval.slope;
80  intercept = rval.intercept;
81  region = rval.region;
82  }
83  return *this;
84  }
85 
86  /// @brief slope of line
88 
89  /// @brief intercept of line
91 
92  /// @brief region to be selected, true: above the line, false below the line
93  bool region;
94 
95 };
96 
97 /// @brief abego elments
98 class ABEGO {
99 public:
100 
101  typedef core::Real Real;
103 
104 public:
105 
106  /// @brief default constructor
107  ABEGO() :
108  phi_min_( 0.0 ),
109  phi_max_( 0.0 ),
110  psi_min_( 0.0 ),
111  psi_max_( 0.0 ),
112  cis_omega_( false )
113  {}
114 
115  /// @brief value constructor
116  ABEGO( char const & name,
117  Real phi_min,
118  Real phi_max,
119  Real psi_min,
120  Real psi_max,
121  bool cis_omega ) :
122  name_( name ),
123  phi_min_( phi_min ),
124  phi_max_( phi_max ),
125  psi_min_( psi_min ),
126  psi_max_( psi_max ),
127  cis_omega_( cis_omega )
128  {
129  runtime_assert( phi_min_ <= phi_max_ );
130  runtime_assert( psi_min_ <= psi_max_ );
131  }
132 
133  /// @brief destrurctor
134  ~ABEGO() {}
135 
136 public: // accessor
137 
138  inline char name() { return name_; }
139  inline Real phi_max() { return phi_max_; }
140  inline Real phi_min() { return phi_min_; }
141  inline Real psi_max() { return psi_max_; }
142  inline Real psi_min() { return psi_min_; }
143  inline bool cis_omega() { return cis_omega_; }
144 
145  void add_line( Real const slope, Real const intercept, bool const region );
146 
147 public: //
148 
149  /// @brief check input torsion angle are in a given abego region
150  bool check_rama2( Real const & phi, Real const & psi );
151 
152  /// @brief check input torsion angle are in a given abego region
153  bool check_rama( Real const & phi, Real const & psi, Real const & omega );
154 
155 private: // data
156 
157  char name_;
163 
165 
166 };
167 
168 
169 /// @brief manager for abego
171 public: // typedef
172 
173 
174  typedef core::Size Size;
175  typedef core::Real Real;
178 
179 public:
180 
181  /// @brief default constructor
182  ABEGOManager();
183 
184  /// @brief value constructor
185  virtual ~ABEGOManager() ; // auto-removing definition from header{}
186 
187  /// @brief copy constructor
188  ABEGOManager( ABEGOManager const & rval );
189 
190 
191 public:
192 
193 
194  /// @brief total number of abego definition
196 
197 
198 public:
199 
200 
201  /// @brief initialize
202  void initialize();
203 
204  /// @brief check input torsion angle are in a given abego region
205  bool check_rama( char const & symbol, Real const & phi, Real const & psi, Real const & omega );
206 
207  /// @brief get abego index from torsion angles
208  Size torsion2index( Real const phi, Real const psi, Real const omega, Size const level=1 );
209 
210  /// @brief get abego index from torsion angles at level 1
211  Size torsion2index_level1( Real const phi, Real const psi, Real const omega );
212 
213  /// @brief get abego index from torsion angles at level 2
214  Size torsion2index_level2( Real const phi, Real const psi, Real const omega );
215 
216  /// @brief get abego index from torsion angles at level 3
217  Size torsion2index_level3( Real const phi, Real const psi, Real const omega );
218 
219  /// @brief get abego index from torsion angles at level 3
220  Size torsion2index_level4( Real const phi, Real const psi, Real const omega );
221 
222  /// @brief all output level in current setup
223  Size alllevel() { return 3; }
224 
225  /// @brief transform abego symbol to index
226  Size symbol2index( char const & symbol );
227 
228  /// @brief transform abego index to symbol
229  char index2symbol( Size const & idx );
230 
231  /// @brief get abego sequence from pose
232  utility::vector1< String > get_symbols( Pose const & pose, Size const level=1 );
233 
234  /// @brief get abego sequence from pose
235  utility::vector1< String > get_symbols( Pose const & pose, Size const begin, Size const end, Size const level );
236 
237  /// @brief get abego string
239 
240 
241 private: // data
242 
243  /// @brief total number of abego symbols
245 
246  /// @brief map relating the index to ABEGO class
247  std::map< Size, ABEGO > name2abego_;
248 
249 
250 };
251 
252 /// @brief utility for getting abego
254 get_abego( core::pose::Pose const & pose, core::Size const level=1 );
255 
256 
257 } // namespace util
258 } // namespace core
259 
260 #endif /* INCLUDED_core_util_hh */