bpp-seq  2.2.0
AAChouFasmanTurnIndex.h
Go to the documentation of this file.
1 //
2 // File: AAChouFasmanTurnIndex.h
3 // Created by: Bastien Boussau
4 // Created on: Fri Jan 14 10:31 2011
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for sequences analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _AACHUFASMANTURNINDEX_H_
41 #define _AACHUFASMANTURNINDEX_H_
42 
43 #include "AlphabetIndex1.h"
44 #include "../Alphabet/ProteicAlphabet.h"
45 #include "../Alphabet/AlphabetTools.h"
46 
47 namespace bpp
48 {
55  public AlphabetIndex1
56 {
57 private:
58  std::vector<double> turn_;
59 
60 public:
62  turn_()
63  {
64  turn_.resize(20);
65  turn_[ 0] = 66; // A
66  turn_[ 1] = 95; // R
67  turn_[ 2] = 156; // N
68  turn_[ 3] = 146; // D
69  turn_[ 4] = 119; // C
70  turn_[ 5] = 98; // Q
71  turn_[ 6] = 74; // E
72  turn_[ 7] = 156; // G
73  turn_[ 8] = 95; // H
74  turn_[ 9] = 47; // I
75  turn_[10] = 59; // L
76  turn_[11] = 101; // K
77  turn_[12] = 60; // M
78  turn_[13] = 60; // F
79  turn_[14] = 152; // P
80  turn_[15] = 143; // S
81  turn_[16] = 96; // T
82  turn_[17] = 96; // W
83  turn_[18] = 114; // Y
84  turn_[19] = 50; // V
85  }
86 
88 
90 
91 public:
92  double getIndex(int state) const throw (BadIntException)
93  {
94  if (state < 0 || state > 19) throw BadIntException(state, "AAChouFasmanTurnIndex::getIndex(). Invalid state.", &AlphabetTools::PROTEIN_ALPHABET);
95  return turn_[static_cast<size_t>(state)];
96  }
97 
98  double getIndex(const std::string& state) const throw (BadCharException)
99  {
100  return turn_[static_cast<size_t>(AlphabetTools::PROTEIN_ALPHABET.charToInt(state))];
101  }
102 
103  std::vector<double>* getIndexVector() const { return new std::vector<double>(turn_); }
104 
106 };
107 } // end of namespace bpp.
108 
109 #endif // _AACHUFASMANTURNINDEX_H_
110 
111 
AAChouFasmanTurnIndex * clone() const
An alphabet exception thrown when trying to specify a bad char to the alphabet.
const Alphabet * getAlphabet() const
Get the alphabet associated to this index.
Turn score for the Chou-Fasman algorithm of secondary structure prediction, according to http://prowl...
This alphabet is used to deal NumericAlphabet.
double getIndex(int state) const
Get the index associated to a state.
The Alphabet interface.
Definition: Alphabet.h:130
double getIndex(const std::string &state) const
Get the index associated to a state.
std::vector< double > * getIndexVector() const
One dimensionnal alphabet index interface.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
static const ProteicAlphabet PROTEIN_ALPHABET
Definition: AlphabetTools.h:64
int charToInt(const std::string &state) const
Give the int description of a state given its string description.