Victor
 All Data Structures Functions Variables Friends Pages
Substitution.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 __Substitution_H__
19 #define __Substitution_H__
20 
21 #include <Debug.h>
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 
26 namespace Victor { namespace Align2{
27 
33  class Substitution {
34  public:
35 
36  // CONSTRUCTORS:
37 
39  Substitution();
40 
42  Substitution(const Substitution &orig);
43 
45  virtual ~Substitution();
46 
47 
48  // OPERATORS:
49 
51  Substitution& operator =(const Substitution &orig);
52 
54  friend ostream& operator <<(ostream &os, const Substitution &object);
55 
57  friend istream& operator >>(istream &is, Substitution &object);
58 
59 
60  // PREDICATES:
61 
63  virtual string getResidues() const = 0;
64 
65 
66  // MODIFIERS:
67 
69  virtual void copy(const Substitution &orig);
70 
72  virtual Substitution* newCopy() = 0;
73 
75  virtual void buildscore(const string &residues,
76  const vector< vector<int> > &residuescores);
77 
78 
79  // HELPERS:
80 
82 
83  /*template<class T> static void pWriteDoubleVector(ostream &os,
84  vector<vector<T> > data);
85  */
86  static void pWriteDoubleVector(ostream &os, vector<vector<int> > data);
88  template<class T> static void pReadDoubleVector(istream &is,
89  vector<vector<T> > &data);
90 
91 
92  // ATTRIBUTES:
93 
94  vector< vector<int> > score;
95 
96 
97  protected:
98 
99 
100  private:
101 
102  };
103 
104 }} // namespace
105 
106 #endif
virtual ~Substitution()
Destructor.
Definition: Substitution.cc:37
virtual void copy(const Substitution &orig)
Copy orig object to this object ("deep copy").
Definition: Substitution.cc:79
Base class for deriving substitution matrices.
Definition: Substitution.h:33
static void pReadDoubleVector(istream &is, vector< vector< T > > &data)
Helper function used to read a vector<vector> construct.
Definition: Substitution.cc:143
virtual Substitution * newCopy()=0
Construct a new "deep copy" of this object.
Substitution & operator=(const Substitution &orig)
Assignment operator.
Definition: Substitution.cc:48
virtual void buildscore(const string &residues, const vector< vector< int > > &residuescores)
Build scoring matrix from raw data.
Definition: Substitution.cc:96
static void pWriteDoubleVector(ostream &os, vector< vector< int > > data)
Helper function used to write a vector<vector> construct.
Definition: Substitution.cc:125
vector< vector< int > > score
Substitution score.
Definition: Substitution.h:94
Substitution()
Default constructor.
Definition: Substitution.cc:30
virtual string getResidues() const =0
Dummy implementation.
friend istream & operator>>(istream &is, Substitution &object)
Input operator.
Definition: Substitution.cc:67
friend ostream & operator<<(ostream &os, const Substitution &object)
Output operator.
Definition: Substitution.cc:61