65 : m_QueryFactory(query_factory), m_InternalData(new
SInternalData),
66 m_Options(options), m_DbAdapter(
NULL), m_DbInfo(&dbinfo)
72 m_InternalData->m_SeqSrc = wrapped_src;
79 : m_QueryFactory(query_factory), m_InternalData(new
SInternalData),
80 m_Options(options), m_DbAdapter(db), m_DbInfo(
NULL)
86 if (num_threads > 1) {
95 : m_QueryFactory(query_factory), m_InternalData(new
SInternalData),
96 m_Options(options), m_DbAdapter(
NULL), m_DbInfo(
NULL)
98 x_Init(query_factory, options, pssm, seqsrc);
117 unique_ptr<const CBlastOptionsMemento> opts_memento
136 copy(setup_data->m_Masks.begin(), setup_data->m_Masks.end(),
144 typedef vector< CRef<CPrelimSearchThread> > TBlastThreads;
147 unique_ptr<const CBlastOptionsMemento> opts_memento
159 opts_memento.get()));
160 if (thread->Empty()) {
162 "Failed to create preliminary search thread");
202 "Filtering resulted in an empty database.";
216 unique_ptr<const CBlastOptionsMemento> opts_memento
233 _TRACE(
"Query chunk " <<
i <<
"/" <<
246 chunk_queries, lut_options, word_options );
274 const string err_msg1(
"search cannot proceed due to errors "
275 "in all contexts/frames of query "
326 vector<bool> *rm_hsps_info)
const
328 bool any_query_hsp_limited =
false;
329 unique_ptr<const CBlastOptionsMemento> opts_memento
336 opts_memento->m_ExtnOpts,
337 opts_memento->m_ScoringOpts,
348 (*rm_hsps_info)[ query_index ] = removed_hsps[query_index] ==
FALSE ?
false :
true;
349 if( (*rm_hsps_info)[ query_index ] ) any_query_hsp_limited =
true;
352 delete [] removed_hsps;
353 if( rm_hsps ) *rm_hsps = any_query_hsp_limited ;
374 if (gapped_calculation)
398 _TRACE(
"HSP Stream is empty");
409 _TRACE(
"This method does not support CBlastPrelimSearch constructed with BlastSeqSrc");
414 if(
NULL == hsp_stream)
416 _TRACE(
"NULL HSP Stream Pointer");
429 int num_queries = results->num_queries;
433 l.resize(num_queries);
436 for(
int i=0;
i < num_queries;
i++)
Auxiliary functions for BLAST.
Declarations for indexed blast databases.
BlastDiagnostics * Blast_DiagnosticsFree(BlastDiagnostics *diagnostics)
Free the BlastDiagnostics structure and all substructures.
Structures and API used for saving BLAST hits.
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 ...
BlastHSPResults * Blast_HSPResultsFree(BlastHSPResults *results)
Deallocate memory for BLAST results.
Int2 Blast_HSPResultsSortByEvalue(BlastHSPResults *results)
Sort each hit list in the BLAST results by best e-value.
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.
Int2 Blast_HSPListGetBitScores(BlastHSPList *hsp_list, Boolean gapped_calculation, const BlastScoreBlk *sbp)
Calculate bit scores from raw scores in an HSP list.
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.
const char * kBlastErrMsg_CantCalculateUngappedKAParams
const int kBlastMessageNoContext
Declared in blast_message.h as extern const.
C++ version of the initialization for the mutex locking interface.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
Utility function to convert internal BLAST result structures into objects::CSeq_align_set objects.
Int4 BlastSeqSrcGetNumSeqs(const BlastSeqSrc *seq_src)
Get the number of sequences contained in the sequence source.
BlastSeqSrc * BlastSeqSrcFree(BlastSeqSrc *seq_src)
Frees the BlastSeqSrc structure by invoking the destructor function set by the user-defined construct...
void BlastSeqSrcSetNumberOfThreads(BlastSeqSrc *seq_src, int nthreads)
Set the number of threads for MT mode.
void BlastSeqSrcResetChunkIterator(BlastSeqSrc *seq_src)
Reset the internal "bookmark" of the last chunk for iteration provided by this object.
Definitions and prototypes used by blast_stat.c to calculate BLAST statistics.
int BlastScoreBlkCheck(BlastScoreBlk *sbp)
Check that score blk is valid, returns zero if it is.
Defines BLAST error codes (user errors included)
Encapsulates ALL the BLAST algorithm's options.
Search class to perform the preliminary stage of the BLAST search.
Wrapper class for BlastScoreBlk .
Defines system exceptions occurred while running BLAST.
Memento class to save, replace out, and restore the effective search space options of the CBlastOptio...
Interface to create a BlastSeqSrc suitable for use in CORE BLAST from a a variety of BLAST database/s...
Functor to run the preliminary stage of the BLAST search.
Thread class to run the preliminary stage of the BLAST search.
Abstract base class to encapsulate retrieval of sequence identifiers.
Source of query sequence data for BLAST Provides an interface for search classes to retrieve sequence...
virtual CConstRef< objects::CSeq_loc > GetSeq_loc(size_t index)=0
Get the Seq_loc for the sequence indicated by index.
CStructWrapper< BlastDiagnostics > TBlastDiagnostics
CRef< CBlastOptions > m_Options
int CheckInternalData()
Checks that internal data is valid.
size_t GetNumberOfThreads(void) const
Accessor for the number of threads to use.
void SplitQuery_SetEffectiveSearchSpace(CRef< CBlastOptions > options, CRef< IQueryFactory > full_query_fact, CRef< SInternalData > full_data)
this might supercede the function below...
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 void SetNumberOfThreads(size_t nthreads)
Mutator for the number of threads.
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.
static BlastDiagnostics * CreateDiagnosticsStructure()
Create and initialize the BlastDiagnostics structure for single-threaded applications.
SSplitQueryBlk * GetCStruct() const
Returns the C structure managed by objects of this class.
void s_FixNumIdent(BlastHSPList *hsp_list, bool gapped_calculation)
string BlastErrorCode2String(Int2 error_code)
Returns a string containing a human-readable interpretation of the error_code passed as this function...
CRef< CLocalDbAdapter > m_DbAdapter
bool IsQuerySplit() const
Determines whether the query sequence(s) are split or not.
const CBlastOptionsMemento * CreateSnapshot() const
Create a snapshot of the state of this object for internal use of its data structures (BLAST C++ APIs...
CRef< SInternalData > Run()
Borrow the internal data and results results.
CRef< TBlastSeqSrc > m_SeqSrc
The source of subject sequence data.
void AddMessageAllQueries(EBlastSeverity severity, int error_id, const string &message)
Add a message for all queries.
bool IsMultiThreaded(void) const
Returns true if more than 1 thread is specified.
TSeqLocInfoVector m_MasksForAllQueries
Query masking information.
virtual BLAST_SequenceBlk * GetSequenceBlk()=0
Accessor for the BLAST_SequenceBlk structure.
BlastSeqSrc * MakeSeqSrc()
Retrieves or constructs the BlastSeqSrc.
CRef< ILocalQueryData > MakeLocalQueryData(const CBlastOptions *opts)
Creates and caches an ILocalQueryData.
int x_LaunchMultiThreadedSearch(SInternalData &internal_data)
Runs the preliminary search in multi-threaded mode.
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.
TSearchMessages m_Messages
Warnings and error messages.
void s_GetBitScores(BlastHitList *hit_list, bool gapped_calculation, const BlastScoreBlk *sbp)
static BlastDiagnostics * CreateDiagnosticsStructureMT()
Create and initialize the BlastDiagnostics structure for multi-threaded applications.
virtual void SetNumberOfThreads(size_t nthreads)
@inheritDoc
CRef< SInternalData > m_InternalData
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.
static BlastSeqSrc * CreateBlastSeqSrc(const CSearchDatabase &db)
Create a BlastSeqSrc from a CSearchDatabase (uses CSeqDB)
CStructWrapper< BlastSeqSrc > TBlastSeqSrc
CRef< TBlastScoreBlk > m_ScoreBlk
BLAST score block structure.
TData * GetPointer()
The a pointer to the wrapped object.
BLAST_SequenceBlk * m_Queries
The query sequence data, these fields are "borrowed" from the query factory (which owns them)
IBlastSeqInfoSrc * MakeSeqInfoSrc()
Retrieves or constructs the IBlastSeqInfoSrc.
BlastQueryInfo * m_QueryInfo
The query information structure.
DbIndexSetUsingThreadsFnType GetDbIndexSetUsingThreadsFn()
Return the appropriate callback to set the concurrency state in the index structure.
CRef< IQueryFactory > GetQueryFactoryForChunk(Uint4 chunk_num)
Returns a IQueryFactory suitable to be executed by a BLAST search class.
void FlushSequenceData()
Frees the cached sequence data structure (as this is usually the larger data structure).
DbIndexRunSearchFnType GetDbIndexRunSearchFn()
Return the appropriate callback to run indexed seed search.
DbIndexSetNumThreadsFnType GetDbIndexSetNumThreadsFn()
Return the appropriate callback to set the number of threads in the index structure.
CRef< IQueryFactory > m_QueryFactory
Query factory is retained to ensure the lifetime of the data (queries) produced by it.
bool x_BuildStdSegList(vector< list< CRef< CStd_seg > > > &list)
CRef< CSplitQueryBlk > Split()
Split the query sequence(s)
CBlastPrelimSearch(CRef< IQueryFactory > query_factory, CRef< CBlastOptions > options, const CSearchDatabase &dbinfo)
Constructor which creates and manages a BLAST database handle for the caller.
const CSearchDatabase * m_DbInfo
CRef< TBlastDiagnostics > m_Diagnostics
Diagnostic output from preliminary and traceback stages.
virtual size_t GetSeqLength(size_t index)=0
Get the length of the sequence indicated by index.
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.
Uint4 GetNumberOfChunks() const
Returns the number of chunks the query/queries will be split into.
MT_LOCK Blast_CMT_LOCKInit(void)
Initialize a mutex locking mechanism for BLAST.
CRef< TBlastHSPStream > m_HspStream
HSP output of the preliminary stage goes here.
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...
bool GetGappedMode() const
Returns true if gapped BLAST is set, false otherwise.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
int16_t Int2
2-byte (16-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
Uint1 Boolean
bool replacment for C
#define FALSE
bool replacment for C indicating false.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Defines internal auxiliary functor object to run the preliminary stage of the BLAST search.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declarations of auxiliary functions/classes for PSI-BLAST.
Auxiliary functions and classes to assist in query splitting.
Structure to hold a sequence.
Return statistics from the BLAST search.
The structure to hold all HSPs for a given sequence after the gapped alignment.
Int4 hspcnt
Number of HSPs saved.
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
The structure to contain all BLAST results, for multiple queries.
Default implementation of BlastHSPStream.
EBlastProgramType program
BLAST program type.
Structure holding all information about an HSP.
Int4 num_ident
Number of identical base pairs in this HSP.
The structure to contain all BLAST results for one query sequence.
BlastHSPList ** hsplist_array
Array of HSP lists for individual database hits.
Int4 hsplist_count
Filled size of the HSP lists array.
Options needed for initial word finding and processing.
int num_queries
Number of query sequences.
Structure used for scoring calculations.
Complete type definition of Blast Sequence Source ADT.
Options needed to construct a lookup table Also needed: query sequence and query length.
Keeps prelim_hitlist_size and HitSavingOptions together, mostly for use by hspstream.
Return type of BlastSetupPreliminarySearch.
Lightweight wrapper to enclose C structures needed for running the preliminary and traceback stages o...