MatchAlgorithmUngapped Class Reference

#include <MatchStoreUngapped.h>

Inheritance diagram for MatchAlgorithmUngapped:

Inheritance graph
[legend]
Collaboration diagram for MatchAlgorithmUngapped:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MatchAlgorithmUngapped (int minToProcess, int numRepeats)
virtual void generateMatches (HitListVector &hitList, MatchAdder &addMatch)

Private Attributes

int minToProcess_

Detailed Description

Definition at line 58 of file MatchStoreUngapped.h.


Constructor & Destructor Documentation

MatchAlgorithmUngapped::MatchAlgorithmUngapped ( int  minToProcess,
int  numRepeats 
) [inline]

Definition at line 62 of file MatchStoreUngapped.h.

00062                                         :
00063     minToProcess_( minToProcess ),
00064     MatchAlgorithm( numRepeats )
00065     {}


Member Function Documentation

void MatchAlgorithmUngapped::generateMatches ( HitListVector hitList,
MatchAdder addMatch 
) [virtual]

Implements MatchAlgorithm.

Definition at line 65 of file MatchStoreUngapped.cpp.

References DEBUG_L2, and gNumReadingFrames.

00066   {
00067 
00068     //    HitListVector hitList;
00069     //    subjectTable.matchSequence( querySeq, hitList, numRepeats_ );
00070     //   subjectTable.setNumRepeats(numRepeats_);
00071     //  subjectTable.matchSequence( querySeq, hitList );
00072 
00073     if (dynamic_cast<MatchAdderCodonCodon*>(&addMatch)
00074         ||dynamic_cast<MatchAdderCodonProtein*>(&addMatch))
00075     {
00076       wordLength_ *= gNumReadingFrames; // %%%%%%%%%%%%%% these need to be
00077       stepLength_ *= gNumReadingFrames; // reset to do proteins again %%%
00078     }
00079 
00080     sort( hitList.begin(), hitList.end() );
00081 
00082     // for (HitListVector::iterator i(hitList.begin()); i != hitList.end();++i)
00083     //  DEBUG_L2( "hit "<<i->subjectNum<<" "<< i->diff << " " << i->queryPos );
00084 
00085     if ( hitList.size() == 0 ) return;
00086 
00087     HitListVector::const_iterator i ( hitList.begin() );
00088 
00089     int adjacentBases = wordLength_;
00090     SequenceNumber adjacentStart = i->queryPos;
00091     int basesToAdd;
00092 
00093     HitListVector::const_iterator lastHit( i );
00094     ++i;
00095 
00096     for (  ; i != hitList.end() ; ++i )
00097     {
00098 
00099       if (    ( i->subjectNum == lastHit->subjectNum )
00100            && ( i->diff == lastHit->diff ) )
00101       {
00102         /*
00103         if ( i->queryPos - lastHit->queryPos == stepLength_ )
00104           {
00105             adjacentBases += stepLength_;
00106           } // ~if
00107         */
00108         basesToAdd = i->queryPos - lastHit->queryPos;
00109         if (basesToAdd <= stepLength_) 
00110           // %%%% chg to stepLength + x to handle gaps in query
00111           {
00112             adjacentBases += basesToAdd;
00113           } // ~if
00114         
00115         else
00116         {
00117           if ( adjacentBases>=minToProcess_)
00118           {
00119             DEBUG_L2(lastHit->subjectNum << " " << 
00120                           adjacentBases << " " <<
00121                           adjacentStart << " " <<
00122                           adjacentStart + adjacentBases -1 << " " <<
00123                           adjacentStart + lastHit->diff << " " <<
00124                           adjacentStart + lastHit->diff + adjacentBases -1 );
00125 
00126             
00127             addMatch(     lastHit->subjectNum,
00128                           adjacentBases,
00129                           adjacentStart,
00130                           adjacentStart + adjacentBases -1,
00131                           adjacentStart + lastHit->diff,
00132                           adjacentStart + lastHit->diff + adjacentBases -1 );
00133           }
00134           adjacentStart = i->queryPos;
00135           adjacentBases = wordLength_;
00136         } // ~else
00137       }
00138       else
00139       {
00140         if( adjacentBases>=minToProcess_)
00141           {
00142             DEBUG_L2(lastHit->subjectNum << " " << 
00143                           adjacentBases << " " <<
00144                           adjacentStart << " " <<
00145                           adjacentStart + adjacentBases -1 << " " <<
00146                           adjacentStart + lastHit->diff << " " <<
00147                           adjacentStart + lastHit->diff + adjacentBases -1 );
00148           
00149                 addMatch(         lastHit->subjectNum,
00150                           adjacentBases,
00151                           adjacentStart,
00152                           adjacentStart + adjacentBases -1,
00153                           adjacentStart + lastHit->diff,
00154                           adjacentStart + lastHit->diff + adjacentBases -1 );
00155           }
00156            adjacentStart = i->queryPos;
00157            adjacentBases = wordLength_;
00158 
00159       } // ~else
00160       ++lastHit;
00161     } // ~for
00162     if (adjacentBases>=minToProcess_)
00163       {
00164             DEBUG_L2(lastHit->subjectNum << " " << 
00165                           adjacentBases << " " <<
00166                           adjacentStart << " " <<
00167                           adjacentStart + adjacentBases -1 << " " <<
00168                           adjacentStart + lastHit->diff << " " <<
00169                           adjacentStart + lastHit->diff + adjacentBases -1 );
00170 
00171         addMatch(                 lastHit->subjectNum,
00172                           adjacentBases,
00173                           adjacentStart,
00174                           adjacentStart + adjacentBases -1,
00175                           adjacentStart + lastHit->diff,
00176                           adjacentStart + lastHit->diff + adjacentBases -1 );
00177       }
00178     return;
00179 
00180   } // ~findMatch


Member Data Documentation

int MatchAlgorithmUngapped::minToProcess_ [private]

Definition at line 72 of file MatchStoreUngapped.h.


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