bpp-seq  2.2.0
AAIndex1Entry.h
Go to the documentation of this file.
1 //
2 // File: AAIndex1Entry.h
3 // Created by: Julien Dutheil
4 // Created on: Fri Jan 19 17:07 2007
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 _AAINDEX1ENTRY_H_
41 #define _AAINDEX1ENTRY_H_
42 
43 #include "AlphabetIndex1.h"
44 #include "../Alphabet/ProteicAlphabet.h"
45 
46 namespace bpp
47 {
52  public AlphabetIndex1
53 {
54 private:
55  std::vector<double> property_;
57 
58 public:
65  AAIndex1Entry(std::istream& input) throw (IOException);
66 
67  AAIndex1Entry(const AAIndex1Entry& index) :
68  property_(index.property_),
69  alpha_(index.alpha_)
70  {}
71 
73  {
74  property_ = index.property_;
75  alpha_ = index.alpha_;
76  return *this;
77  }
78 
79  virtual ~AAIndex1Entry() {}
80 
81  AAIndex1Entry* clone() const { return new AAIndex1Entry(*this); }
82 
83 public:
84  double getIndex(int state) const throw (BadIntException)
85  {
86  if (state < 0 || state > 19) throw BadIntException(state, "KleinAANetChargeIndex::getIndex(). Invalid state.", alpha_);
87  return property_[static_cast<size_t>(state)];
88  }
89 
90  double getIndex(const std::string& state) const throw (BadCharException)
91  {
92  return property_[static_cast<size_t>(alpha_->charToInt(state))];
93  }
94 
95  std::vector<double>* getIndexVector() const { return new std::vector<double>(property_); }
96 
97  const Alphabet* getAlphabet() const { return alpha_; }
98 };
99 } // end of namespace bpp.
100 
101 #endif // _AAINDEX1ENTRY_H_
102 
An alphabet exception thrown when trying to specify a bad char to the alphabet.
std::vector< double > * getIndexVector() const
Definition: AAIndex1Entry.h:95
This alphabet is used to deal NumericAlphabet.
const Alphabet * getAlphabet() const
Get the alphabet associated to this index.
Definition: AAIndex1Entry.h:97
AAIndex1Entry(std::istream &input)
Create a new AAIndex1Entry from an input stream.
The Alphabet interface.
Definition: Alphabet.h:130
virtual ~AAIndex1Entry()
Definition: AAIndex1Entry.h:79
double getIndex(const std::string &state) const
Get the index associated to a state.
Definition: AAIndex1Entry.h:90
This alphabet is used to deal with proteins.
One dimensionnal alphabet index interface.
AAIndex1Entry * clone() const
Definition: AAIndex1Entry.h:81
const ProteicAlphabet * alpha_
Definition: AAIndex1Entry.h:56
std::vector< double > property_
Definition: AAIndex1Entry.h:55
double getIndex(int state) const
Get the index associated to a state.
Definition: AAIndex1Entry.h:84
An alphabet exception thrown when trying to specify a bad int to the alphabet.
AAIndex1Entry(const AAIndex1Entry &index)
Definition: AAIndex1Entry.h:67
Create a AlphabetIndex1 object from an AAIndex2 entry.
Definition: AAIndex1Entry.h:51
int charToInt(const std::string &state) const
Give the int description of a state given its string description.
AAIndex1Entry & operator=(const AAIndex1Entry &index)
Definition: AAIndex1Entry.h:72