NCBI C++ ToolKit
Functions
blast_query_info.c File Reference

Functions to manipulate the BlastQueryInfo structure. More...

#include <algo/blast/core/blast_util.h>
#include <algo/blast/core/blast_query_info.h>
#include <algo/blast/core/pattern.h>
+ Include dependency graph for blast_query_info.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

Int4 Blast_GetQueryIndexFromContext (Int4 context, EBlastProgramType program)
 Given a context from BLAST engine core, return the query index. More...
 
Int4 Blast_GetQueryIndexFromQueryOffset (Int4 query_offset, EBlastProgramType program, const BlastQueryInfo *query_info)
 Return the query index (zero based), given the query offset in the initial HSP as the program. More...
 
BlastQueryInfoBlastQueryInfoNew (EBlastProgramType program, int num_queries)
 Allocate memory for query information structure. More...
 
BlastQueryInfoBlastQueryInfoFree (BlastQueryInfo *query_info)
 Deallocate memory for query information structure. More...
 
BlastQueryInfoBlastQueryInfoDup (const BlastQueryInfo *query_info)
 Duplicates the query information structure. More...
 
static Int4 s_GetTranslatedQueryDNALength (const BlastQueryInfo *query_info, Int4 query_index)
 Calculates length of the DNA query from the BlastQueryInfo structure that contains context information for translated frames for a set of queries. More...
 
Int4 BlastQueryInfoGetQueryLength (const BlastQueryInfo *qinfo, EBlastProgramType program, Int4 query_index)
 Obtains the sequence length for a given query in the query, without taking into consideration any applicable translations. More...
 
Int8 BlastQueryInfoGetEffSearchSpace (const BlastQueryInfo *qinfo, EBlastProgramType program, Int4 query_index)
 Retrieve a query sequence's search space. More...
 
void BlastQueryInfoSetEffSearchSpace (BlastQueryInfo *qinfo, EBlastProgramType program, Int4 query_index, Int8 eff_searchsp)
 Set a query sequence's search space. More...
 
Int4 BSearchContextInfo (Int4 n, const BlastQueryInfo *A)
 Search BlastContextInfo structures for the specified offset. More...
 
Uint4 QueryInfo_GetSeqBufLen (const BlastQueryInfo *qinfo)
 Get the number of bytes required for the concatenated sequence buffer, given a query info structure. More...
 
Int4ContextOffsetsToOffsetArray (const BlastQueryInfo *info)
 Copy the context query offsets to an allocated array of Int4. More...
 
void OffsetArrayToContextOffsets (BlastQueryInfo *info, Int4 *new_offsets, EBlastProgramType prog)
 Copy the context query offsets from an array of Int4, allocating the context array if needed. More...
 
Int2 Blast_GetOneQueryStructs (BlastQueryInfo **one_query_info_ptr, BLAST_SequenceBlk **one_query_ptr, const BlastQueryInfo *query_info, BLAST_SequenceBlk *query, Int4 query_index)
 Create auxiliary query structures with all data corresponding to a single query sequence within a concatenated set. More...
 

Detailed Description

Functions to manipulate the BlastQueryInfo structure.

Definition in file blast_query_info.c.

Function Documentation

◆ Blast_GetOneQueryStructs()

Int2 Blast_GetOneQueryStructs ( BlastQueryInfo **  one_query_info_ptr,
BLAST_SequenceBlk **  one_query_ptr,
const BlastQueryInfo query_info,
BLAST_SequenceBlk query,
Int4  query_index 
)

Create auxiliary query structures with all data corresponding to a single query sequence within a concatenated set.

Allocates the structures if the pointers are NULL on input; otherwise only changes the contents.

Parameters
one_query_info_ptrPointer to the query information structure for a single query. Allocated and filled here, so the caller of this function will be responsible for freeing it. [out]
one_query_ptrPointer to the query sequence block structure; allocated here, but the contents are not allocated; it is still safe to free by the caller after use. [out]
query_infoQuery information structure containing information about a concatenated set. [in]
queryQuery sequence block corresponding to a concatenated set of queries. [in]
query_indexWhich query index to create the auxiliary structures for? [in]
Returns
-1 if memory allocation failed; 0 on success

Definition at line 327 of file blast_query_info.c.

References calloc(), BlastQueryInfo::contexts, FALSE, BlastQueryInfo::last_context, BLAST_SequenceBlk::length, NULL, BlastQueryInfo::num_queries, BLAST_SequenceBlk::oid, query, BlastContextInfo::query_length, BlastContextInfo::query_offset, BLAST_SequenceBlk::sequence, and BLAST_SequenceBlk::sequence_allocated.

Referenced by s_RPSComputeTraceback(), and s_RPSPreliminarySearchEngine().

◆ Blast_GetQueryIndexFromContext()

Int4 Blast_GetQueryIndexFromContext ( Int4  context,
EBlastProgramType  program 
)

Given a context from BLAST engine core, return the query index.

Parameters
contextContext saved in a BlastHSP structure [in]
programType of BLAST program [in]
Returns
Query index in a set of queries or -1 on error

Definition at line 40 of file blast_query_info.c.

References Blast_QueryIsProtein(), Blast_QueryIsTranslated(), context, eBlastTypePsiTblastn, NUM_FRAMES, and NUM_STRANDS.

Referenced by BLAST_GetGappedScore(), Blast_GetQueryIndexFromQueryOffset(), BlastQueryInfoNew(), OffsetArrayToContextOffsets(), s_BlastHSPBestHitRun(), s_BlastHSPCollectorRun(), s_BlastHSPCullingFinal(), and CQueryDataPerChunk::x_ContextInChunkToQueryIndex().

◆ Blast_GetQueryIndexFromQueryOffset()

Int4 Blast_GetQueryIndexFromQueryOffset ( Int4  query_offset,
EBlastProgramType  program,
const BlastQueryInfo query_info 
)

Return the query index (zero based), given the query offset in the initial HSP as the program.

Parameters
query_offsetOffset of the query in the initial HSP [in]
programEBlastProgramType [in]
query_infoinformation about all the queries [in]
Returns
Query Index in a set of queries

Definition at line 52 of file blast_query_info.c.

References Blast_GetQueryIndexFromContext(), BSearchContextInfo(), and context.

Referenced by BLAST_GetGappedScore(), and BOOST_AUTO_TEST_CASE().

◆ BlastQueryInfoDup()

BlastQueryInfo* BlastQueryInfoDup ( const BlastQueryInfo query_info)

◆ BlastQueryInfoFree()

BlastQueryInfo* BlastQueryInfoFree ( BlastQueryInfo query_info)

◆ BlastQueryInfoGetEffSearchSpace()

Int8 BlastQueryInfoGetEffSearchSpace ( const BlastQueryInfo qinfo,
EBlastProgramType  program,
Int4  query_index 
)

Retrieve a query sequence's search space.

Parameters
qinfoBlastQueryInfo structure [in]
programCORE program type [in]
query_indexnumber of the query (query_index < BlastQueryInfo::num_queries) [in]
Returns
the search space of the query sequence requested or 0 if this is not set

Definition at line 187 of file blast_query_info.c.

References ASSERT, BLAST_GetNumberOfContexts(), BlastQueryInfo::contexts, BlastContextInfo::eff_searchsp, and i.

Referenced by CEffectiveSearchSpaceCalculator::GetEffSearchSpace().

◆ BlastQueryInfoGetQueryLength()

Int4 BlastQueryInfoGetQueryLength ( const BlastQueryInfo qinfo,
EBlastProgramType  program,
Int4  query_index 
)

Obtains the sequence length for a given query in the query, without taking into consideration any applicable translations.

Parameters
qinfoBlastQueryInfo structure [in]
programCORE program type [in]
query_indexnumber of the query (query_index < BlastQueryInfo::num_queries) [in]
Returns
the length of the query sequence requested

Definition at line 163 of file blast_query_info.c.

References ASSERT, BLAST_GetNumberOfContexts(), Blast_QueryIsTranslated(), BlastQueryInfo::contexts, eBlastTypeBlastn, eBlastTypeMapping, BlastContextInfo::query_length, and s_GetTranslatedQueryDNALength().

Referenced by BlastMaskLocDNAToProtein(), BlastMaskLocProteinToDNA(), PHIGetPatternOccurrences(), s_BlastHSPBestHitRun(), s_ImportFromHitlist(), SetupQueries_OMF(), and setupQueryInfoForOffsetTranslation().

◆ BlastQueryInfoNew()

BlastQueryInfo* BlastQueryInfoNew ( EBlastProgramType  program,
int  num_queries 
)

◆ BlastQueryInfoSetEffSearchSpace()

void BlastQueryInfoSetEffSearchSpace ( BlastQueryInfo qinfo,
EBlastProgramType  program,
Int4  query_index,
Int8  eff_searchsp 
)

Set a query sequence's search space.

Parameters
qinfoBlastQueryInfo structure [in]
programCORE program type [in]
query_indexnumber of the query (query_index < BlastQueryInfo::num_queries) [in]
eff_searchspthe effective search space to use [in]

Definition at line 205 of file blast_query_info.c.

References ASSERT, BLAST_GetNumberOfContexts(), BlastQueryInfo::contexts, BlastContextInfo::eff_searchsp, and i.

◆ BSearchContextInfo()

Int4 BSearchContextInfo ( Int4  n,
const BlastQueryInfo A 
)

◆ ContextOffsetsToOffsetArray()

Int4* ContextOffsetsToOffsetArray ( const BlastQueryInfo info)

Copy the context query offsets to an allocated array of Int4.

Parameters
infoDescribes the concatenated query.
Returns
Allocated array.

Definition at line 253 of file blast_query_info.c.

References ASSERT, info, malloc(), and result.

Referenced by Blast_TracebackFromHSPList(), and s_BlastSearchEngineCore().

◆ OffsetArrayToContextOffsets()

void OffsetArrayToContextOffsets ( BlastQueryInfo info,
Int4 new_offsets,
EBlastProgramType  prog 
)

Copy the context query offsets from an array of Int4, allocating the context array if needed.

Parameters
infoDestination for the values.
new_offsetsArray of values to copy from.
progThe blast program type.

Definition at line 294 of file blast_query_info.c.

References ASSERT, BLAST_ContextToFrame(), Blast_GetQueryIndexFromContext(), calloc(), i, info, and prog.

Referenced by Blast_TracebackFromHSPList(), s_RPSComputeTraceback(), s_RPSGapAlignDataPrepare(), and s_RPSOffsetArrayToContextOffsets().

◆ QueryInfo_GetSeqBufLen()

Uint4 QueryInfo_GetSeqBufLen ( const BlastQueryInfo qinfo)

Get the number of bytes required for the concatenated sequence buffer, given a query info structure.

The context data should already be assigned.

Parameters
qinfoQuery info structure. [in/out]
Returns
Number of bytes for all queries and inter-query marks.

Definition at line 246 of file blast_query_info.c.

References BlastQueryInfo::contexts, BlastQueryInfo::last_context, BlastContextInfo::query_length, and BlastContextInfo::query_offset.

Referenced by BLAST_CreateMixedFrameDNATranslation(), and SetupQueries_OMF().

◆ s_GetTranslatedQueryDNALength()

static Int4 s_GetTranslatedQueryDNALength ( const BlastQueryInfo query_info,
Int4  query_index 
)
static

Calculates length of the DNA query from the BlastQueryInfo structure that contains context information for translated frames for a set of queries.

Parameters
query_infoQuery information containing data for all contexts [in]
query_indexWhich query to find DNA length for?
Returns
DNA length of the query, calculated as sum of 3 protein frame lengths, plus 2, because 2 last nucleotide residues do not have a corresponding codon.

Definition at line 141 of file blast_query_info.c.

References ASSERT, BlastQueryInfo::contexts, NUM_FRAMES, and BlastContextInfo::query_length.

Referenced by BlastQueryInfoGetQueryLength().

Modified on Sun May 19 04:41:15 2024 by modify_doxy.py rev. 669887