#include <MatchAligner.h>
Collaboration diagram for ColumnFillerBasic:

Public Member Functions | |
| ColumnFillerBasic (const char *p1, int p1Size, const char *p2, int p2Size, int bandExtension, const ScoreTable &scoreTable) | |
| ScoreType | operator() (PathMatrix< PathType > &matrix) |
Private Attributes | |
| const char * | p1_ |
| const char * | p2_ |
| int | bandExtension_ |
| const int | bandWidth_ |
| const int | bandLength_ |
| const int | colSize_ |
| CellFiller | fillCell_ |
| vector< ScoreType > | v1_ |
| vector< ScoreType > | v2_ |
| vector< ScoreType > * | pLast_ |
| vector< ScoreType > * | pCurrent_ |
| vector< ScoreType > * | temp_ |
| ScoreMaker | getScore_ |
| ScoreType | gapScore_ |
Definition at line 619 of file MatchAligner.h.
| ColumnFillerBasic::ColumnFillerBasic | ( | const char * | p1, | |
| int | p1Size, | |||
| const char * | p2, | |||
| int | p2Size, | |||
| int | bandExtension, | |||
| const ScoreTable & | scoreTable | |||
| ) | [inline] |
Definition at line 622 of file MatchAligner.h.
00625 : 00626 p1_(p1), 00627 p2_(p2), 00628 // bandExtension_(bandExtension), 00629 bandExtension_( (bandExtension<(p1Size/2)) 00630 ? bandExtension 00631 : max( (p1Size/2)-1, 0 ) ), 00632 bandWidth_(p2Size-p1Size+1), 00633 bandLength_(p1Size+1), 00634 colSize_(p2Size-p1Size+1+(2*bandExtension_)), 00635 // scoresPossible_(3), 00636 fillCell_(), 00637 v1_(colSize_, veryBadScoreIndeed ), 00638 v2_(colSize_, veryBadScoreIndeed ), 00639 pLast_(&v1_), 00640 pCurrent_(&v2_), 00641 getScore_(scoreTable), 00642 gapScore_(getScore_.getGapScore()) 00643 { 00644 // TBD check bandExtension_ is not too big 00645 } ScoreType operator()( PathMatrix<PathType>& matrix );
| ScoreType ColumnFillerBasic::operator() | ( | PathMatrix< PathType > & | matrix | ) |
Definition at line 1002 of file MatchAligner.cpp.
References bandExtension_, bandLength_, colSize_, fillCell_, fromFinished, gapScore_, getScore_, PathMatrix< PATH_TYPE >::lastCell_, p1_, p2_, pCurrent_, pLast_, temp_, v1_, v2_, and veryBadScoreIndeed.
01003 { 01004 ScoreType lastScore; 01005 int i,j; 01006 01007 matrix.resize(bandLength_, vector<PathType>(colSize_) ); 01008 01009 // Fill in first column 01010 matrix[0][bandExtension_]=fromFinished; 01011 v1_[bandExtension_]=0; 01012 01013 // cout << "doing first column" << endl; 01014 for (j= bandExtension_+1; j< colSize_ ; j++) 01015 { 01016 v1_[j] = fillCell_( matrix[0][j], 01017 veryBadScoreIndeed, 01018 veryBadScoreIndeed, 01019 v1_[j-1]+gapScore_); 01020 01021 } // ~for i 01022 // print (v1_); 01023 pLast_ = &v1_; 01024 pCurrent_ = &v2_; 01025 01026 01027 // Fill in next bandExtension_ columns 01028 01029 for ( i=1 ; i <= bandExtension_ ; i++ ) // NB <= not < 01030 { 01031 // cout << "doing leftmost columns" << i << endl; 01032 01033 lastScore = fillCell_( matrix[i][bandExtension_-i], 01034 veryBadScoreIndeed, 01035 (*pLast_)[bandExtension_-i+1]+gapScore_, 01036 veryBadScoreIndeed ); 01037 (*pCurrent_)[bandExtension_-i]=lastScore; 01038 for ( j=bandExtension_-i+1; j < colSize_-1 ; j++) 01039 { 01040 lastScore = fillCell_ 01041 ( matrix[i][j], 01042 (*pLast_)[j] 01043 + getScore_(p1_[i-1],p2_[j-bandExtension_+i-1]), 01044 // + ((tolower(p1_[i-1])==tolower(p2_[j-bandExtension_+i-1])) 01045 // ? matchScore : mismatchScore), 01046 (*pLast_)[j+1] + gapScore_, 01047 lastScore + gapScore_ ); 01048 (*pCurrent_)[j] = lastScore; 01049 } // ~for j 01050 01051 (*pCurrent_)[j] = fillCell_ 01052 ( matrix[i][j], 01053 (*pLast_)[j] 01054 + getScore_(p1_[i-1],p2_[j-bandExtension_+i-1]), 01055 // + ((tolower(p1_[i-1])==tolower(p2_[j-bandExtension_+i-1])) ? 01056 // matchScore : mismatchScore), 01057 veryBadScoreIndeed, 01058 lastScore + gapScore_ ); 01059 // print (*pCurrent_); 01060 temp_ = pCurrent_; pCurrent_ = pLast_; pLast_ = temp_; 01061 } // ~for i 01062 01063 01064 // Fill in main set of columns 01065 for ( i=(bandExtension_+1) ; 01066 i < bandLength_ -bandExtension_; 01067 i++ ) 01068 { 01069 // cout << "doing centre columns" << i << endl; 01070 01071 lastScore = veryBadScoreIndeed; 01072 01073 for ( j=0; j < colSize_-1 ; j++) 01074 { 01075 lastScore = fillCell_ 01076 ( matrix[i][j], 01077 (*pLast_)[j] 01078 + getScore_(p1_[i-1],p2_[j-bandExtension_+i-1]), 01079 // + ((tolower(p1_[i-1])==tolower(p2_[j-bandExtension_+i-1])) 01080 // ? matchScore : mismatchScore), 01081 (*pLast_)[j+1] + gapScore_, 01082 lastScore + gapScore_ ); 01083 (*pCurrent_)[j]=lastScore; 01084 } // ~for j 01085 01086 (*pCurrent_)[j] = fillCell_ 01087 ( matrix[i][j], 01088 (*pLast_)[j] 01089 + getScore_(p1_[i-1],p2_[j-bandExtension_+i-1]), 01090 // + ((tolower(p1_[i-1])==tolower(p2_[j-bandExtension_+i-1])) 01091 // ? matchScore : mismatchScore), 01092 veryBadScoreIndeed, 01093 lastScore + gapScore_ ); 01094 // print (*pCurrent_); 01095 temp_ = pCurrent_; pCurrent_ = pLast_; pLast_ = temp_; 01096 01097 } // ~for i 01098 01099 // Fill in last bandExtension_ columns; 01100 01101 01102 for ( i=bandLength_-bandExtension_ ; i < bandLength_ ; i++ ) 01103 { 01104 // cout << "doing rightmost columns" << i << endl; 01105 01106 lastScore = veryBadScoreIndeed; 01107 01108 for ( j=0; j < colSize_-1-i-bandExtension_+bandLength_ ; j++) 01109 { 01110 lastScore = fillCell_ 01111 ( matrix[i][j], 01112 (*pLast_)[j] 01113 + getScore_(p1_[i-1],p2_[j-bandExtension_+i-1]), 01114 // + ((tolower(p1_[i-1]) 01115 // ==tolower(p2_[j-bandExtension_+i-1])) 01116 // ? matchScore : mismatchScore), 01117 (*pLast_)[j+1] + gapScore_, 01118 lastScore + gapScore_ ); 01119 (*pCurrent_)[j]=lastScore; 01120 } // ~for j 01121 // print (*pCurrent_); 01122 temp_ = pCurrent_; pCurrent_ = pLast_; pLast_ = temp_; 01123 01124 } // ~for i 01125 01126 // Set position of the last cell filled in ready for 01127 // the traceback 01128 matrix.lastCell_.first 01129 = matrix.end()-1; 01130 matrix.lastCell_.second 01131 = matrix.lastCell_.first->begin() + (colSize_-bandExtension_-1); 01132 01133 return (*pLast_)[colSize_-bandExtension_-1]; 01134 01135 } // ~void ColumnFillerBasic::operator()
const char* ColumnFillerBasic::p1_ [private] |
Definition at line 648 of file MatchAligner.h.
Referenced by ColumnFiller3D::ColumnFiller3D(), and operator()().
const char* ColumnFillerBasic::p2_ [private] |
Definition at line 649 of file MatchAligner.h.
Referenced by ColumnFiller3D::ColumnFiller3D(), and operator()().
int ColumnFillerBasic::bandExtension_ [private] |
const int ColumnFillerBasic::bandWidth_ [private] |
Definition at line 651 of file MatchAligner.h.
const int ColumnFillerBasic::bandLength_ [private] |
const int ColumnFillerBasic::colSize_ [private] |
CellFiller ColumnFillerBasic::fillCell_ [private] |
vector<ScoreType> ColumnFillerBasic::v1_ [private] |
vector<ScoreType> ColumnFillerBasic::v2_ [private] |
vector<ScoreType>* ColumnFillerBasic::pLast_ [private] |
vector<ScoreType>* ColumnFillerBasic::pCurrent_ [private] |
vector<ScoreType>* ColumnFillerBasic::temp_ [private] |
ScoreMaker ColumnFillerBasic::getScore_ [private] |
ScoreType ColumnFillerBasic::gapScore_ [private] |
1.5.2