NCBI C++ ToolKit
Classes | Typedefs | Functions | Variables
split_query.h File Reference
#include <algo/blast/core/ncbi_std.h>
#include <algo/blast/core/blast_export.h>
+ Include dependency graph for split_query.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SSplitQueryBlk
 Structure to keep track of which query sequences are allocated to each query chunk. More...
 

Typedefs

typedef struct SDynamicUint4Array SQueriesPerChunk
 Forward declaration of dynamic array. More...
 
typedef struct SDynamicInt4Array SContextsPerChunk
 Forward declaration of dynamic array. More...
 
typedef struct SDynamicUint4Array SContextOffsetsPerChunk
 Forward declaration of dynamic array. More...
 
typedef struct SSeqRange SQueryChunkBoundary
 Convenience typedef. More...
 
typedef struct SSplitQueryBlk SSplitQueryBlk
 Structure to keep track of which query sequences are allocated to each query chunk. More...
 

Functions

SSplitQueryBlkSplitQueryBlkNew (Uint4 num_chunks, Boolean gapped_merge)
 Allocate a new split query chunk structure. More...
 
SSplitQueryBlkSplitQueryBlkFree (SSplitQueryBlk *squery_blk)
 Deallocate a split query chunk structure. More...
 
Boolean SplitQueryBlk_AllowGap (SSplitQueryBlk *squery_blk)
 Determines whether HSPs on different diagnonals may be merged. More...
 
Int2 SplitQueryBlk_SetChunkBounds (SSplitQueryBlk *squery_blk, Uint4 chunk_num, Uint4 starting_offset, Uint4 ending_offset)
 Set the query chunk's bounds with respect to the full sized concatenated query. More...
 
Int2 SplitQueryBlk_GetChunkBounds (const SSplitQueryBlk *squery_blk, Uint4 chunk_num, size_t *starting_offset, size_t *ending_offset)
 Get the query chunk's bounds with respect to the full sized concatenated query. More...
 
Int2 SplitQueryBlk_AddQueryToChunk (SSplitQueryBlk *squery_blk, Uint4 query_index, Uint4 chunk_num)
 Add a query index to a given chunk. More...
 
Int2 SplitQueryBlk_AddContextToChunk (SSplitQueryBlk *squery_blk, Int4 ctx_index, Uint4 chunk_num)
 Add a query context index to a given chunk. More...
 
Int2 SplitQueryBlk_AddContextOffsetToChunk (SSplitQueryBlk *squery_blk, Uint4 offset, Uint4 chunk_num)
 Add a context offset to a given chunk. More...
 
Int2 SplitQueryBlk_GetNumQueriesForChunk (const SSplitQueryBlk *squery_blk, Uint4 chunk_num, size_t *num_queries)
 Retrieve the number of queries that correspond to chunk number chunk_num. More...
 
Int2 SplitQueryBlk_GetQueryIndicesForChunk (const SSplitQueryBlk *squery_blk, Uint4 chunk_num, Uint4 **query_indices)
 Retrieve an array of query indices for the requested chunk. More...
 
Int2 SplitQueryBlk_GetQueryContextsForChunk (const SSplitQueryBlk *squery_blk, Uint4 chunk_num, Int4 **query_contexts, Uint4 *num_query_contexts)
 Retrieve an array of query contexts for the requested chunk. More...
 
Int2 SplitQueryBlk_GetContextOffsetsForChunk (const SSplitQueryBlk *squery_blk, Uint4 chunk_num, Uint4 **context_offsets)
 Retrieve an array of context offsets for the requested chunk. More...
 
Int2 SplitQueryBlk_SetChunkOverlapSize (SSplitQueryBlk *squery_blk, size_t size)
 Sets the query chunk overlap size. More...
 
size_t SplitQueryBlk_GetChunkOverlapSize (const SSplitQueryBlk *squery_blk)
 Returns the query chunk overlap size. More...
 

Variables

const Int4 kInvalidContext
 Value to represent an invalid context. More...
 
const Int2 kBadParameter
 Invalid parameter used in a function call. More...
 
const Int2 kOutOfMemory
 Failure due to out-of-memory condition. More...
 

Typedef Documentation

◆ SContextOffsetsPerChunk

Forward declaration of dynamic array.

Definition at line 1 of file split_query.h.

◆ SContextsPerChunk

Forward declaration of dynamic array.

Definition at line 1 of file split_query.h.

◆ SQueriesPerChunk

Forward declaration of dynamic array.

Definition at line 1 of file split_query.h.

◆ SQueryChunkBoundary

Convenience typedef.

Definition at line 1 of file split_query.h.

◆ SSplitQueryBlk

Structure to keep track of which query sequences are allocated to each query chunk.

Function Documentation

◆ SplitQueryBlk_AddContextOffsetToChunk()

Int2 SplitQueryBlk_AddContextOffsetToChunk ( SSplitQueryBlk squery_blk,
Uint4  offset,
Uint4  chunk_num 
)

Add a context offset to a given chunk.

Parameters
squery_blksplit query block structure [in]
offsetthe context offset to assign [in]
chunk_numnumber of chunk to assign query index [in]
Returns
0 on success or kOutOfMemory

Definition at line 222 of file split_query.c.

References SSplitQueryBlk::chunk_offset_map, DynamicUint4Array_Append(), kBadParameter, SSplitQueryBlk::num_chunks, and offset.

Referenced by CSplitQueryBlk::AddContextOffsetToChunk().

◆ SplitQueryBlk_AddContextToChunk()

Int2 SplitQueryBlk_AddContextToChunk ( SSplitQueryBlk squery_blk,
Int4  ctx_index,
Uint4  chunk_num 
)

Add a query context index to a given chunk.

Parameters
squery_blksplit query block structure [in]
ctx_indexquery context index to assign [in]
chunk_numnumber of chunk to assign query index [in]
Returns
0 on success or kOutOfMemory

Definition at line 211 of file split_query.c.

References SSplitQueryBlk::chunk_ctx_map, DynamicInt4Array_Append(), kBadParameter, and SSplitQueryBlk::num_chunks.

Referenced by CSplitQueryBlk::AddContextToChunk(), and BOOST_AUTO_TEST_CASE().

◆ SplitQueryBlk_AddQueryToChunk()

Int2 SplitQueryBlk_AddQueryToChunk ( SSplitQueryBlk squery_blk,
Uint4  query_index,
Uint4  chunk_num 
)

Add a query index to a given chunk.

Parameters
squery_blksplit query block structure [in]
query_indexquery index to assign [in]
chunk_numnumber of chunk to assign query index [in]
Returns
0 on success or kOutOfMemory

Definition at line 201 of file split_query.c.

References SSplitQueryBlk::chunk_query_map, DynamicUint4Array_Append(), kBadParameter, and SSplitQueryBlk::num_chunks.

Referenced by CSplitQueryBlk::AddQueryToChunk(), and BOOST_AUTO_TEST_CASE().

◆ SplitQueryBlk_AllowGap()

Boolean SplitQueryBlk_AllowGap ( SSplitQueryBlk squery_blk)

Determines whether HSPs on different diagnonals may be merged.

Parameters
squery_blksplit query block structure [in]
Returns
TRUE if possible, FALSE otherwise

Definition at line 154 of file split_query.c.

References FALSE, SSplitQueryBlk::gapped_merge, and TRUE.

Referenced by BlastHSPStreamMerge().

◆ SplitQueryBlk_GetChunkBounds()

Int2 SplitQueryBlk_GetChunkBounds ( const SSplitQueryBlk squery_blk,
Uint4  chunk_num,
size_t *  starting_offset,
size_t *  ending_offset 
)

Get the query chunk's bounds with respect to the full sized concatenated query.

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to assign bounds [in]
starting_offsetstarting offset of this chunk [in|out]
ending_offsetending offset of this chunk [in|out]
Returns
0 on success or kBadParameter if chunk_num is invalid

Definition at line 174 of file split_query.c.

References SSplitQueryBlk::chunk_bounds, kBadParameter, SSeqRange::left, SSplitQueryBlk::num_chunks, and SSeqRange::right.

Referenced by CSplitQueryBlk::GetChunkBounds().

◆ SplitQueryBlk_GetChunkOverlapSize()

size_t SplitQueryBlk_GetChunkOverlapSize ( const SSplitQueryBlk squery_blk)

Returns the query chunk overlap size.

Parameters
squery_blksplit query block structure [in]
Returns
chunk overlap size, 0 if value wasn't set or kBadParameter if squery_blk is NULL

Definition at line 332 of file split_query.c.

References SSplitQueryBlk::chunk_overlap_sz, and kBadParameter.

Referenced by BlastHSPStreamMerge(), and CSplitQueryBlk::GetChunkOverlapSize().

◆ SplitQueryBlk_GetContextOffsetsForChunk()

Int2 SplitQueryBlk_GetContextOffsetsForChunk ( const SSplitQueryBlk squery_blk,
Uint4  chunk_num,
Uint4 **  context_offsets 
)

Retrieve an array of context offsets for the requested chunk.

Each offset is the correction needed for the query range of HSPs found in the specified chunk

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to retrieve query indices [in]
context_offsetsoffsets for the contexts in the requested chunk, this will be allocated in this function and the last element in the array will be assigned the value UINT4_MAX. Caller is responsible for deallocating this.
Returns
0 on success or kOutOfMemory

Definition at line 293 of file split_query.c.

References SSplitQueryBlk::chunk_offset_map, SDynamicUint4Array::data, kBadParameter, kOutOfMemory, malloc(), NULL, SSplitQueryBlk::num_chunks, SDynamicUint4Array::num_used, and UINT4_MAX.

Referenced by BlastHSPStreamMerge(), and CSplitQueryBlk::GetContextOffsets().

◆ SplitQueryBlk_GetNumQueriesForChunk()

Int2 SplitQueryBlk_GetNumQueriesForChunk ( const SSplitQueryBlk squery_blk,
Uint4  chunk_num,
size_t *  num_queries 
)

Retrieve the number of queries that correspond to chunk number chunk_num.

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to retrieve query indices [in]
num_queriesthe return value of this function [in|out]
Returns
0 on success or kBadParameter

Definition at line 189 of file split_query.c.

References SSplitQueryBlk::chunk_query_map, kBadParameter, SSplitQueryBlk::num_chunks, and SDynamicUint4Array::num_used.

Referenced by BOOST_AUTO_TEST_CASE(), and CSplitQueryBlk::GetNumQueriesForChunk().

◆ SplitQueryBlk_GetQueryContextsForChunk()

Int2 SplitQueryBlk_GetQueryContextsForChunk ( const SSplitQueryBlk squery_blk,
Uint4  chunk_num,
Int4 **  query_contexts,
Uint4 num_query_contexts 
)

Retrieve an array of query contexts for the requested chunk.

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to retrieve query indices [in]
query_contextscontexts for the chunk requested, this will be allocated in this function, caller is responsible for deallocating this.
num_query_contextssize of the returned array in query_contexts
Returns
0 on success or kOutOfMemory

Definition at line 262 of file split_query.c.

References SSplitQueryBlk::chunk_ctx_map, SDynamicInt4Array::data, kBadParameter, kOutOfMemory, malloc(), NULL, SSplitQueryBlk::num_chunks, and SDynamicInt4Array::num_used.

Referenced by BlastHSPStreamMerge(), BOOST_AUTO_TEST_CASE(), and CSplitQueryBlk::GetQueryContexts().

◆ SplitQueryBlk_GetQueryIndicesForChunk()

Int2 SplitQueryBlk_GetQueryIndicesForChunk ( const SSplitQueryBlk squery_blk,
Uint4  chunk_num,
Uint4 **  query_indices 
)

Retrieve an array of query indices for the requested chunk.

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to retrieve query indices [in]
query_indicesindices for the chunk requested, this will be allocated in this function and the last element in the array will be assigned the value UINT4_MAX. Caller is responsible for deallocating this.
Returns
0 on success or kOutOfMemory

Definition at line 235 of file split_query.c.

References SSplitQueryBlk::chunk_query_map, SDynamicUint4Array::data, kBadParameter, kOutOfMemory, malloc(), NULL, SSplitQueryBlk::num_chunks, SDynamicUint4Array::num_used, and UINT4_MAX.

Referenced by BlastHSPStreamMerge(), BOOST_AUTO_TEST_CASE(), and CSplitQueryBlk::GetQueryIndices().

◆ SplitQueryBlk_SetChunkBounds()

Int2 SplitQueryBlk_SetChunkBounds ( SSplitQueryBlk squery_blk,
Uint4  chunk_num,
Uint4  starting_offset,
Uint4  ending_offset 
)

Set the query chunk's bounds with respect to the full sized concatenated query.

Parameters
squery_blksplit query block structure [in]
chunk_numnumber of chunk to assign bounds [in]
starting_offsetstarting offset of this chunk [in]
ending_offsetending offset of this chunk [in]
Returns
0 on success or kBadParameter if chunk_num is invalid

Definition at line 160 of file split_query.c.

References SSplitQueryBlk::chunk_bounds, kBadParameter, SSeqRange::left, SSplitQueryBlk::num_chunks, and SSeqRange::right.

Referenced by CSplitQueryBlk::SetChunkBounds().

◆ SplitQueryBlk_SetChunkOverlapSize()

Int2 SplitQueryBlk_SetChunkOverlapSize ( SSplitQueryBlk squery_blk,
size_t  size 
)

Sets the query chunk overlap size.

Parameters
squery_blksplit query block structure [in]
sizesize of the chunk overlap size [in]
Returns
0 on success or kBadParameter is squery_blk is NULL

Definition at line 322 of file split_query.c.

References SSplitQueryBlk::chunk_overlap_sz, kBadParameter, and ncbi::grid::netcache::search::fields::size.

Referenced by CSplitQueryBlk::SetChunkOverlapSize().

◆ SplitQueryBlkFree()

SSplitQueryBlk* SplitQueryBlkFree ( SSplitQueryBlk squery_blk)

Deallocate a split query chunk structure.

Parameters
squery_blkstructure to deallocate [in]
Returns
NULL

Definition at line 116 of file split_query.c.

References SSplitQueryBlk::chunk_bounds, SSplitQueryBlk::chunk_ctx_map, SSplitQueryBlk::chunk_offset_map, SSplitQueryBlk::chunk_query_map, DynamicInt4ArrayFree(), DynamicUint4ArrayFree(), i, NULL, SSplitQueryBlk::num_chunks, and sfree.

Referenced by SplitQueryBlkNew(), and CSplitQueryBlk::~CSplitQueryBlk().

◆ SplitQueryBlkNew()

SSplitQueryBlk* SplitQueryBlkNew ( Uint4  num_chunks,
Boolean  gapped_merge 
)

Allocate a new split query chunk structure.

Parameters
num_chunksnumber of chunks in which the query will be split [in]
Returns
newly allocated structure or NULL in case of memory allocation failure

Definition at line 42 of file split_query.c.

References calloc(), SSplitQueryBlk::chunk_bounds, SSplitQueryBlk::chunk_ctx_map, SSplitQueryBlk::chunk_offset_map, SSplitQueryBlk::chunk_query_map, DynamicInt4ArrayNew(), DynamicUint4ArrayNew(), SSplitQueryBlk::gapped_merge, i, NULL, SSplitQueryBlk::num_chunks, and SplitQueryBlkFree().

Referenced by CSplitQueryBlk::CSplitQueryBlk().

Variable Documentation

◆ kBadParameter

const Int2 kBadParameter
extern

◆ kInvalidContext

const Int4 kInvalidContext
extern

◆ kOutOfMemory

const Int2 kOutOfMemory
extern
Modified on Fri Sep 20 14:57:55 2024 by modify_doxy.py rev. 669887