DIAlign
alignment.h
1 #ifndef ALIGNMENT_H
2 #define ALIGNMENT_H
3 
4 #include <iostream>
5 #include <stdio.h>
6 #include <vector>
7 #include <limits>
8 
9 #include "utils.h"
10 #include "similarityMatrix.h"
11 #include "affinealignobj.h"
12 
17 namespace DIAlign
18 {
19 
20 const int NA = 0;
21 
27  std::vector<int> indexA_aligned;
28  std::vector<int> indexB_aligned;
29  std::vector<double> score;
30 };
31 
40 struct AlignObj
41 {
42  std::vector<double> s_data;
43  std::vector<Traceback::TracebackType> Traceback;
44  std::vector<double> M;
45  std::vector<double> M_forw;
46  std::vector<bool> Path;
47  std::vector<bool> simPath;
48  std::vector<int> OptionalPaths;
51  double GapOpen;
52  double GapExten;
53  bool FreeEndGaps;
54  std::vector<int> indexA_aligned;
55  std::vector<int> indexB_aligned;
56  std::vector<double> score;
57  double score_forw;
58  double simScore_forw;
59  double alterAlignScore;
60  int nGaps;
61 
69  // Not a default constructor
70  AlignObj(int ROW_SIZE, int COL_SIZE)
71  {
72  M.resize(ROW_SIZE * COL_SIZE, 0);
73  M_forw.resize(ROW_SIZE * COL_SIZE, 0);
74  Traceback.resize(ROW_SIZE * COL_SIZE, Traceback::SS);
75  Path.resize(ROW_SIZE * COL_SIZE, false);
76  simPath.resize(ROW_SIZE * COL_SIZE, false);
77  OptionalPaths.resize(ROW_SIZE * COL_SIZE, 0);
78  signalA_len = ROW_SIZE-1;
79  signalB_len = COL_SIZE-1;
80  s_data.resize(signalA_len * signalB_len, 0.0);
81  GapOpen = 0.0;
82  GapExten = 0.0;
83  FreeEndGaps = true;
84  score_forw = 0.0;
85  simScore_forw = 0.0;
86  alterAlignScore = 0.0;
87  nGaps = 0;
88  }
89 
90  // Rule 1 Copy constructor and Rule 2 Copy assignment operator are not needed.
91  // C++ auto-create them and will do the right-thing compared to manual code.
92  // Rule 3 Not a default destructor
93  ~AlignObj()
94  { }
95 };
96 
102 namespace Alignment
103 {
104 
109 AlignObj doAlignment(SimMatrix s, double gap, bool OverlapAlignment);
110 
119 void getAlignedIndices(AlignObj &alignObj);
120 
121 }
122 }
123 
124 #endif // ALIGNMENT_H
std::vector< int > indexA_aligned
Aligned signalA indices after alignment.
Definition: alignment.h:54
std::vector< double > score
Cumulative score along the aligned path.
Definition: alignment.h:56
std::vector< double > M_forw
Not needed, will be removed.
Definition: alignment.h:45
Includes aligned indices of signal A and signal B with the cumulative score.
Definition: alignment.h:26
An alignment object (for non-affine alignment)
Definition: alignment.h:40
double simScore_forw
Summation of similarity score along the alignment path-band.
Definition: alignment.h:58
Generic namespace for all classes and functions of DIAlign.
Definition: affinealignment.cpp:29
std::vector< double > s_data
similarity score matrix.
Definition: alignment.h:42
double GapExten
Not needed, will be removed.
Definition: alignment.h:52
double GapOpen
Penalty for Gap opening. For n consecutive gaps: Penalty = n*GapOpen.
Definition: alignment.h:51
double alterAlignScore
Alignment score of 2nd best peak alignment.
Definition: alignment.h:59
std::vector< int > OptionalPaths
Highlight the number of all optimal paths.
Definition: alignment.h:48
std::vector< bool > Path
Path matrix would represent alignment path through similarity matrix as binary-hot encoding...
Definition: alignment.h:46
std::vector< double > M
Match or Mismatch matrix, residues of A and B are aligned without a gap. M(i,j) = Best score upto (i...
Definition: alignment.h:44
int nGaps
Total number of gaps in the alignment path.
Definition: alignment.h:60
Similarity matrix.
Definition: similarityMatrix.h:14
double score_forw
Not needed, will be removed.
Definition: alignment.h:57
bool FreeEndGaps
True for Overlap alignment.
Definition: alignment.h:53
std::vector< bool > simPath
Not needed, will be removed.
Definition: alignment.h:47
std::vector< Traceback::TracebackType > Traceback
Traceback matrices store source matrix name and direction as matrices are filled with dynamic program...
Definition: alignment.h:43
int signalB_len
Number of data-points in signal B.
Definition: alignment.h:50
int signalA_len
Number of data-points in signal A.
Definition: alignment.h:49
std::vector< int > indexB_aligned
Aligned signalB indices after alignment.
Definition: alignment.h:55
AlignObj(int ROW_SIZE, int COL_SIZE)
Constructor for AlignObj.
Definition: alignment.h:70