QueryManager/MatchAligner.cpp File Reference

#include "MatchAligner.h"
#include "SequenceReader.h"
#include "SequenceEncoder.h"
#include <iomanip>

Include dependency graph for MatchAligner.cpp:

Go to the source code of this file.

Functions

void makeScoreTableDNA (ScoreTable &table)
void makeScoreTableBlosum62 (ScoreTable &table)
void print (vector< ScoreType > &v)
void print (PathMatrix< PathType > &p)


Function Documentation

void makeScoreTableBlosum62 ( ScoreTable table  ) 

Definition at line 461 of file MatchAligner.cpp.

References blosumResidues, blosumScores, gapExtendScoreBLOSUM, gapStartScoreBLOSUM, numBlosumResidues, and stopCodonScoreBLOSUM.

00462 {
00463 
00464   uchar a[2];
00465   unsigned short* b = (unsigned short*) &a[0];
00466 
00467   const ScoreType* pScore = blosumScores;
00468 
00469 
00470   for (int i(0); i < numBlosumResidues; i++ )
00471   {
00472     for (int j(0); j < i; j++ )
00473     {
00474       //      cout << i << " " << j << endl; 
00475 
00476       // a[0] = uc, a[1] = uc
00477       a[0]=blosumResidues[i]; a[1]=blosumResidues[j]; table[ *b ] = *pScore;
00478       //      cout << a[0] << a[1] << " " table[ *b ] << endl;
00479       // a[0] = uc, a[1] = lc
00480       a[1]=tolower(a[1]); table[ *b ] = *pScore;
00481       // a[0] = lc, a[1] = lc
00482       a[0]=tolower(a[0]); table[ *b ] = *pScore;
00483       // a[0] = lc, a[1] = uc
00484       a[1]=toupper(a[1]); table[ *b ] = *pScore;
00485 
00486       a[0]=blosumResidues[j]; a[1]=blosumResidues[i]; table[ *b ] = *pScore;
00487       a[1]=tolower(a[1]); table[ *b ] = *pScore;
00488       a[0]=tolower(a[0]); table[ *b ] = *pScore;
00489       a[1]=toupper(a[1]); table[ *b ] = *pScore;
00490      
00491       ++pScore;
00492     } // ~for j
00493 
00494     a[0] = blosumResidues[i];
00495     a[1] = blosumResidues[i]; table[ *b ] = (*pScore); // a0=uc, a1=uc
00496     a[1] = tolower(a[1]); table[ *b ] = (*pScore);  // a0=uc, a1=lc
00497     a[1] = '*'; table[ *b ] = stopCodonScoreBLOSUM; // a0=uc, a1=*
00498     a[1] = '-'; table[ *b ] = gapStartScoreBLOSUM;  // a0=uc, a1=-
00499 
00500     a[0] = tolower(a[0]); 
00501     a[1] = blosumResidues[i]; table[ *b ] = (*pScore); // a0=lc, a1=uc
00502     a[1] = tolower(a[1]); table[ *b ] = (*pScore);  // a0=lc, a1=lc
00503     a[1] = '*'; table[ *b ] = stopCodonScoreBLOSUM; // a0=lc, a1=*
00504     a[1] = '-'; table[ *b ] = gapStartScoreBLOSUM;  // a0=lc, a1=-
00505 
00506     a[1] = blosumResidues[i];
00507     a[0] = '*'; table[ *b ] = stopCodonScoreBLOSUM; // a0=*, a1=uc
00508     a[0] = '-'; table[ *b ] = gapStartScoreBLOSUM;  // a0=-, a1=uc
00509 
00510     a[1] = tolower(a[1]);
00511     a[0] = '*'; table[ *b ] = stopCodonScoreBLOSUM; // a0=*, a1=lc
00512     a[0] = '-'; table[ *b ] = gapStartScoreBLOSUM;  // a0=-, a1=lc
00513 
00514     ++pScore;
00515   } // ~for i
00516 
00517   a[0] = '*'; a[1] = '*'; table[ *b ] = 1;
00518   a[0] = '*'; a[1] = '-'; table[ *b ] = gapStartScoreBLOSUM;
00519   a[0] = '-'; a[1] = '*'; table[ *b ] = gapStartScoreBLOSUM;
00520   a[0] = '-'; a[1] = '-'; table[ *b ] = gapExtendScoreBLOSUM;
00521 
00522 } // ~void makeScoreTableBlosum62( ScoreTable& table )

void makeScoreTableDNA ( ScoreTable table  ) 

Definition at line 401 of file MatchAligner.cpp.

References gapExtendScoreDNA, gapStartScoreDNA, matchScoreDNA, mismatchScoreDNA, and nScoreDNA.

00402 {
00403 
00404   uchar a[2];
00405   unsigned short* b = (unsigned short*) &a[0];
00406   //  a[0]=0; a[1]=0;
00407 
00408   const char base[] = {"agct"};
00409 
00410   ScoreType thisScore;
00411   for (int i(0); i < 4; i++ )
00412   {
00413     for (int j(0); j < 4; j++ )
00414     {
00415       thisScore = ((i==j) ? matchScoreDNA: mismatchScoreDNA);
00416       a[0]=base[i]; a[1] = base[j]; table[ *b ] = thisScore;
00417       a[1] = toupper(base[j]); table[ *b ] = thisScore;
00418       a[0]=toupper(base[i]); a[1] = base[j]; table[ *b ] = thisScore;
00419       a[1] = toupper(base[j]); table[ *b ] = thisScore;
00420     } // ~for j
00421 
00422     a[0]=base[i];  
00423     a[1] = 'n'; table[ *b ] = nScoreDNA;
00424     a[1] = 'N'; table[ *b ] = nScoreDNA;
00425     a[1] = '-'; table[ *b ] = gapStartScoreDNA;
00426 
00427     a[0]=toupper(base[i]);  
00428     a[1] = 'n'; table[ *b ] = nScoreDNA;
00429     a[1] = 'N'; table[ *b ] = nScoreDNA;
00430     a[1] = '-'; table[ *b ] = gapStartScoreDNA;
00431 
00432     a[1]=base[i];  
00433     a[0] = 'n'; table[ *b ] = nScoreDNA;
00434     a[0] = 'N'; table[ *b ] = nScoreDNA;
00435     a[0] = '-'; table[ *b ] = gapStartScoreDNA;
00436 
00437     a[1]=toupper(base[i]);  
00438     a[0] = 'n'; table[ *b ] = nScoreDNA;
00439     a[0] = 'N'; table[ *b ] = nScoreDNA;
00440     a[0] = '-'; table[ *b ] = gapStartScoreDNA;
00441     
00442 
00443 
00444   } // ~for i;
00445 
00446     a[0]='n'; a[1] = 'n'; table[ *b ] = nScoreDNA;
00447     a[0]='n'; a[1] = 'N'; table[ *b ] = nScoreDNA;
00448     a[0]='N'; a[1] = 'n'; table[ *b ] = nScoreDNA;
00449     a[0]='N'; a[1] = 'N'; table[ *b ] = nScoreDNA;
00450 
00451     a[0]='-'; a[1] = 'n'; table[ *b ] = gapStartScoreDNA;
00452     a[0]='-'; a[1] = 'N'; table[ *b ] = gapStartScoreDNA;
00453     a[0]='n'; a[1] = '-'; table[ *b ] = gapStartScoreDNA;
00454     a[0]='N'; a[1] = '-'; table[ *b ] = gapStartScoreDNA;
00455 
00456     a[0]='-'; a[1] = '-'; table[ *b ] = gapExtendScoreDNA;
00457 
00458 } // ~void makeScoreTableDNA( ScoreTable& table )

void print ( PathMatrix< PathType > &  p  ) 

Definition at line 984 of file MatchAligner.cpp.

References fromN, fromSW, and fromW.

00985 {
00986   for (int i(0); i< p.front().size(); i++)
00987   {
00988     for (vector<vector<PathType> >::iterator j(p.begin());
00989          j!=p.end();++j)
00990     {
00991       cout << (((*j)[i] & fromW)?'-':'.')
00992            << (((*j)[i] & fromSW)?'/':'.') 
00993            << (((*j)[i] & fromN)?'|':'.') 
00994            << "\t";
00995     } // ~for j   
00996     cout << endl;
00997   } // ~for i
00998 
00999 } // ~print

void print ( vector< ScoreType > &  v  ) 

Definition at line 976 of file MatchAligner.cpp.

Referenced by main().

00977 {
00978   for( vector<ScoreType>::iterator i(v.begin());i!=v.end();++i)
00979     cout << "Score: " << *i << endl;
00980 
00981 }

Here is the caller graph for this function:


Generated on Fri Dec 21 13:14:12 2007 for ssaha by  doxygen 1.5.2