NCBI C++ ToolKit
prelim_stage.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* ===========================================================================
2  *
3  * PUBLIC DOMAIN NOTICE
4  * National Center for Biotechnology Information
5  *
6  * This software/database is a "United States Government Work" under the
7  * terms of the United States Copyright Act. It was written as part of
8  * the author's official duties as a United States Government employee and
9  * thus cannot be copyrighted. This software/database is freely available
10  * to the public for use. The National Library of Medicine and the U.S.
11  * Government have not placed any restriction on its use or reproduction.
12  *
13  * Although all reasonable efforts have been taken to ensure the accuracy
14  * and reliability of the software and data, the NLM and the U.S.
15  * Government do not and cannot warrant the performance or results that
16  * may be obtained by using this software or data. The NLM and the U.S.
17  * Government disclaim all warranties, express or implied, including
18  * warranties of performance, merchantability or fitness for any particular
19  * purpose.
20  *
21  * Please cite the author in any work or product based on this material.
22  *
23  * ===========================================================================
24  *
25  * Author: Christiam Camacho
26  *
27  */
28 
29 /** @file prelim_stage.cpp
30  * NOTE: This file contains work in progress and the APIs are likely to change,
31  * please do not rely on them until this notice is removed.
32  */
33 
34 #include <ncbi_pch.hpp>
35 
37 #include <algo/blast/api/uniform_search.hpp> // for CSearchDatabase
41 
42 #include "prelim_search_runner.hpp"
43 #include "blast_aux_priv.hpp"
44 #include "psiblast_aux_priv.hpp"
45 #include "split_query_aux_priv.hpp"
46 #include "blast_seqalign.hpp"
47 #include <sstream>
48 
50 
51 /** @addtogroup AlgoBlast
52  *
53  * @{
54  */
55 
59 
60 
61 
63  CRef<CBlastOptions> options,
64  const CSearchDatabase& dbinfo)
65  : m_QueryFactory(query_factory), m_InternalData(new SInternalData),
66  m_Options(options), m_DbAdapter(NULL), m_DbInfo(&dbinfo)
67 {
69  x_Init(query_factory, options, CRef<CPssmWithParameters>(), seqsrc);
70 
71  m_InternalData->m_SeqSrc.Reset(new TBlastSeqSrc(seqsrc, BlastSeqSrcFree));
72 }
73 
75  CRef<CBlastOptions> options,
77  size_t num_threads)
78  : m_QueryFactory(query_factory), m_InternalData(new SInternalData),
79  m_Options(options), m_DbAdapter(db), m_DbInfo(NULL)
80 {
81  BlastSeqSrc* seqsrc = db->MakeSeqSrc();
82  x_Init(query_factory, options, CRef<CPssmWithParameters>(), seqsrc,
83  num_threads);
84  m_InternalData->m_SeqSrc.Reset(new TBlastSeqSrc(seqsrc, 0));
85  if (num_threads > 1) {
86  SetNumberOfThreads(num_threads);
87  }
88 }
89 
91  CRef<CBlastOptions> options,
92  BlastSeqSrc* seqsrc,
94  : m_QueryFactory(query_factory), m_InternalData(new SInternalData),
95  m_Options(options), m_DbAdapter(NULL), m_DbInfo(NULL)
96 {
97  x_Init(query_factory, options, pssm, seqsrc);
98  m_InternalData->m_SeqSrc.Reset(new TBlastSeqSrc(seqsrc, 0));
99 }
100 
101 void
103 {
104  const bool was_multithreaded = IsMultiThreaded();
105 
107  if (was_multithreaded != IsMultiThreaded()) {
113 
114  CRef<ILocalQueryData> query_data
116  auto_ptr<const CBlastOptionsMemento> opts_memento
118  if (IsMultiThreaded())
121  }
122 }
123 
124 void
126  CRef<CBlastOptions> options,
128  BlastSeqSrc* seqsrc,
129  size_t num_threads)
130 {
131  CRef<SBlastSetupData> setup_data =
132  BlastSetupPreliminarySearchEx(query_factory, options, pssm, seqsrc,
133  num_threads);
134  m_InternalData = setup_data->m_InternalData;
135  copy(setup_data->m_Masks.begin(), setup_data->m_Masks.end(),
136  back_inserter(m_MasksForAllQueries));
137  m_Messages = setup_data->m_Messages;
138 }
139 
140 int
142 {
143  typedef vector< CRef<CPrelimSearchThread> > TBlastThreads;
144  TBlastThreads the_threads(GetNumberOfThreads());
145 
146  auto_ptr<const CBlastOptionsMemento> opts_memento
148  _TRACE("Launching BLAST with " << GetNumberOfThreads() << " threads");
149 
150  // -RMH- This appears to be a problem right now. When used...this
151  // can cause all the work to go to a single thread! (-MN- This is fixed in SB-768)
154 
155  // Create the threads ...
156  NON_CONST_ITERATE(TBlastThreads, thread, the_threads) {
157  thread->Reset(new CPrelimSearchThread(internal_data,
158  opts_memento.get()));
159  if (thread->Empty()) {
160  NCBI_THROW(CBlastSystemException, eOutOfMemory,
161  "Failed to create preliminary search thread");
162  }
163  }
164 
165  // Inform indexing library about the number of concurrent
166  // search threads.
167  //
169 
170  // ... launch the threads ...
171  NON_CONST_ITERATE(TBlastThreads, thread, the_threads) {
172  (*thread)->Run();
173  }
174 
175  // ... and wait for the threads to finish
176  Uint8 retv(0);
177  NON_CONST_ITERATE(TBlastThreads, thread, the_threads) {
178  void * result(0);
179  (*thread)->Join(&result);
180  if (result) {
181  // Thread is not really returning a pointer, it's actually
182  // retruning an int
183  retv = reinterpret_cast<Uint8> (result);
184  }
185  }
186 
188 
189  if (retv) {
190  NCBI_THROW(CBlastException, eCoreBlastError,
191  BlastErrorCode2String((Int2)retv));
192  }
193  return 0;
194 }
195 
198 {
199  if (! BlastSeqSrcGetNumSeqs(m_InternalData->m_SeqSrc->GetPointer())) {
200  string msg =
201  "GI or TI list filtering resulted in an empty database.";
202 
205  msg);
206  }
207 
209 
213  int retval = 0;
214 
215  auto_ptr<const CBlastOptionsMemento> opts_memento
218  LookupTableOptions * lut_options = opts_memento->m_LutOpts;
219  BlastInitialWordOptions * word_options = opts_memento->m_InitWordOpts;
220 
221  // Query splitting data structure (used only if applicable)
223  CRef<CQuerySplitter> query_splitter = setup_data->m_QuerySplitter;
224  if (query_splitter->IsQuerySplit()) {
225 
226  CRef<CSplitQueryBlk> split_query_blk = query_splitter->Split();
227 
228  for (Uint4 i = 0; i < query_splitter->GetNumberOfChunks(); i++) {
229  try {
230  CRef<IQueryFactory> chunk_qf =
231  query_splitter->GetQueryFactoryForChunk(i);
232  _TRACE("Query chunk " << i << "/" <<
233  query_splitter->GetNumberOfChunks());
234  CRef<SInternalData> chunk_data =
238 
239  CRef<ILocalQueryData> query_data(
240  chunk_qf->MakeLocalQueryData( &*m_Options ) );
241  BLAST_SequenceBlk * chunk_queries =
242  query_data->GetSequenceBlk();
245  chunk_queries, lut_options, word_options );
246 
247  if (IsMultiThreaded()) {
248  x_LaunchMultiThreadedSearch(*chunk_data);
249  } else {
250  retval =
251  CPrelimSearchRunner(*chunk_data, opts_memento.get())();
252  if (retval) {
253  NCBI_THROW(CBlastException, eCoreBlastError,
254  BlastErrorCode2String(retval));
255  }
256  }
257 
258 
259  _ASSERT(chunk_data->m_HspStream->GetPointer());
260  BlastHSPStreamMerge(split_query_blk->GetCStruct(), i,
261  chunk_data->m_HspStream->GetPointer(),
262  m_InternalData->m_HspStream->GetPointer());
263  _ASSERT(m_InternalData->m_HspStream->GetPointer());
264  // free this as the query_splitter keeps a reference to the
265  // chunk factories, which in turn keep a reference to the local
266  // query data.
267  query_data->FlushSequenceData();
268  } catch (const CBlastException& e) {
269  // This error message is safe to ignore for a given chunk,
270  // because the chunks might end up producing a region of
271  // the query for which ungapped Karlin-Altschul blocks
272  // cannot be calculated
273  const string err_msg1("search cannot proceed due to errors "
274  "in all contexts/frames of query "
275  "sequences");
276  const string err_msg2(kBlastErrMsg_CantCalculateUngappedKAParams);
277  if (e.GetMsg().find(err_msg1) == NPOS && e.GetMsg().find(err_msg2) == NPOS) {
278  throw;
279  }
280  }
281  }
282 
283  // Restore the full query sequence for the traceback stage!
284  if (m_InternalData->m_Queries == NULL) {
285  CRef<ILocalQueryData> query_data
287  // Query masking info is calculated as a side-effect
288  CBlastScoreBlk sbp
289  (CSetupFactory::CreateScoreBlock(opts_memento.get(), query_data,
290  NULL, m_Messages, NULL, NULL));
291  m_InternalData->m_Queries = query_data->GetSequenceBlk();
292  }
293  } else {
294 
296  GetDbIndexRunSearchFn()( queries, lut_options, word_options );
297 
298  if (IsMultiThreaded()) {
300  } else {
301  retval = CPrelimSearchRunner(*m_InternalData, opts_memento.get())();
302  if (retval) {
303  NCBI_THROW(CBlastException, eCoreBlastError,
304  BlastErrorCode2String(retval));
305  }
306  }
307  }
308 
309  return m_InternalData;
310 }
311 
312 int
314 {
315  int retval = 0;
316  retval = BlastScoreBlkCheck(m_InternalData->m_ScoreBlk->GetPointer());
317  return retval;
318 }
319 
320 
323  Uint4 max_num_hsps,
324  bool* rm_hsps,
325  vector<bool> *rm_hsps_info) const
326 {
327  bool any_query_hsp_limited = false;
328  auto_ptr<const CBlastOptionsMemento> opts_memento
330 
332  Boolean *removed_hsps = new Boolean [ m_InternalData->m_QueryInfo->num_queries ];
333  SBlastHitsParameters* hit_param = NULL;
334  SBlastHitsParametersNew(opts_memento->m_HitSaveOpts,
335  opts_memento->m_ExtnOpts,
336  opts_memento->m_ScoringOpts,
337  &hit_param);
338  BlastHSPResults* retval =
341  hit_param,
342  max_num_hsps,
343  removed_hsps);
344  if( rm_hsps_info){
345  rm_hsps_info->reserve(m_InternalData->m_QueryInfo->num_queries );
346  for( int query_index = 0 ; query_index < m_InternalData->m_QueryInfo->num_queries ; query_index ++ ){
347  (*rm_hsps_info)[ query_index ] = removed_hsps[query_index] == FALSE ? false : true;
348  if( (*rm_hsps_info)[ query_index ] ) any_query_hsp_limited = true;
349  }
350  }
351  delete [] removed_hsps;
352  if( rm_hsps ) *rm_hsps = any_query_hsp_limited ;
353  // applications assume the HSPLists in the HSPResults are
354  // sorted in order of worsening best e-value
356  return retval;
357 }
358 
359 bool CBlastPrelimSearch::Run( vector<list<CRef<CStd_seg> > > & l )
360 {
361  Run();
362  return x_BuildStdSegList(l);
363 }
364 
365 void s_FixNumIdent(BlastHSPList *hsp_list, bool gapped_calculation)
366 {
367  BlastHSP* hsp;
368  int i;
369 
370  for (i=0; i < hsp_list->hspcnt; i++)
371  {
372  hsp = hsp_list->hsp_array[i];
373  if (gapped_calculation)
374  hsp->num_ident = -1;
375  }
376 }
377 
378 void s_GetBitScores(BlastHitList * hit_list, bool gapped_calculation, const BlastScoreBlk * sbp)
379 {
380 
381  for (int i = 0; i < hit_list->hsplist_count; i++)
382  {
383  BlastHSPList* hsp_list = hit_list->hsplist_array[i];
384  if (!hsp_list)
385  continue;
386 
387  Blast_HSPListGetBitScores(hsp_list, gapped_calculation, sbp);
388  s_FixNumIdent(hsp_list, gapped_calculation);
389  }
390 }
391 
392 // Results is trimmed by Blast Hits Save Options if set
394 {
395  if(m_InternalData->m_HspStream.Empty())
396  {
397  _TRACE("HSP Stream is empty");
398  return false;
399  }
400 
401  if(NULL != m_DbInfo)
402  {
404  }
405 
406  if(m_DbAdapter.Empty())
407  {
408  _TRACE("This method does not support CBlastPrelimSearch constructed with BlastSeqSrc");
409  return false;
410  }
411 
412  BlastHSPStream * hsp_stream = m_InternalData->m_HspStream->GetPointer();
413  if(NULL == hsp_stream)
414  {
415  _TRACE("NULL HSP Stream Pointer");
416  return false;
417  }
418 
419  IBlastSeqInfoSrc * s_seqInfoSrc = m_DbAdapter->MakeSeqInfoSrc();
420  EBlastProgramType program = hsp_stream->program;
421 
422  BlastHSPResults * results = ComputeBlastHSPResults(hsp_stream );
423 
424  if(NULL == results)
425  return false;
426 
427  int num_queries = results->num_queries;
428 
429  BlastHitList ** q_list_ptr = results->hitlist_array;
431  l.resize(num_queries);
432  const BlastScoreBlk * sbp = m_InternalData->m_ScoreBlk->GetPointer();
433  bool gapped_cal = m_Options->GetGappedMode();
434  for(int i=0; i < num_queries; i++)
435  {
436  CConstRef<CSeq_loc> query_loc = local_query_data->GetSeq_loc(i);
437  TSeqPos query_length = local_query_data->GetSeqLength(i);
438  BlastHitList * hit_list = q_list_ptr[i];
439  if(NULL != hit_list)
440  {
441 
442  s_GetBitScores(hit_list, gapped_cal, sbp);
443  BLASTPrelminSearchHitListToStdSeg(program, hit_list, *query_loc, query_length, s_seqInfoSrc, l[i]);
444  }
445  }
446 
447  return true;
448 }
451 
452 /* @} */
453 
TSearchMessages m_Messages
EBlastProgramType program
BLAST program type.
Structures and API used for saving BLAST hits.
void BLASTPrelminSearchHitListToStdSeg(EBlastProgramType program, BlastHitList *hit_list, const CSeq_loc &query_loc, TSeqPos query_length, const IBlastSeqInfoSrc *subject_seqinfo, list< CRef< CStd_seg > > &seg_list)
virtual CConstRef< objects::CSeq_loc > GetSeq_loc(size_t index)=0
Get the Seq_loc for the sequence indicated by index.
Int2 Blast_HSPResultsSortByEvalue(BlastHSPResults *results)
Sort each hit list in the BLAST results by best e-value.
Definition: blast_hits.c:3268
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:802
CConstRef –.
Definition: ncbiobj.hpp:1211
virtual void SetNumberOfThreads(size_t nthreads)
MT_LOCK Blast_CMT_LOCKInit(void)
Initialize a mutex locking mechanism for BLAST.
Int4 hsplist_count
Filled size of the HSP lists array.
Definition: blast_hits.h:170
static const unsigned char msg[]
Definition: ccm.c:378
Wrapper class for BlastScoreBlk .
Definition: blast_aux.hpp:307
static BlastDiagnostics * CreateDiagnosticsStructureMT()
Create and initialize the BlastDiagnostics structure for multi-threaded applications.
Blast Search Subject.
unsigned NCBI_INT8_TYPE Uint8
Unsigned 8 byte sized integer.
Definition: ncbitype.h:146
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:73
unsigned int Uint4
Alias for unsigned int.
Definition: ncbitype.h:121
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:989
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:855
CRef< TBlastHSPStream > m_HspStream
HSP output of the preliminary stage goes here.
CRef< IQueryFactory > m_QueryFactory
Query factory is retained to ensure the lifetime of the data (queries) produced by it...
virtual size_t GetSeqLength(size_t index)=0
Get the length of the sequence indicated by index.
int num_queries
Number of query sequences.
BlastHSPResults * ComputeBlastHSPResults(BlastHSPStream *stream, Uint4 max_num_hsps=0, bool *rm_hsps=NULL, vector< bool > *rm_hsps_info=NULL) const
Return HSPs in a structure other than the HSPStream? Provide conversion? How to combine this with CBl...
Complete type definition of Blast Sequence Source ADT.
Definition: blast_seqsrc.c:43
const char * kBlastErrMsg_CantCalculateUngappedKAParams
Definition: blast_message.c:38
Auxiliary functions and classes to assist in query splitting.
CRef< CQuerySplitter > m_QuerySplitter
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
Definition: blast_hits.h:157
Defines BLAST error codes (user errors included)
Auxiliary functions for BLAST.
Structure used for scoring calculations.
Definition: blast_stat.h:177
TSearchMessages m_Messages
Warnings and error messages.
Functor to run the preliminary stage of the BLAST search.
bool GetGappedMode() const
Returns true if gapped BLAST is set, false otherwise.
CRef< CSplitQueryBlk > Split()
Split the query sequence(s)
BlastHitList ** hitlist_array
Array of results for individual query sequences.
Definition: blast_hits.h:185
static BlastDiagnostics * CreateDiagnosticsStructure()
Create and initialize the BlastDiagnostics structure for single-threaded applications.
Int2 SBlastHitsParametersNew(const BlastHitSavingOptions *hit_options, const BlastExtensionOptions *ext_options, const BlastScoringOptions *scoring_options, SBlastHitsParameters **retval)
Sets up small structures used by blast_hit.c for saving HSPs.
Definition: blast_hits.c:43
size_t GetNumberOfThreads(void) const
Accessor for the number of threads to use.
Int4 BlastSeqSrcGetNumSeqs(const BlastSeqSrc *seq_src)
Get the number of sequences contained in the sequence source.
Definition: blast_seqsrc.c:177
Declarations of auxiliary functions/classes for PSI-BLAST.
Lightweight wrapper to enclose C structures needed for running the preliminary and traceback stages o...
#define NULL
Definition: ncbistd.hpp:225
void BlastSeqSrcResetChunkIterator(BlastSeqSrc *seq_src)
Reset the internal "bookmark" of the last chunk for iteration provided by this object.
Definition: blast_seqsrc.c:436
The structure to hold all HSPs for a given sequence after the gapped alignment.
Definition: blast_hits.h:153
BlastQueryInfo * m_QueryInfo
The query information structure.
BLAST_SequenceBlk * m_Queries
The query sequence data, these fields are "borrowed" from the query factory (which owns them) ...
#define NPOS
Definition: ncbistr.hpp:131
CRef< CLocalDbAdapter > m_DbAdapter
int i
CRef< TBlastScoreBlk > m_ScoreBlk
BLAST score block structure.
Defines system exceptions occurred while running BLAST.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:612
Source of query sequence data for BLAST Provides an interface for search classes to retrieve sequence...
Definition: query_data.hpp:146
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
Structure holding all information about an HSP.
Definition: blast_hits.h:126
void x_Init(CRef< IQueryFactory > query_factory, CRef< CBlastOptions > options, CConstRef< objects::CPssmWithParameters > pssm, BlastSeqSrc *seqsrc, size_t num_threads=1)
Internal initialization function Initializes internal data structures except the BlastSeqSrc.
Declarations for indexed blast databases.
DbIndexSetUsingThreadsFnType GetDbIndexSetUsingThreadsFn()
Return the appropriate callback to set the concurrency state in the index structure.
void s_GetBitScores(BlastHitList *hit_list, bool gapped_calculation, const BlastScoreBlk *sbp)
int CheckInternalData()
Checks that internal data is valid.
DbIndexRunSearchFnType GetDbIndexRunSearchFn()
Return the appropriate callback to run indexed seed search.
CRef< SInternalData > m_InternalData
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:714
TSeqLocInfoVector m_MasksForAllQueries
Query masking information.
Defines internal auxiliary functor object to run the preliminary stage of the BLAST search...
Return statistics from the BLAST search.
CRef< SInternalData > m_InternalData
#define FALSE
bool replacment for C indicating false.
Definition: ncbi_std.h:99
void AddMessageAllQueries(EBlastSeverity severity, int error_id, const string &message)
Add a message for all queries.
Definition: blast_aux.cpp:1056
#define USING_SCOPE(ns)
Use the specified namespace.
Definition: ncbistl.hpp:76
BlastDiagnostics * Blast_DiagnosticsFree(BlastDiagnostics *diagnostics)
Free the BlastDiagnostics structure and all substructures.
Search class to perform the preliminary stage of the BLAST search.
Abstract base class to encapsulate retrieval of sequence identifiers.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm. ...
Definition: blast_program.h:72
BlastSeqSrc * MakeSeqSrc()
Retrieves or constructs the BlastSeqSrc.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Interface to create a BlastSeqSrc suitable for use in CORE BLAST from a a variety of BLAST database/s...
bool IsMultiThreaded(void) const
Returns true if more than 1 thread is specified.
CRef< SBlastSetupData > BlastSetupPreliminarySearchEx(CRef< IQueryFactory > qf, CRef< CBlastOptions > options, CConstRef< CPssmWithParameters > pssm, BlastSeqSrc *seqsrc, size_t num_threads)
Extended interface to set up internal data structures used by the BLAST CORE engine.
Utility function to convert internal BLAST result structures into objects::CSeq_align_set objects...
BlastSeqSrc * BlastSeqSrcFree(BlastSeqSrc *seq_src)
Frees the BlastSeqSrc structure by invoking the destructor function set by the user-defined construct...
Definition: blast_seqsrc.c:112
int x_LaunchMultiThreadedSearch(SInternalData &internal_data)
Runs the preliminary search in multi-threaded mode.
Default implementation of BlastHSPStream.
Keeps prelim_hitlist_size and HitSavingOptions together, mostly for use by hspstream.
Definition: blast_hits.h:57
void BlastSeqSrcSetNumberOfThreads(BlastSeqSrc *seq_src, int nthreads)
Set the number of threads for MT mode.
Definition: blast_seqsrc.c:168
The structure to contain all BLAST results, for multiple queries.
Definition: blast_hits.h:183
CRef –.
Definition: ncbiobj.hpp:616
CRef< SInternalData > SplitQuery_CreateChunkData(CRef< IQueryFactory > qf, CRef< CBlastOptions > options, CRef< SInternalData > full_data, size_t num_threads)
Function used by search class to retrieve a query factory for a given chunk.
Int4 num_ident
Number of identical base pairs in this HSP.
Definition: blast_hits.h:128
Thread class to run the preliminary stage of the BLAST search.
SSplitQueryBlk * GetCStruct() const
Returns the C structure managed by objects of this class.
CRef< SInternalData > Run()
Borrow the internal data and results results.
IBlastSeqInfoSrc * MakeSeqInfoSrc()
Retrieves or constructs the IBlastSeqInfoSrc.
static BlastSeqSrc * CreateBlastSeqSrc(const CSearchDatabase &db)
Create a BlastSeqSrc from a CSearchDatabase (uses CSeqDB)
Int4 num_queries
Number of query sequences.
Definition: blast_hits.h:184
Encapsulates ALL the BLAST algorithm's options.
CRef< TBlastSeqSrc > m_SeqSrc
The source of subject sequence data.
BlastHSPList ** hsplist_array
Array of HSP lists for individual database hits.
Definition: blast_hits.h:176
Uint1 Boolean
bool replacment for C
Definition: ncbi_std.h:92
virtual void SetNumberOfThreads(size_t nthreads)
Mutator for the number of threads.
Options needed for initial word finding and processing.
CRef< IQueryFactory > GetQueryFactoryForChunk(Uint4 chunk_num)
Returns a IQueryFactory suitable to be executed by a BLAST search class.
Structure to hold a sequence.
Definition: blast_def.h:242
The structure to contain all BLAST results for one query sequence.
Definition: blast_hits.h:169
Definitions and prototypes used by blast_stat.c to calculate BLAST statistics.
Options needed to construct a lookup table Also needed: query sequence and query length.
const CBlastOptionsMemento * CreateSnapshot() const
Create a snapshot of the state of this object for internal use of its data structures (BLAST C++ APIs...
Return type of BlastSetupPreliminarySearch.
#define _ASSERT
int BlastHSPStreamRegisterMTLock(BlastHSPStream *hsp_stream, MT_LOCK lock)
Attach a mutex lock to a stream to protect multiple access during writing.
int BlastHSPStreamMerge(SSplitQueryBlk *squery_blk, Uint4 chunk_num, BlastHSPStream *hsp_stream, BlastHSPStream *combined_hsp_stream)
Moves the HSPlists from an HSPStream into the list contained by a second HSPStream.
CBlastPrelimSearch(CRef< IQueryFactory > query_factory, CRef< CBlastOptions > options, const CSearchDatabase &dbinfo)
Constructor which creates and manages a BLAST database handle for the caller.
CRef< TBlastDiagnostics > m_Diagnostics
Diagnostic output from preliminary and traceback stages.
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:70
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string...
Definition: ncbiexpt.hpp:547
string BlastErrorCode2String(Int2 error_code)
Returns a string containing a human-readable interpretation of the error_code passed as this function...
#define const
Definition: zconf.h:217
BlastHSPResults * Blast_HSPResultsFromHSPStreamWithLimitEx(struct BlastHSPStream *hsp_stream, Uint4 num_queries, SBlastHitsParameters *hit_param, Uint4 max_num_hsps, Boolean *removed_hsps)
As Blast_HSPResultsFromHSPStreamWithLimit, except accept and return array of Boolen flags specifying ...
Definition: blast_hits.c:3760
CRef< ILocalQueryData > MakeLocalQueryData(const CBlastOptions *opts)
Creates and caches an ILocalQueryData.
Definition: query_data.cpp:52
CStructWrapper< BlastSeqSrc > TBlastSeqSrc
int BlastScoreBlkCheck(BlastScoreBlk *sbp)
Check that score blk is valid, returns zero if it is.
Definition: blast_stat.c:853
void SplitQuery_SetEffectiveSearchSpace(CRef< CBlastOptions > options, CRef< IQueryFactory > full_query_fact, CRef< SInternalData > full_data)
this might supercede the function below...
bool x_BuildStdSegList(vector< list< CRef< CStd_seg > > > &list)
static BlastScoreBlk * CreateScoreBlock(const CBlastOptionsMemento *opts_memento, CRef< ILocalQueryData > query_data, BlastSeqLoc **lookup_segments, TSearchMessages &search_messages, TSeqLocInfoVector *masked_query_regions=NULL, const CBlastRPSInfo *rps_info=NULL)
Initializes the BlastScoreBlk.
const int kBlastMessageNoContext
Declared in blast_message.h as extern const.
Definition: blast_message.c:36
void s_FixNumIdent(BlastHSPList *hsp_list, bool gapped_calculation)
Int4 hspcnt
Number of HSPs saved.
Definition: blast_hits.h:158
Uniform BLAST Search Interface.
C++ version of the initialization for the mutex locking interface.
CRef< CBlastOptions > m_Options
DbIndexSetNumThreadsFnType GetDbIndexSetNumThreadsFn()
Return the appropriate callback to set the number of threads in the index structure.
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:459
#define _TRACE(message)
Definition: ncbidbg.hpp:120
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
Int2 Blast_HSPListGetBitScores(BlastHSPList *hsp_list, Boolean gapped_calculation, const BlastScoreBlk *sbp)
Calculate bit scores from raw scores in an HSP list.
Definition: blast_hits.c:1872
CStructWrapper< BlastDiagnostics > TBlastDiagnostics
static int result
Definition: cursor5.c:11
const CSearchDatabase * m_DbInfo
signed short Int2
Alias for signed short.
Definition: ncbitype.h:118
Memento class to save, replace out, and restore the effective search space options of the CBlastOptio...
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:768
bool IsQuerySplit() const
Determines whether the query sequence(s) are split or not.
Definition: split_query.hpp:88
Uint4 GetNumberOfChunks() const
Returns the number of chunks the query/queries will be split into.
Definition: split_query.hpp:85
TSeqLocInfoVector m_Masks
Modified on Tue Jan 16 15:49:50 2018 by modify_doxy.py rev. 546573