|
MASA-Core
|
00001 /******************************************************************************* 00002 * 00003 * Copyright (c) 2010-2015 Edans Sandes 00004 * 00005 * This file is part of MASA-Core. 00006 * 00007 * MASA-Core is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * MASA-Core is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with MASA-Core. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 ******************************************************************************/ 00021 00022 class Alignment; 00023 00024 #ifndef _ALIGNMENT_HPP 00025 #define _ALIGNMENT_HPP 00026 00027 #include <string> 00028 using namespace std; 00029 00030 #include "AlignmentParams.hpp" 00031 00032 #define TYPE_MATCH (0) 00033 #define TYPE_GAP_1 (1) //HORIZONTAL (gap on sequence 0) // TODO alterar constantes 00034 #define TYPE_GAP_2 (2) //VERTICAL (gap on sequence 1) // TODO alterar constantes 00035 00036 struct gap_sequence_t { 00037 int i0; 00038 int j0; 00039 int i1; 00040 int j1; 00041 int type() { 00042 if (i0==i1) return 1; 00043 if (j0==j1) return 2; 00044 return 0; //TODO ERROR 00045 } 00046 00047 int len() { 00048 return (i1-i0)+(j1-j0); 00049 } 00050 }; 00051 00052 struct gap_t { 00053 int pos; 00054 int len; 00055 00056 gap_t() { 00057 00058 } 00059 00060 gap_t(int pos, int len) { 00061 this->pos = pos; 00062 this->len = len; 00063 } 00064 }; 00065 00066 class Alignment { 00067 public: 00068 00069 Alignment(AlignmentParams* params); 00070 Alignment(const Alignment& orig); 00071 virtual ~Alignment(); 00072 00073 void addGapInSeq0(int i); 00074 void addGapInSeq1(int j); 00075 void finalize /*int i0, int j0, int i1, int j1*/ 00076 (); 00077 bool isFinalized(); 00078 //void printBinary(string filename); 00079 //void loadBinary(string filename); 00080 vector<gap_sequence_t>* getGapSequences(); 00081 AlignmentParams* getAlignmentParams() const; 00082 int getRawScore() const; 00083 void setRawScore(int rawScore); 00084 00085 vector<gap_t>* getGaps(int seq) { 00086 return &gaps[seq]; 00087 } 00088 00089 void setStart(int seq, int pos); 00090 void setEnd(int seq, int pos); 00091 int getStart(int seq); 00092 int getEnd(int seq); 00093 string getPruningFile() const; 00094 void setPruningFile(string pruningFile); 00095 int getGapExtensions() const; 00096 void setGapExtensions(int gapExtensions); 00097 int getGapOpen() const; 00098 void setGapOpen(int gapOpen); 00099 int getMatches() const; 00100 void setMatches(int matches); 00101 int getMismatches() const; 00102 void setMismatches(int mismatches); 00103 00104 private: 00105 int start[2]; 00106 int end[2]; 00107 00108 int rawScore; 00109 int matches; 00110 int mismatches; 00111 int gapOpen; 00112 int gapExtensions; 00113 00114 bool alignmentFinalized; 00115 AlignmentParams* params; 00116 00117 vector<gap_t> gaps[2]; 00118 vector<gap_sequence_t> gap_sequences; 00119 string pruningFile; 00120 00121 void addGap(int seq, int i); 00122 00123 }; 00124 00125 #endif /* _ALIGNMENT_HPP */ 00126
1.7.6.1