MatchAlignerTranslated Class Reference

#include <MatchAligner.h>

Inheritance diagram for MatchAlignerTranslated:

Inheritance graph
[legend]
Collaboration diagram for MatchAlignerTranslated:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MatchAlignerTranslated (int numCols, int bandExtension, bool isQueryProtein, bool isSubjectProtein, ostream &outputStream)
void codonize (const char *pSeq, int seqSize, int finalFrame, vector< vector< char > > &translatedSeqs)
virtual void createAlignment (Alignment &alignment, const char *pQuery, int queryStart, int queryEnd, const char *pSubject, int subjectStart, int subjectEnd)

Static Public Member Functions

static char getCodon (const char *pChar)

Protected Attributes

bool isQueryProtein_
bool isSubjectProtein_

Detailed Description

Definition at line 297 of file MatchAligner.h.


Constructor & Destructor Documentation

MatchAlignerTranslated::MatchAlignerTranslated ( int  numCols,
int  bandExtension,
bool  isQueryProtein,
bool  isSubjectProtein,
ostream &  outputStream 
)

Definition at line 525 of file MatchAligner.cpp.

00529                             :
00530   MatchAligner( numCols, 
00531                 bandExtension,
00532                 tableBlosum62_.getTable(), 
00533                 outputStream ),
00534   isQueryProtein_(isQueryProtein),
00535   isSubjectProtein_(isSubjectProtein)
00536 {
00537 
00538 } // ~MatchAlignerTranslated::MatchAlignerTranslated


Member Function Documentation

void MatchAlignerTranslated::codonize ( const char *  pSeq,
int  seqSize,
int  finalFrame,
vector< vector< char > > &  translatedSeqs 
)

Definition at line 542 of file MatchAligner.cpp.

References gNumReadingFrames, gResidueNames, nv(), ttCodon, and ttDNA.

00546 {
00547   translatedSeqs.resize(gNumReadingFrames);
00548   translatedSeqs[0].resize(seqSize);
00549   translatedSeqs[1].resize(seqSize - (finalFrame==0));
00550   translatedSeqs[2].resize(seqSize - (finalFrame!=2));
00551   //  cout << "codonizing: " << seqSize << endl;
00552   const char* pChar;
00553   vector<char>::iterator i;
00554 
00555   for (int j(0); j < gNumReadingFrames; j++ )
00556   {
00557     pChar = pSeq+j;
00558     for (i=translatedSeqs[j].begin(); 
00559          i!=translatedSeqs[j].end(); i++, 
00560          pChar+=gNumReadingFrames )
00561     {    
00562       //       cout << *pChar << *(pChar+1) << *(pChar+2) << endl;
00563       //  cout << int ( ttDNA[ *(pChar++ ] << 4
00564       //     | (ttDNA[ *(pChar++) ] << 2)
00565       //     | ttDNA[ *(pChar++) ] ) << endl; 
00566       if (    (ttDNA[ *(pChar)   ]==nv)
00567            || (ttDNA[ *(pChar+1) ]==nv)
00568            || (ttDNA[ *(pChar+2) ]==nv) )
00569       { 
00570         *i='X';
00571       } // ~if   
00572       else
00573       {
00574         *i= gResidueNames[ ttCodon[ ttDNA[ *(pChar) ] << 4
00575                                   | ttDNA[ *(pChar+1) ] << 2
00576                                   | ttDNA[ *(pChar+2) ] ] ];
00577       } // ~else
00578 
00579     } // ~for i
00580 
00581   } // ~for j
00582 
00583 } // ~MatchAlignerTranslated::codonize

Here is the call graph for this function:

void MatchAlignerTranslated::createAlignment ( Alignment alignment,
const char *  pQuery,
int  queryStart,
int  queryEnd,
const char *  pSubject,
int  subjectStart,
int  subjectEnd 
) [virtual]

Reimplemented from MatchAligner.

Definition at line 587 of file MatchAligner.cpp.

References MatchAligner::bandExtension_, codonize(), PathMatrix< PATH_TYPE >::fillIn(), gNumReadingFrames, MatchAligner::pTable_, Alignment::totalScore_, and PathMatrix< PATH_TYPE >::traceBack().

00590 {
00591   PathMatrix<PathType3D> path;
00592 
00593   int queryFinalFrame(0);
00594   int subjectFinalFrame(0);
00595 
00596   int querySize(queryEnd-queryStart+1);
00597   int subjectSize(subjectEnd-subjectStart+1);
00598 
00599   vector<vector<char> > queryTranslated;
00600   vector<vector<char> > subjectTranslated;
00601   const char* pQueryTrans[gNumReadingFrames] = 
00602   { pQuery, NULL, NULL };
00603   const char* pSubjectTrans[gNumReadingFrames] =
00604   { pSubject, NULL, NULL };
00605 
00606   //  AlignBreakType p1Gap, p2Gap;
00607   //  int p1FinalFrame, p2FinalFrame;
00608   bool p1IsQuery;
00609 
00610 
00611   if (!isQueryProtein_)
00612   {
00613     queryFinalFrame = querySize % gNumReadingFrames;
00614     querySize /= gNumReadingFrames;
00615     codonize( pQuery, querySize, queryFinalFrame, queryTranslated );
00616     queryTranslated[1].push_back(0);
00617     queryTranslated[2].push_back(0);
00618     pQueryTrans[0] = static_cast<const char*>(&*queryTranslated[0].begin());
00619     pQueryTrans[1] = static_cast<const char*>(&*queryTranslated[1].begin());
00620     pQueryTrans[2] = static_cast<const char*>(&*queryTranslated[2].begin());
00621   } // ~if
00622 
00623   if (!isSubjectProtein_)
00624   {
00625     subjectFinalFrame = subjectSize % gNumReadingFrames;
00626     subjectSize /= gNumReadingFrames;
00627     codonize( pSubject, subjectSize, subjectFinalFrame, subjectTranslated );
00628     subjectTranslated[1].push_back(0);
00629     subjectTranslated[2].push_back(0);
00630     pSubjectTrans[0]= static_cast<const char*>(&*subjectTranslated[0].begin());
00631     pSubjectTrans[1]= static_cast<const char*>(&*subjectTranslated[1].begin());
00632     pSubjectTrans[2]= static_cast<const char*>(&*subjectTranslated[2].begin());
00633   } // ~if
00634 
00635   if (querySize<=subjectSize)
00636   { // then p1 = query, p2 = subject
00637     p1IsQuery = true;
00638     ColumnFiller3D doMatrix( pQueryTrans, querySize, queryFinalFrame,
00639                              pSubjectTrans, subjectSize, subjectFinalFrame,
00640                              bandExtension_, *pTable_ ); 
00641     alignment.totalScore_ = path.fillIn(doMatrix);
00642 
00643   } // ~if
00644   else
00645   { // p1 = subject, p2 = query
00646     p1IsQuery = false;
00647     ColumnFiller3D doMatrix( pSubjectTrans, subjectSize, subjectFinalFrame,
00648                              pQueryTrans, querySize, queryFinalFrame,
00649                              bandExtension_, *pTable_ ); 
00650     alignment.totalScore_ = path.fillIn(doMatrix);
00651 
00652   } // ~else
00653 
00654   TraceBacker3D doCell( queryFinalFrame, subjectFinalFrame, 
00655                         p1IsQuery, alignment );
00656   path.traceBack(doCell); 
00657   //  path.traceBack(doCell, bandExtension_, 
00658   //     fabs(subjectSize-querySize)+bandExtension_); // 0 = band ext
00659 
00660   if (!isQueryProtein_)
00661   {
00662     queryTranslated[1].pop_back();
00663     queryTranslated[2].pop_back();
00664   }
00665   if (!isSubjectProtein_)
00666   {
00667     subjectTranslated[1].pop_back();
00668     subjectTranslated[2].pop_back();
00669   }
00670 
00671 } // ~void MatchAlignerTranslated::createAlignment

Here is the call graph for this function:

static char MatchAlignerTranslated::getCodon ( const char *  pChar  )  [inline, static]

Definition at line 316 of file MatchAligner.h.

References gResidueNames, nv(), ttCodon, and ttDNA.

00317   {
00318     return (  (    (ttDNA[ *pChar ] ==nv)
00319                    || (ttDNA[ *(pChar+1) ] ==nv)
00320                    || (ttDNA[ *(pChar+2) ] ==nv) )
00321               ? 'X'
00322               : gResidueNames[ ttCodon[ ttDNA[ *(pChar) ] << 4
00323                                       | ttDNA[ *(pChar+1) ] << 2
00324                                       | ttDNA[ *(pChar+2) ] ] ] );
00325   } // ~getCodon

Here is the call graph for this function:


Member Data Documentation

bool MatchAlignerTranslated::isQueryProtein_ [protected]

Definition at line 329 of file MatchAligner.h.

bool MatchAlignerTranslated::isSubjectProtein_ [protected]

Definition at line 330 of file MatchAligner.h.


The documentation for this class was generated from the following files:
Generated on Fri Dec 21 13:18:25 2007 for ssaha by  doxygen 1.5.2