Victor
 All Data Structures Functions Variables Friends Pages
PssmInput.h
1 /* This file is part of Victor.
2 
3  Victor is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Victor is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with Victor. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 
18 #ifndef __PssmInput_H__
19 #define __PssmInput_H__
20 
21 #include <Substitution.h>
22 #include <iostream>
23 #include <string>
24 
25 namespace Victor { namespace Align2{
26 
33  class PssmInput {
34  public:
35 
36  // CONSTRUCTORS:
37 
39  PssmInput();
40 
42  PssmInput(istream &is);
43 
45  PssmInput(const PssmInput &orig);
46 
48  virtual ~PssmInput();
49 
50 
51  // OPERATORS:
52 
54  PssmInput& operator =(const PssmInput &orig);
55 
57  friend ostream& operator <<(ostream &os, const PssmInput &object);
58 
60  friend istream& operator >>(istream &is, PssmInput &object);
61 
62 
63  // PREDICATES:
64 
66  double score(int i, int j);
67 
69  virtual unsigned int size() const;
70 
71 
72  // MODIFIERS:
73 
75  virtual void copy(const PssmInput &orig);
76 
78  virtual PssmInput* newCopy();
79 
80 
81  // HELPERS:
82 
84  template<class T> static void pWriteDoubleVector(ostream &os,
85  vector< vector<T> > data, vector<string> data1, vector<string> data2);
86 
88  template<class T> static void pReadDoubleVector(istream &is,
89  vector< vector<T> > &data, vector<string> &data1, vector<string> &data2);
90 
91 
92  protected:
93 
94 
95  private:
96 
97  // ATTRIBUTES:
98 
99  vector< vector<double> > residuescores;
100  vector<string> allPosition;
101  vector<string> allAa;
102 
103  };
104 
105  // -----------------------------------------------------------------------------
106  // PssmInput
107  // -----------------------------------------------------------------------------
108 
109  // PREDICATES:
110 
111  inline double
112  PssmInput::score(int i, int j) {
113  return residuescores[i][j];
114  }
115 
116  inline unsigned int
117  PssmInput::size() const {
118  return residuescores.size();
119  }
120 
121 }} // namespace
122 
123 #endif
PssmInput & operator=(const PssmInput &orig)
Assignment operator.
Definition: PssmInput.cc:51
static void pReadDoubleVector(istream &is, vector< vector< T > > &data, vector< string > &data1, vector< string > &data2)
Helper function used to read a vector<vector> construct.
Definition: PssmInput.cc:149
PssmInput()
Default constructor.
Definition: PssmInput.cc:29
static void pWriteDoubleVector(ostream &os, vector< vector< T > > data, vector< string > data1, vector< string > data2)
Helper function used to write a vector<vector> construct.
Definition: PssmInput.cc:130
friend istream & operator>>(istream &is, PssmInput &object)
Input operator.
Definition: PssmInput.cc:76
virtual ~PssmInput()
Destructor.
Definition: PssmInput.cc:40
virtual PssmInput * newCopy()
Construct a new "deep copy" of this object.
Definition: PssmInput.cc:115
double score(int i, int j)
Return the score of the aminoacid j in position i.
Definition: PssmInput.h:112
Implement I/O objects for handling BLAST PSSM (Position Specific Score Matrix).
Definition: PssmInput.h:33
virtual unsigned int size() const
Return the size of the object referred as the dimension of the PSSM.
Definition: PssmInput.h:117
virtual void copy(const PssmInput &orig)
Copy orig object to this object ("deep copy").
Definition: PssmInput.cc:89
friend ostream & operator<<(ostream &os, const PssmInput &object)
Output operator.
Definition: PssmInput.cc:64