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

Go to the SVN repository for this file.

1 /* $Id: blast_aux_priv.hpp 91306 2020-10-08 11:57:15Z gouriano $
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
27  *
28  */
29 
30 /** @file blast_aux_priv.hpp
31  * Auxiliary functions for BLAST
32  */
33 
34 #ifndef ALGO_BLAST_API___BLAST_AUX_PRIV__HPP
35 #define ALGO_BLAST_API___BLAST_AUX_PRIV__HPP
36 
37 #include <corelib/ncbiobj.hpp>
41 #include <algo/blast/api/query_data.hpp> // for IQueryFactory
42 #include <algo/blast/api/blast_options.hpp> // for CBlastOptions
43 #include <algo/blast/api/setup_factory.hpp> // for SInternalData
44 #include "split_query.hpp" // for CQuerySplitter
45 
46 /** @addtogroup AlgoBlast
47  *
48  * @{
49  */
50 
51 struct BlastSeqSrc;
52 struct Blast_Message;
53 struct BlastQueryInfo;
54 
56 
58  class CSeq_id;
59  class CSeq_loc;
61 
62 BEGIN_SCOPE(blast)
63 
64 /** Create a single CSeq_loc of type whole from the first id in the list.
65  * @param seqids identifiers for the Seq-loc [in]
66  */
69 
70 // Auxiliary comparison functors for TQueryMessages (need to dereference the
71 // CRef<>'s contained)
73 {
74  /// Operator to determine if *a is less than *b
76  const CRef<CSearchMessage>& b) const {
77  return *a < *b;
78  }
79 };
80 
82 {
83  /// Operator to determine if *a is equal to *b
85  const CRef<CSearchMessage>& b) const {
86  return *a == *b;
87  }
88 };
89 
90 /// Converts the Blast_Message structure into a TSearchMessages object.
91 void
93  const BlastQueryInfo* query_info,
94  TSearchMessages& messages);
95 
96 /// Returns a string containing a human-readable interpretation of the
97 /// error_code passed as this function's argument
98 string
99 BlastErrorCode2String(Int2 error_code);
100 
101 /// Return type of BlastSetupPreliminarySearch
102 struct SBlastSetupData : public CObject {
104  CRef<CBlastOptions> opts)
106  m_QuerySplitter(new CQuerySplitter(qf, opts))
107  {}
108 
113 };
114 
115 
116 /// Set up internal data structures used by the BLAST CORE engine
117 /// @param query_factory source of query sequence data structures [in]
118 /// @param options BLAST options [in]
119 /// @param num_threads number of threads [in]
122  CRef<CBlastOptions> options,
123  size_t num_threads = 1);
124 
125 
126 /// Extended interface to set up internal data structures used by the BLAST
127 /// CORE engine
128 /// @param query_factory source of query sequence data structures [in]
129 /// @param options BLAST options [in]
130 /// @param pssm PSSM [in]
131 /// @param seqsrc source of database/subject sequence data [in]
132 /// @param num_threads number of threads to use [in]
135  CRef<CBlastOptions> options,
137  BlastSeqSrc* seqsrc,
138  size_t num_threads);
139 
140 /// Builds an CSearchResultSet::TAncillaryVector
141 /// @param program BLAST program [in]
142 /// @param query_ids the sequence identifiers for the queries [in]
143 /// @param sbp BlastScoreBlk structure used during the search [in]
144 /// @param qinfo BlastQueryInfo structure used during the search [in]
145 /// @param alignments alignments that were the result of the search [in]
146 /// @param result_type are these results for bl2seq or a database search? [in]
147 /// @param retval the output of this function is returned through this
148 /// parameter [in|out]
149 void
151  const vector< CConstRef<CSeq_id> >& query_ids,
152  const BlastScoreBlk* sbp,
153  const BlastQueryInfo* qinfo,
154  const TSeqAlignVector& alignments,
155  const EResultType result_type,
157 
158 /// Build a CSearchResultSet from internal BLAST data structures
159 /// @param query_masks Masks for query sequences [in]
160 /// @param subj_masks Masks for subject sequences [in]
162 BlastBuildSearchResultSet(const vector< CConstRef<CSeq_id> >& query_ids,
163  const BlastScoreBlk* sbp,
164  const BlastQueryInfo* qinfo,
165  EBlastProgramType program,
166  const TSeqAlignVector& alignments,
167  TSearchMessages& messages,
168  const vector<TSeqLocInfoVector>& subj_masks,
169  const TSeqLocInfoVector* query_masks = NULL,
170  const EResultType result_type = ncbi::blast::eDatabaseSearch);
171 
172 END_SCOPE(blast)
174 
175 /* @} */
176 
177 #endif /* ALGO_BLAST_API___BLAST_AUX_PRIV__HPP */
Declares class to encapsulate all BLAST options.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
Definition: blast_program.h:72
Definition of classes which constitute the results of running a BLAST search.
Definitions of special type used in BLAST.
vector< CRef< objects::CSeq_align_set > > TSeqAlignVector
Vector of Seq-align-sets.
EResultType
Specifies the style of Seq-aligns that should be built from the internal BLAST data structures.
@ eDatabaseSearch
Seq-aligns in the style of a database search.
CObject –.
Definition: ncbiobj.hpp:180
Class responsible for splitting query sequences and providing data to the BLAST search class to searc...
Definition: split_query.hpp:66
typedef for the messages for an entire BLAST search, which could be comprised of multiple query seque...
CRef< CQuerySplitter > m_QuerySplitter
CRef< SBlastSetupData > BlastSetupPreliminarySearch(CRef< IQueryFactory > query_factory, CRef< CBlastOptions > options, size_t num_threads)
Set up internal data structures used by the BLAST CORE engine.
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.
void BuildBlastAncillaryData(EBlastProgramType program, const vector< CConstRef< CSeq_id > > &query_ids, const BlastScoreBlk *sbp, const BlastQueryInfo *qinfo, const TSeqAlignVector &alignments, const EResultType result_type, CSearchResultSet::TAncillaryVector &retval)
Builds an CSearchResultSet::TAncillaryVector.
CRef< SInternalData > m_InternalData
string BlastErrorCode2String(Int2 error_code)
Returns a string containing a human-readable interpretation of the error_code passed as this function...
void Blast_Message2TSearchMessages(const Blast_Message *blmsg, const BlastQueryInfo *query_info, TSearchMessages &messages)
Converts the Blast_Message structure into a TSearchMessages object.
bool operator()(const CRef< CSearchMessage > &a, const CRef< CSearchMessage > &b) const
Operator to determine if *a is less than *b.
bool operator()(const CRef< CSearchMessage > &a, const CRef< CSearchMessage > &b) const
Operator to determine if *a is equal to *b.
SBlastSetupData(CRef< IQueryFactory > qf, CRef< CBlastOptions > opts)
TSearchMessages m_Messages
TSeqLocInfoVector m_Masks
vector< CRef< CBlastAncillaryData > > TAncillaryVector
typedef for a vector of CRef<CBlastAncillaryData>
CRef< CSearchResultSet > BlastBuildSearchResultSet(const vector< CConstRef< CSeq_id > > &query_ids, const BlastScoreBlk *sbp, const BlastQueryInfo *qinfo, EBlastProgramType program, const TSeqAlignVector &alignments, TSearchMessages &messages, const vector< TSeqLocInfoVector > &subj_masks, const TSeqLocInfoVector *query_masks, const EResultType result_type)
Build a CSearchResultSet from internal BLAST data structures.
CConstRef< objects::CSeq_loc > CreateWholeSeqLocFromIds(const list< CRef< objects::CSeq_id > > seqids)
Create a single CSeq_loc of type whole from the first id in the list.
#define NULL
Definition: ncbistd.hpp:225
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
#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
unsigned int a
Definition: ncbi_localip.c:102
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Defines BLAST database access classes.
vector< TMaskedQueryRegions > TSeqLocInfoVector
Collection of masked regions for all queries in a BLAST search.
Definition: seqlocinfo.hpp:139
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declares CQuerySplitter, a class to split the query sequence(s)
The query related information.
Structure used for scoring calculations.
Definition: blast_stat.h:177
Complete type definition of Blast Sequence Source ADT.
Definition: blast_seqsrc.c:43
Structure to hold the a message from the core of the BLAST engine.
Definition: blast_message.h:70
Return type of BlastSetupPreliminarySearch.
Lightweight wrapper to enclose C structures needed for running the preliminary and traceback stages o...
Modified on Tue Apr 23 07:37:40 2024 by modify_doxy.py rev. 669887