OpenStructure
sec_structure.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_MOL_SECONDARY_STRUCTURE_HH
20 #define OST_MOL_SECONDARY_STRUCTURE_HH
21 
22 #include <ost/mol/module_config.hh>
23 
24 namespace ost { namespace mol {
25 
30  typedef enum {
31  ALPHA_HELIX ='H',
32  PI_HELIX ='I',
33  THREE_TEN_HELIX ='G',
34  TURN ='T',
35  EXTENDED ='E',
36  BETA_BRIDGE ='B',
37  BEND ='S',
38  COIL ='C'
39  } Type;
40  explicit SecStructure(char type) : type_(Type(type)) {}
41  explicit SecStructure(Type type) : type_(type) {}
42  SecStructure() : type_(COIL) { }
43  bool operator==(const Type& rhs) const
44  {
45  return type_==rhs;
46  }
47 
48  bool operator==(const SecStructure& rhs) const
49  {
50  return type_==rhs.type_;
51  }
52 
53  bool operator!=(const Type& rhs) const
54  {
55  return !this->operator==(rhs);
56  }
57  bool operator!=(const SecStructure& rhs) const
58  {
59  return !this->operator==(rhs);
60  }
61 
62  bool IsHelical() const
63  {
64  return type_==ALPHA_HELIX || type_==PI_HELIX || type_==THREE_TEN_HELIX;
65  }
66 
67  bool IsExtended() const
68  {
69  return type_==EXTENDED || type_==BETA_BRIDGE;
70  }
71 
72  bool IsCoil() const
73  {
74  return type_==COIL || type_==BEND || type_==TURN;
75  }
76  operator char() const { return type_; }
77 private:
78  Type type_;
79 };
80 
81 }} // ns
82 #endif