00001 /* $Id: blast_dbindex.hpp 109755 2007-08-31 12:23:13Z camacho $ 00002 * =========================================================================== 00003 * 00004 * PUBLIC DOMAIN NOTICE 00005 * National Center for Biotechnology Information 00006 * 00007 * This software/database is a "United States Government Work" under the 00008 * terms of the United States Copyright Act. It was written as part of 00009 * the author's official duties as a United States Government employee and 00010 * thus cannot be copyrighted. This software/database is freely available 00011 * to the public for use. The National Library of Medicine and the U.S. 00012 * Government have not placed any restriction on its use or reproduction. 00013 * 00014 * Although all reasonable efforts have been taken to ensure the accuracy 00015 * and reliability of the software and data, the NLM and the U.S. 00016 * Government do not and cannot warrant the performance or results that 00017 * may be obtained by using this software or data. The NLM and the U.S. 00018 * Government disclaim all warranties, express or implied, including 00019 * warranties of performance, merchantability or fitness for any particular 00020 * purpose. 00021 * 00022 * Please cite the author in any work or product based on this material. 00023 * 00024 * =========================================================================== 00025 * 00026 * Author: Aleksandr Morgulis 00027 * 00028 */ 00029 00030 /// @file blast_dbindex.hpp 00031 /// Declarations for indexed blast databases 00032 00033 #ifndef ALGO_BLAST_API___BLAST_DBINDEX__HPP 00034 #define ALGO_BLAST_API___BLAST_DBINDEX__HPP 00035 00036 #include <algo/blast/core/blast_seqsrc.h> 00037 #include <algo/blast/core/blast_seqsrc_impl.h> 00038 #include <algo/blast/core/lookup_wrap.h> 00039 #include <algo/blast/core/blast_filter.h> 00040 00041 #include <algo/blast/api/blast_types.hpp> 00042 00043 BEGIN_NCBI_SCOPE 00044 BEGIN_SCOPE(blast) 00045 00046 /** Wrap a BlastSeqSrc object db by another object that provides index based 00047 seed searching. 00048 00049 @param indexname Name of the file containing index data. 00050 @param db Blast database object. 00051 @return New BlastSeqSrc object the is a wrapper around the original one. 00052 */ 00053 00054 BlastSeqSrc * DbIndexSeqSrcInit( const string & indexname, BlastSeqSrc * db ); 00055 00056 /** Creates a clone of a BlastSeqSrc structure. 00057 00058 @param src Original sequence source. 00059 00060 @return New BlastSeqSrc object initialized with elements of the given one. 00061 */ 00062 00063 BlastSeqSrc * CloneSeqSrcInit( BlastSeqSrc * src ); 00064 00065 /** Copies the contents of src to dst. 00066 00067 @param dst destination BlastSeqSrc object 00068 @param src source BlastSeqSrc object 00069 */ 00070 00071 void CloneSeqSrc( BlastSeqSrc * dst, BlastSeqSrc * src ); 00072 00073 /** Get minimal word size accepted by indexing library. 00074 */ 00075 00076 int MinIndexWordSize(); 00077 00078 /** Type of a callback that is called to invoke index based search. 00079 00080 @param seq_src Indexed database source object. 00081 @param lt_wrap Wrapper for CIndexedDb. 00082 @param queries Queries descriptor. 00083 @param locs Unmasked intervals of queries. 00084 @param lut_options Lookup table parameters, like target word size. 00085 @param word_options Contains window size of two-hits based search. 00086 */ 00087 typedef void (*DbIndexPreSearchFnType)( 00088 BlastSeqSrc * seq_src, LookupTableWrap * lt_wrap, 00089 BLAST_SequenceBlk * queries, BlastSeqLoc * locs, 00090 LookupTableOptions * lut_options, 00091 BlastInitialWordOptions * word_options ); 00092 00093 /** Return the appropriate pre-search callback. 00094 00095 @return No-op function if indexing is not being used; 00096 otherwise - the appropriate callback. 00097 */ 00098 extern DbIndexPreSearchFnType GetDbIndexPreSearchFn(); 00099 00100 //------------------------------------------------------------------------------ 00101 /// Index wrapper exceptions. 00102 class CIndexedDbException : public CException 00103 { 00104 public: 00105 00106 /// Error types that BLAST can generate 00107 enum EErrCode { 00108 eIndexInitError ///< Index initialization error. 00109 }; 00110 00111 /// Translate from the error code value to its string representation 00112 virtual const char* GetErrCodeString(void) const { 00113 switch ( GetErrCode() ) { 00114 case eIndexInitError: return "eIndexInitError"; 00115 default: return CException::GetErrCodeString(); 00116 } 00117 } 00118 00119 NCBI_EXCEPTION_DEFAULT( CIndexedDbException, CException ); 00120 }; 00121 00122 //------------------------------------------------------------------------------ 00123 /// Type of a callback to set the query information in the index structure. 00124 /// @param seq_src sequence source (index) 00125 /// @param lt_wrap lookup table wrapper object 00126 /// @param locs_wrap lookup (unmasked) segments 00127 typedef void (*DbIndexSetQueryInfoFnType)( 00128 BlastSeqSrc * seq_src, 00129 LookupTableWrap * lt_wrap, 00130 CRef< CBlastSeqLocWrap > locs_wrap ); 00131 00132 /// Return the appropriate callback to set query information in the index. 00133 /// @return No-op function if indexing is not being used; 00134 /// otherwise - the appropriate callback. 00135 extern DbIndexSetQueryInfoFnType GetDbIndexSetQueryInfoFn(); 00136 00137 //------------------------------------------------------------------------------ 00138 /// Type of a callback to run the indexed seed search. 00139 /// @param seq_src sequence source (index) 00140 /// @param queries query information structure 00141 /// @param lut_options lookup table parameters 00142 /// @param word_options word options 00143 typedef void (*DbIndexRunSearchFnType)( 00144 BlastSeqSrc * seq_src, BLAST_SequenceBlk * queries, 00145 LookupTableOptions * lut_options, 00146 BlastInitialWordOptions * word_options ); 00147 00148 /// Return the appropriate callback to run indexed seed search. 00149 /// @return No-op function if indexing is not being used; 00150 /// otherwise - the appropriate callback. 00151 extern DbIndexRunSearchFnType GetDbIndexRunSearchFn(); 00152 00153 //------------------------------------------------------------------------------ 00154 /// Type of a callback to set the number of threads for indexed seed search. 00155 /// @param seq_src sequence source (index) 00156 /// @param n_threads number of threads 00157 typedef void (*DbIndexSetNumThreadsFnType)( 00158 BlastSeqSrc * seq_src, size_t n_threads ); 00159 00160 /// Return the appropriate callback to set the number of threads for indexed 00161 /// seed search. 00162 /// @return No-op function if indexing is not being used; 00163 /// otherwise - the appropriate callback. 00164 extern DbIndexSetNumThreadsFnType GetDbIndexSetNumThreadsFn(); 00165 00166 END_SCOPE(blast) 00167 END_NCBI_SCOPE 00168 00169 #endif /* ALGO_BLAST_API___BLAST_DBINDEX__HPP */ 00170 00171 00172
1.4.6
Modified on Mon Dec 07 16:20:32 2009 by modify_doxy.py rev. 173732