Victor
 All Data Structures Functions Variables Friends Pages
Alignment.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 #ifndef __Alignment_H__
18 #define __Alignment_H__
19 
20 #include <AlignmentBase.h>
21 #include <Debug.h>
22 #include <string>
23 #include <vector>
24 
25 namespace Victor { namespace Align2{
26 
32  class Alignment : public AlignmentBase {
33  public:
34 
35  // CONSTRUCTORS:
36 
38  Alignment();
39 
41  Alignment(const Alignment &orig);
42 
44  virtual ~Alignment();
45 
46 
47  // OPERATORS:
48 
50  Alignment& operator =(const Alignment &orig);
51 
52 
53  // PREDICATES:
54 
56  double getScore(unsigned int index = 0) const;
57 
59  double getEvalue(unsigned int index = 0) const;
60 
62  void saveMSAF(ostream &output) const;
63 
65  virtual void saveFasta(ostream &output) const;
66 
67 
68  // MODIFIERS:
69 
71  virtual void clearAlignment();
72 
74  virtual void swapTemplate(unsigned int index1, unsigned int index2);
75 
77  virtual void setTemplate(string t, string tName = "template",
78  double tScore = 0.0, double tEvalue = -1.0);
79 
81  void setScore(double val, unsigned int index = 0);
82 
84  void setEvalue(long double val, unsigned int index = 0);
85 
87  virtual void clearTemplate();
88 
90  virtual void cutTemplate(unsigned int index);
91 
93  virtual void doMatchPlusHeader(ostream &os, string headerTarget,
94  int startTarget, int endTarget, string headerTemplate, int startTemplate,
95  int endTemplate, string alignType, string gapOpen, string gapExtension,
96  double pWeigth, double sWeigth, double tWeigth, string seqTarget,
97  string seqTemplat) const;
98 
100  void loadFasta(istream &input);
101 
103  void loadCEBody(istream &input);
104 
106  void loadCE(istream &input);
107 
109  vector< vector<int> > loadMap(istream &is);
110 
112  vector<int> mapStructureCE2Sequence(vector< vector<int> > mapIn, istream &pdbstream,
113  string startingChain, vector<int> shiftedSeqresEntries);
114 
117  int getTrueMapFromPdb(istream &is, string startingChain, int structEntryMapCe);
118 
120  void loadBlastMode6(istream &input);
122  void loadPsiBlastMode4(istream &input);
124  void loadBlastMode6FullSeq(istream &input, string masterTarget);
125 
127  void loadMSAF(istream &input);
128 
130  virtual void copy(const Alignment &orig);
131 
133  virtual void addAlignment(const Alignment &other);
134 
137  virtual void RemoveLowerSimple(double ID);
138 
141  virtual void RemoveLowerAll(double ID);
142 
145  virtual void RemoveUpperSimple(double ID);
146 
149  virtual void RemoveUpperAll(double ID);
150 
151 
152  protected:
153 
154 
155  private:
156 
158  void loadCEHeader(istream &input);
159 
160 
161  // ATTRIBUTES:
162 
163  vector<double> score;
164  vector<long double> evalue;
165 
166  };
167 
168  // -----------------------------------------------------------------------------
169  // Alignment
170  // -----------------------------------------------------------------------------
171 
172  // PREDICATES:
173 
174  inline double
175  Alignment::getScore(unsigned int index) const {
176  if (index >= score.size())
177  ERROR("Invalid template requested.", exception);
178  return score[index];
179  }
180 
181  inline double
182  Alignment::getEvalue(unsigned int index) const {
183  if (index >= evalue.size())
184  ERROR("Invalid template requested.", exception);
185  return evalue[index];
186  }
187 
188 
189  // MODIFIERS:
190 
191  inline void
194  score.clear();
195  evalue.clear();
196  }
197 
198  inline void
201  score.clear();
202  evalue.clear();
203  }
204 
205 }} // namespace
206 
207 #endif
int getTrueMapFromPdb(istream &is, string startingChain, int structEntryMapCe)
Definition: Alignment.cc:441
virtual void addAlignment(const Alignment &other)
Combine two multiple sequence alignments of same target.
Definition: Alignment.cc:964
Alignment()
Default constructor.
Definition: Alignment.cc:34
void loadBlastMode6FullSeq(istream &input, string masterTarget)
Read BLAST output produced with blast option -m 4 this stands for a convenient form of multiple seque...
Definition: Alignment.cc:755
double getScore(unsigned int index=0) const
Return score of template index.
Definition: Alignment.h:175
virtual void copy(const Alignment &orig)
Copy orig object to this object ("deep copy").
Definition: Alignment.cc:949
virtual void saveFasta(ostream &output) const
Save as FASTA like output.
Definition: Alignment.cc:87
void loadFasta(istream &input)
Definition: Alignment.cc:196
Alignment & operator=(const Alignment &orig)
Assignment operator.
Definition: Alignment.cc:48
virtual void RemoveLowerSimple(double ID)
Definition: Alignment.cc:974
virtual void RemoveUpperAll(double ID)
Definition: Alignment.cc:1031
vector< int > mapStructureCE2Sequence(vector< vector< int > > mapIn, istream &pdbstream, string startingChain, vector< int > shiftedSeqresEntries)
Return the first aminoacids on the sequence that match the first on CE.
Definition: Alignment.cc:394
void loadBlastMode6(istream &input)
Read BLAST output produced with blast option -m 6 this stands for a convenient form of multiple seque...
Definition: Alignment.cc:633
void loadMSAF(istream &input)
Read MSAF.
Definition: Alignment.cc:920
Implement a simple alignment type.
Definition: Alignment.h:32
virtual void RemoveUpperSimple(double ID)
Definition: Alignment.cc:1018
virtual ~Alignment()
Destructor.
Definition: Alignment.cc:41
void setEvalue(long double val, unsigned int index=0)
Set E-value of template index.
Definition: Alignment.cc:125
void loadCEBody(istream &input)
Read output of CE program.
Definition: Alignment.cc:288
Abstract base class for all sorts of alignments.
Definition: AlignmentBase.h:32
virtual void swapTemplate(unsigned int index1, unsigned int index2)
Swap templates index1 and index2.
Definition: Alignment.cc:104
void loadCE(istream &input)
Read output of CE program.
Definition: Alignment.cc:347
virtual void clearAlignment()
Clear alignment data.
Definition: Alignment.h:192
void saveMSAF(ostream &output) const
Save as MSAF (Mannheim Sequence Alignment Format) like output.
Definition: Alignment.cc:76
virtual void clearAlignment()
Clear alignment data.
Definition: AlignmentBase.h:364
virtual void doMatchPlusHeader(ostream &os, string headerTarget, int startTarget, int endTarget, string headerTemplate, int startTemplate, int endTemplate, string alignType, string gapOpen, string gapExtension, double pWeigth, double sWeigth, double tWeigth, string seqTarget, string seqTemplat) const
Definition: Alignment.cc:159
void loadPsiBlastMode4(istream &input)
Read BLAST output produced with blast option -m 4 this stands for a convenient form of multiple seque...
Definition: Alignment.cc:474
virtual void clearTemplate()
Clear template data.
Definition: AlignmentBase.h:357
virtual void clearTemplate()
Clear template.
Definition: Alignment.h:199
double getEvalue(unsigned int index=0) const
Return E-value of template index.
Definition: Alignment.h:182
vector< vector< int > > loadMap(istream &is)
Read map file and build a matrix 2*N .
Definition: Alignment.cc:355
virtual void RemoveLowerAll(double ID)
Definition: Alignment.cc:987
void setScore(double val, unsigned int index=0)
Set score of template index.
Definition: Alignment.cc:118
virtual void cutTemplate(unsigned int index)
Remove all templates below index.
Definition: Alignment.cc:135
virtual void setTemplate(string t, string tName="template", double tScore=0.0, double tEvalue=-1.0)
Set template to t.
Definition: Alignment.cc:111