NCBI C++ ToolKit
local_blast.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: local_blast.hpp 92315 2021-01-07 14:43:40Z merezhuk $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Christiam Camacho, Kevin Bealer
27  *
28  */
29 
30 /** @file local_blast.hpp
31  * Main class to perform a BLAST search on the local machine.
32  */
33 
34 #ifndef ALGO_BLAST_API___LOCAL_BLAST_HPP
35 #define ALGO_BLAST_API___LOCAL_BLAST_HPP
36 
40 
41 /** @addtogroup AlgoBlast
42  *
43  * @{
44  */
45 class CBlastFilterTest;
46 
48 BEGIN_SCOPE(blast)
49 
50 /// Returns the optimal chunk size for a given task
51 /// @param program BLAST task [in]
53 size_t
55 
56 /// Class to perform a BLAST search on local BLAST databases
57 /// Note that PHI-BLAST can be run using this class also, one only need to
58 /// configure it as a regular blastp or blastn search and set the pattern in
59 /// the CBlastOptionsHandle object
60 /// @todo should RPS-BLAST be moved out of this object?
62 {
63 public:
64  /// Constructor with database description
65  /// @param query_factory query sequence(s) [in]
66  /// @param opts_handle BLAST options handle [in]
67  /// @param dbinfo description of BLAST database to search [in]
68  CLocalBlast(CRef<IQueryFactory> query_factory,
69  CRef<CBlastOptionsHandle> opts_handle,
70  const CSearchDatabase& dbinfo);
71 
72  /// Constructor with subject adapter (@sa CLocalDbAdapter)
73  /// @param query_factory query sequence(s) [in]
74  /// @param opts_handle BLAST options handle [in]
75  /// @param db subject adapter [in]
76  CLocalBlast(CRef<IQueryFactory> query_factory,
77  CRef<CBlastOptionsHandle> opts_handle,
79 
80  /// Constructor with database description
81  /// @param query_factory query sequence(s) [in]
82  /// @param opts_handle BLAST options handle [in]
83  /// @param seqsrc BlastSeqSrc object to search [in]
84  /// @param seqInfoSrc user-specified IBlastSeqInfoSrc [in]
85  CLocalBlast(CRef<IQueryFactory> query_factory,
86  CRef<CBlastOptionsHandle> opts_handle,
87  BlastSeqSrc* seqsrc,
88  CRef<IBlastSeqInfoSrc> seqInfoSrc);
89 
90  /// Executes the search
92 
93  /// Set a function callback to be invoked by the CORE of BLAST to allow
94  /// interrupting a BLAST search in progress.
95  /// @param fnptr pointer to callback function [in]
96  /// @param user_data user data to be attached to SBlastProgress structure
97  /// [in]
98  /// @return the previously set TInterruptFnPtr (NULL if none was
99  /// provided before)
101  void* user_data = NULL) {
102  _ASSERT(m_PrelimSearch);
103  return m_PrelimSearch->SetInterruptCallback(fnptr, user_data);
104  }
105 
106  /// Retrieve any error/warning messages that occurred during the search
107  TSearchMessages GetSearchMessages() const;
108 
109  /// Retrieve the number of extensions performed during the search
110  Int4 GetNumExtensions();
111 
112  /// Get the diagnostics structure (deep copy, needs to be deleted by caller)
113  BlastDiagnostics* GetDiagnostics();
114 
115  // set batch number
116  void SetBatchNumber( int batch_num ) {
117  m_batch_num_str = string("B") + NStr::NumericToString( batch_num );
118  }
119 
120 private:
121  /// Query factory from which to obtain the query sequence data
123 
124  /// Options to use
126 
127  /// Internal core data structures which are used in the preliminary and
128  /// traceback stages of the search
130 
131  /// Object which runs the preliminary stage of the search
133 
134  /// Object which runs the traceback stage of the search
136 
137  /// Local DB adaptor (if one was) passed to constructor.
139 
140  /// User-specified IBlastSeqInfoSrc implementation
141  /// (may be used for non-standard databases, etc.)
143 
144  /// Warnings and error messages
146 
147  // current batch number
149 
150  friend class ::CBlastFilterTest;
151  friend class CBl2Seq;
152 };
153 
154 inline TSearchMessages
156 {
157  return m_Messages;
158 }
159 
160 END_SCOPE(BLAST)
162 
163 /* @} */
164 
165 #endif /* ALGO_BLAST_API___LOCAL_BLAST__HPP */
Boolean(* TInterruptFnPtr)(SBlastProgress *progress_info)
Prototype for function pointer to determine whether the BLAST search should proceed or be interrupted...
Definition: blast_def.h:354
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
Defines interface for retrieving sequence identifiers.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
Definition: blast_types.hpp:56
Runs the BLAST algorithm between 2 sequences.
Definition: bl2seq.hpp:58
Class to perform a BLAST search on local BLAST databases Note that PHI-BLAST can be run using this cl...
Definition: local_blast.hpp:62
CObject –.
Definition: ncbiobj.hpp:180
Blast Search Subject.
Class that supports setting the number of threads to use with a given algorithm.
typedef for the messages for an entire BLAST search, which could be comprised of multiple query seque...
CRef< IBlastSeqInfoSrc > m_SeqInfoSrc
User-specified IBlastSeqInfoSrc implementation (may be used for non-standard databases,...
CRef< SInternalData > m_InternalData
Internal core data structures which are used in the preliminary and traceback stages of the search.
CRef< CBlastPrelimSearch > m_PrelimSearch
Object which runs the preliminary stage of the search.
void SetBatchNumber(int batch_num)
CRef< CBlastOptions > m_Opts
Options to use.
TSearchMessages m_Messages
Warnings and error messages.
TInterruptFnPtr SetInterruptCallback(TInterruptFnPtr fnptr, void *user_data=NULL)
Set a function callback to be invoked by the CORE of BLAST to allow interrupting a BLAST search in pr...
TSearchMessages GetSearchMessages() const
Retrieve any error/warning messages that occurred during the search.
size_t SplitQuery_GetChunkSize(EProgram program)
Returns the optimal chunk size for a given task.
Definition: local_blast.cpp:54
CRef< CBlastTracebackSearch > m_TbackSearch
Object which runs the traceback stage of the search.
std::string m_batch_num_str
CRef< CLocalDbAdapter > m_LocalDbAdapter
Local DB adaptor (if one was) passed to constructor.
CRef< IQueryFactory > m_QueryFactory
Query factory from which to obtain the query sequence data.
string
Definition: cgiapp.hpp:690
#define NULL
Definition: ncbistd.hpp:225
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
void Run(void)
Enter the main loop.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Return statistics from the BLAST search.
Complete type definition of Blast Sequence Source ADT.
Definition: blast_seqsrc.c:43
#define _ASSERT
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Modified on Fri Sep 20 14:58:11 2024 by modify_doxy.py rev. 669887