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

Go to the SVN repository for this file.

1 /* $Id: query_data.hpp 41998 2009-05-27 17:35:47Z camacho $
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 query_data.hpp
31  * NOTE: This file contains work in progress and the APIs are likely to change,
32  * please do not rely on them until this notice is removed.
33  */
34 
35 #ifndef ALGO_BLAST_API___BLAST_QUERY_DATA_HPP
36 #define ALGO_BLAST_API___BLAST_QUERY_DATA_HPP
37 
42 
43 /** @addtogroup AlgoBlast
44  *
45  * @{
46  */
47 
49 
50 BEGIN_SCOPE(blast)
51 
52 /// Provides access (not ownership) to the C structures used to configure
53 /// local BLAST search class implementations
55 {
56 public:
57  /// Default constructor
58  ILocalQueryData() : m_SumOfSequenceLengths(0) {}
59 
60  /// virtual destructor
61  virtual ~ILocalQueryData() {}
62 
63  /// Accessor for the BLAST_SequenceBlk structure
65 
66  /// Accessor for the BlastQueryInfo structure
67  virtual BlastQueryInfo* GetQueryInfo() = 0;
68 
69 
70  /// Get the number of queries.
71  virtual size_t GetNumQueries() = 0;
72 
73  /// Get the Seq_loc for the sequence indicated by index.
74  virtual CConstRef<objects::CSeq_loc> GetSeq_loc(size_t index) = 0;
75 
76  /// Get the length of the sequence indicated by index.
77  virtual size_t GetSeqLength(size_t index) = 0;
78 
79  /// Compute the sum of all the sequence's lengths
80  size_t GetSumOfSequenceLengths();
81 
82  /// Retrieve all error/warning messages
83  void GetMessages(TSearchMessages& messages) const;
84 
85  /// Retrieve error/warning messages for a specific query
86  void GetQueryMessages(size_t index, TQueryMessages& qmsgs);
87 
88  /// Determine if a given query sequence is valid or not
89  bool IsValidQuery(size_t index);
90 
91  /// Determine if at least one query sequence is valid or not
92  bool IsAtLeastOneQueryValid();
93 
94  /// Frees the cached sequence data structure (as this is usually the larger
95  /// data structure). This is to be used in the context of query splitting,
96  /// when the sequence data is only needed to set up global data structures,
97  /// but not in the actual search.
98  void FlushSequenceData();
99 
100 protected:
101  /// Data member to cache the BLAST_SequenceBlk
103  /// Data member to cache the BlastQueryInfo
105 
106  /// Error/warning messages are stored here
108 
109 private:
110  void x_ValidateIndex(size_t index);
112 };
113 
114 class IRemoteQueryData : public CObject
115 {
116 public:
117  virtual ~IRemoteQueryData() {}
118 
119  /// Accessor for the CBioseq_set
121  /// Type definition for CSeq_loc set used as queries in the BLAST remote
122  /// search class
123  typedef list< CRef<objects::CSeq_loc> > TSeqLocs;
124  /// Accessor for the TSeqLocs
125  virtual TSeqLocs GetSeqLocs() = 0;
126 
127 protected:
128  /// Data member to cache the CBioseq_set
130  /// Data member to cache the TSeqLocs
132 };
133 
134 // forward declaration needed by IQueryFactory
135 class CBlastOptions;
136 
137 /// Source of query sequence data for BLAST
138 /// Provides an interface for search classes to retrieve sequence data to be
139 /// used in local/remote searches without coupling them to the actual means
140 /// of retrieving the data.
141 ///
142 /// Its subclasses define which types of inputs can be converted into ILocalQ
143 /// @note Because this class caches the result of the Make*QueryData methods,
144 /// the products created by this factory will have the same lifespan as
145 /// the factory.
147 {
148 public:
149  virtual ~IQueryFactory() {}
150 
151  /// Creates and caches an ILocalQueryData
152  CRef<ILocalQueryData> MakeLocalQueryData(const CBlastOptions* opts);
153 
154  /// Creates and caches an IRemoteQueryData
155  CRef<IRemoteQueryData> MakeRemoteQueryData();
156 
157 protected:
160 
161  /// factory method to create an ILocalQueryData, only called if the data
162  /// members above are not set
163  virtual CRef<ILocalQueryData>
165 
166  /// factory method to create an IRemoteQueryData, only called if the data
167  /// members above are not set
169 };
170 
171 END_SCOPE(BLAST)
173 
174 /* @} */
175 
176 #endif /* ALGO_BLAST_API___BLAST_QUERY_DATA__HPP */
Contains C++ wrapper classes to structures in algo/blast/core as well as some auxiliary functions to ...
Definitions used throughout BLAST.
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
Wrapper class for BLAST_SequenceBlk .
Definition: blast_aux.hpp:309
Encapsulates ALL the BLAST algorithm's options.
Wrapper class for BlastQueryInfo .
Definition: blast_aux.hpp:311
CObject –.
Definition: ncbiobj.hpp:180
Provides access (not ownership) to the C structures used to configure local BLAST search class implem...
Definition: query_data.hpp:55
Source of query sequence data for BLAST Provides an interface for search classes to retrieve sequence...
Definition: query_data.hpp:147
Class for the messages for an individual query sequence.
typedef for the messages for an entire BLAST search, which could be comprised of multiple query seque...
size_t m_SumOfSequenceLengths
Definition: query_data.hpp:111
virtual CConstRef< objects::CSeq_loc > GetSeq_loc(size_t index)=0
Get the Seq_loc for the sequence indicated by index.
virtual CRef< ILocalQueryData > x_MakeLocalQueryData(const CBlastOptions *opts)=0
factory method to create an ILocalQueryData, only called if the data members above are not set
TSearchMessages m_Messages
Error/warning messages are stored here.
Definition: query_data.hpp:107
virtual BLAST_SequenceBlk * GetSequenceBlk()=0
Accessor for the BLAST_SequenceBlk structure.
list< CRef< objects::CSeq_loc > > TSeqLocs
Type definition for CSeq_loc set used as queries in the BLAST remote search class.
Definition: query_data.hpp:123
virtual ~IQueryFactory()
Definition: query_data.hpp:149
TSeqLocs m_SeqLocs
Data member to cache the TSeqLocs.
Definition: query_data.hpp:131
virtual CRef< IRemoteQueryData > x_MakeRemoteQueryData()=0
factory method to create an IRemoteQueryData, only called if the data members above are not set
virtual BlastQueryInfo * GetQueryInfo()=0
Accessor for the BlastQueryInfo structure.
virtual ~ILocalQueryData()
virtual destructor
Definition: query_data.hpp:61
virtual CRef< objects::CBioseq_set > GetBioseqSet()=0
Accessor for the CBioseq_set.
CRef< ILocalQueryData > m_LocalQueryData
Definition: query_data.hpp:158
CRef< IRemoteQueryData > m_RemoteQueryData
Definition: query_data.hpp:159
virtual size_t GetNumQueries()=0
Get the number of queries.
virtual ~IRemoteQueryData()
Definition: query_data.hpp:117
CRef< objects::CBioseq_set > m_Bioseqs
Data member to cache the CBioseq_set.
Definition: query_data.hpp:129
ILocalQueryData()
Default constructor.
Definition: query_data.hpp:58
virtual size_t GetSeqLength(size_t index)=0
Get the length of the sequence indicated by index.
virtual TSeqLocs GetSeqLocs()=0
Accessor for the TSeqLocs.
CBLAST_SequenceBlk m_SeqBlk
Data member to cache the BLAST_SequenceBlk.
Definition: query_data.hpp:102
CBlastQueryInfo m_QueryInfo
Data member to cache the BlastQueryInfo.
Definition: query_data.hpp:104
#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
Structure to hold a sequence.
Definition: blast_def.h:242
The query related information.
Modified on Mon May 20 04:58:27 2024 by modify_doxy.py rev. 669887