Victor
 All Data Structures Functions Variables Friends Pages
AlignmentData.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 __AlignmentData_H__
19 #define __AlignmentData_H__
20 
21 #include <Alignment.h>
22 #include <AlignmentBase.h>
23 #include <IoTools.h>
24 #include <algorithm>
25 #include <iostream>
26 #include <string>
27 
28 namespace Victor { namespace Align2{
29 
35  class AlignmentData {
36  public:
37 
38  // CONSTRUCTORS:
39 
41  AlignmentData(int n, const string &name1 = "Seq1",
42  const string &name2 = "Seq2");
43 
45  AlignmentData(const AlignmentData &orig);
46 
48  virtual ~AlignmentData();
49 
50 
51  // OPERATORS:
52 
55 
56 
57  // PREDICATES:
58 
60  virtual bool similar(char a, char b);
61 
63  virtual string getSequence(int n) = 0;
64 
66  virtual void calculateMatch(int i, int tbi, int j, int tbj) = 0;
67 
69  virtual void getMatch() = 0;
70 
72  virtual void outputMatch(ostream &os, bool fasta = false) = 0;
73 
75  virtual Alignment& generateMatch(double score = 0.00) = 0;
76 
77 
78  // MODIFIERS:
79 
81  virtual void copy(const AlignmentData &orig);
82 
84  virtual AlignmentData* newCopy() = 0;
85 
87  virtual void add(string s, int n);
88 
90  virtual void clear();
91 
92 
93  // ATTRIBUTES:
94 
95  vector<string> match;
96  int n;
97  string name1;
98  string name2;
99 
100 
101  protected:
102 
103 
104  private:
105 
106  };
107 
108  // -----------------------------------------------------------------------------
109  // AlignmentData
110  // -----------------------------------------------------------------------------
111 
112  // MODIFIERS:
113 
114  inline void
115  AlignmentData::add(string s, int n) {
116  match[n] += s;
117  }
118 
119  inline void
121  for (int i = 0; i < n; i++)
122  match[i] = "";
123  }
124 
125 }} // namespace
126 
127 #endif
virtual void add(string s, int n)
Insert a sequence at position n of the vector.
Definition: AlignmentData.h:115
string name1
Name of target sequence.
Definition: AlignmentData.h:97
virtual string getSequence(int n)=0
Return the sequence at position n of the vector.
AlignmentData & operator=(const AlignmentData &orig)
Assignment operator.
Definition: AlignmentData.cc:55
Implement a simple alignment type.
Definition: Alignment.h:32
AlignmentData(int n, const string &name1="Seq1", const string &name2="Seq2")
Default constructor.
Definition: AlignmentData.cc:33
int n
Number of strings in the alignment.
Definition: AlignmentData.h:96
virtual void copy(const AlignmentData &orig)
Copy orig object to this object ("deep copy").
Definition: AlignmentData.cc:120
Base class for printing alignments.
Definition: AlignmentData.h:35
virtual bool similar(char a, char b)
Define if two residues are similar.
Definition: AlignmentData.cc:71
virtual void clear()
Insert a void string in all positions of the vector.
Definition: AlignmentData.h:120
string name2
Name of template sequence.
Definition: AlignmentData.h:98
vector< string > match
Matching alignment positions.
Definition: AlignmentData.h:95
virtual void getMatch()=0
Reverse the strings of the vector.
virtual Alignment & generateMatch(double score=0.00)=0
Generate and return an ensemble of suboptimal alignments.
virtual AlignmentData * newCopy()=0
Construct a new "deep copy" of this object.
virtual void calculateMatch(int i, int tbi, int j, int tbj)=0
Calculate single match positions.
virtual ~AlignmentData()
Destructor.
Definition: AlignmentData.cc:44
virtual void outputMatch(ostream &os, bool fasta=false)=0
Control if the strings of the vector are similar and print them.