QueryManager/MatchStoreGapped.h

Go to the documentation of this file.
00001 /*  Last edited: May 29 16:58 2002 (ac2) */
00002 
00003 // #######################################################################
00004 
00005 // SSAHA : Sequence Search and Alignment by Hashing Algorithm
00006 // Version 3.2, released 1st March 2004
00007 // Copyright (c) Genome Research 2002
00008 
00009 // SSAHA is free software; you can redistribute it and/or modify 
00010 // it under the terms of version 2 of the GNU General Public Licence
00011 // as published by the Free Software Foundation.
00012  
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public Licence for more details.
00017  
00018 // You should have received a copy of the GNU General Public Licence
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 // or see the on-line version at http://www.gnu.org/copyleft/gpl.txt
00022 
00023 // #######################################################################
00024 
00025 // Module Name  : QueryManagerSSAHA
00026 // File Name    : QueryManagerSSAHA.h
00027 // Language     : C++
00028 // Module Author: Anthony J. Cox (ac2@sanger.ac.uk)
00029 
00030 // Include guard:
00031 #ifndef INCLUDED_MatchStoreGapped
00032 #define INCLUDED_MatchStoreGapped
00033 
00034 // Description:
00035 
00036 // Includes:
00037 
00038 #include "QueryManager.h"
00039 #include "GlobalDefinitions.h"
00040 #include "HashTableGeneric.h" // %%%%%
00041 #include "MatchStore.h"
00042 #include <vector>
00043 #include <string>
00044 #include <utility> // ... for 'pair'
00045 #include <map>
00046 #include <iosfwd>
00047 // NB it is good practise for #include statements in header files to be
00048 // replaced by forward declarations if at all possible
00049 
00050 
00051 // ### Class Declarations ###
00052 
00053 // MatchAlgorithm and subclasses
00054 
00055 class HitListVector;
00056 class MatchAlgorithm
00057 {
00058  public:
00059   MatchAlgorithm( int numRepeats ) : 
00060     numRepeats_( numRepeats ), sortNeeded_(true) {}
00061   void operator()  
00062     ( WordSequence& querySeq, 
00063       MatchAdder& addMatch, 
00064       HashTableGeneric& subjectTable, 
00065       int wordLength = -1, 
00066       int stepLength = -1);
00067   void generateHits( WordSequence& querySeq, HitListVector& hitList,
00068                      HashTableGeneric& subjectTable );
00069   virtual void generateMatches  
00070     ( HitListVector& hitList, MatchAdder& addMatch )=0;
00071 
00072  protected:
00073   bool sortNeeded_;
00074   int numRepeats_;
00075   int wordLength_;
00076   int stepLength_;
00077 };
00078 
00079 
00080 class MatchAlgorithmGapped : public MatchAlgorithm
00081 {
00082  public:
00083   MatchAlgorithmGapped
00084     ( int maxGap, int maxInsert, int minToProcess, int numRepeats ):
00085     maxGap_( maxGap ),
00086     maxInsert_( maxInsert ), 
00087     minToProcess_( minToProcess ),
00088     MatchAlgorithm( numRepeats )
00089     {}
00090 
00091   virtual void generateMatches
00092   ( HitListVector& hitList, MatchAdder& addMatch );
00093 
00094   void findMatchesInRange
00095   ( HitListVector::iterator first, HitListVector::iterator last,
00096     MatchAdder& addMatch );
00097 
00098 
00099  private:
00100   int maxGap_;
00101   int maxInsert_;
00102   int minToProcess_;
00103   int maxQueryDiff_;
00104   int minHitsForMatch_;
00105   // At least this number of hits are necessary to get a match
00106   // of length minToProcess_
00107   // exact figure is 1+( minToProcess_ - wordLength_ )/stepLength_
00108 
00109 
00110 };
00111 
00112 
00113 
00114 
00115 // ### Function Declarations ###
00116 
00117 // Name:
00118 // Arguments:
00119 // TYPE  NAME  IN/OUT COMMENT
00120 // Returns: TYPE COMMENT
00121 
00122 // End of include guard:
00123 #endif
00124 
00125 // End of file MatchStoreGapped.h
00126 
00127 
00128 
00129 

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