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

Go to the SVN repository for this file.

1 /* $Id: split_query_blk.hpp 46287 2010-06-25 17:12:38Z maning $
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 split_query_blk.hpp
31  * Definition of C++ wrapper for SSplitQueryBlk
32  */
33 
34 #ifndef ALGO_BLAST_API__SPLIT_QUERY_BLK_HPP
35 #define ALGO_BLAST_API__SPLIT_QUERY_BLK_HPP
36 
37 #include <corelib/ncbiobj.hpp>
38 #include <util/range.hpp>
40 
41 /** @addtogroup AlgoBlast
42  *
43  * @{
44  */
45 
47 BEGIN_SCOPE(blast)
48 
49 /// Range describing a query chunk
51 
52 /// Wrapper class around SSplitQueryBlk structure
54 public:
55  /**
56  * @brief Constructor for wrapper class for SSplitQueryBlk
57  *
58  * @param num_chunks number of chunks
59  */
60  CSplitQueryBlk(Uint4 num_chunks, bool gapped_merge = true);
61 
62  /// Destructor
63  ~CSplitQueryBlk();
64 
65  /// Retrieve the number of chunks
66  size_t GetNumChunks() const;
67  /// Get the number of queries in a given chunk
68  /// @param chunk_num desired chunk [in]
69  size_t GetNumQueriesForChunk(size_t chunk_num) const;
70  /// Get the indices of the queries contained in a given chunk
71  /// @param chunk_num desired chunk [in]
72  vector<size_t> GetQueryIndices(size_t chunk_num) const;
73  /// Get the contexts of the queries contained in a given chunk
74  /// @param chunk_num desired chunk [in]
75  vector<int> GetQueryContexts(size_t chunk_num) const;
76  /// Get the context offsets (corrections) of the queries contained in a
77  /// given chunk
78  /// @param chunk_num desired chunk [in]
79  vector<size_t> GetContextOffsets(size_t chunk_num) const;
80 
81  /// Get the boundaries of a chunk in the concatenated query
82  /// @param chunk_num desired chunk [in]
83  TChunkRange GetChunkBounds(size_t chunk_num) const;
84  /// Set the boundaries of a chunk in the concatenated query
85  /// @param chunk_num desired chunk [in]
86  /// @param chunk_range range in the concatenated query for this chunk [in]
87  void SetChunkBounds(size_t chunk_num, const TChunkRange& chunk_range);
88  /// Adds a query index to a given chunk
89  /// @param chunk_num desired chunk [in]
90  /// @param query_index index of query to be added [in]
91  void AddQueryToChunk(size_t chunk_num, Int4 query_index);
92  /// Adds a query context to a given chunk
93  /// @param chunk_num desired chunk [in]
94  /// @param context_index context of the concatenated query to be added [in]
95  void AddContextToChunk(size_t chunk_num, Int4 context_index);
96  /// Adds a context offset (correction) to a given chunk
97  /// @param chunk_num desired chunk [in]
98  /// @param context_offset query context offset (correction) to be added [in]
99  void AddContextOffsetToChunk(size_t chunk_num, Int4 context_offset);
100 
101  /// Returns the C structure managed by objects of this class
102  /// @note the caller of this method does NOT own the returned structure
103  SSplitQueryBlk* GetCStruct() const;
104 
105  /// Sets the size (# of bases/residues) of overlap between query chunks
106  /// @param size value to set [in]
107  void SetChunkOverlapSize(size_t size);
108  /// Gets the size (# of bases/residues) of overlap between query chunks
109  size_t GetChunkOverlapSize() const;
110 
111  /// Print this object so that its contents can be directly used to update
112  /// split_query.ini (for unit testing)
113  /// @param out stream to print this object [in|out]
114  /// @param rhs object to print [in]
115  friend ostream& operator<<(ostream& out, const CSplitQueryBlk& rhs);
116 
117 private:
118  /// The structure this object manages
120 
121  /// Do not allow copy-construction
123  /// Do not allow assignment operator
125 };
126 
127 END_SCOPE(BLAST)
129 
130 /* @} */
131 
132 #endif /* ALGO_BLAST_API__SPLIT_QUERY_BLK__HPP */
133 
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
CObject –.
Definition: ncbiobj.hpp:180
Wrapper class around SSplitQueryBlk structure.
CNcbiOstream & operator<<(CNcbiOstream &out, const CEquivRange &range)
Definition: equiv_range.cpp:96
std::ofstream out("events_result.xml")
main entry point for tests
SSplitQueryBlk * m_SplitQueryBlk
The structure this object manages.
CSplitQueryBlk & operator=(const CSplitQueryBlk &rhs)
Do not allow assignment operator.
CSplitQueryBlk(const CSplitQueryBlk &rhs)
Do not allow copy-construction.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#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
const struct ncbi::grid::netcache::search::fields::SIZE size
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Structure to keep track of which query sequences are allocated to each query chunk.
Definition: split_query.h:54
Modified on Mon Feb 26 04:06:10 2024 by modify_doxy.py rev. 669887