64 if (num_queries <= 0) {
149 ASSERT(query_index < query_info->num_queries);
150 ASSERT(start_context < query_info->last_context);
157 for (index = start_context; index < start_context + 3; ++index)
168 ASSERT(query_index < qinfo->num_queries);
194 ASSERT(query_index < qinfo->num_queries);
196 for (
i = query_index*kNumContexts;
i < (query_index+1)*kNumContexts;
i++) {
212 ASSERT(query_index < qinfo->num_queries);
214 for (
i = query_index*kNumContexts;
i < (query_index+1)*kNumContexts;
i++) {
223 size =
A->last_context+1;
225 if (
A->min_length > 0 &&
A->max_length > 0 &&
A->first_context == 0) {
227 e =
MIN(
n / (
A->min_length + 1) + 1,
size);
237 if (
A->contexts[m].query_offset >
n)
278 for(frame = 0; frame <
count; frame++) {
279 result[frame] =
info->contexts[frame].query_offset;
286 if (
info->contexts[
count-1].query_length) {
304 if (!
info->contexts) {
311 info->contexts[
i].query_offset = new_offsets[
i];
313 distance = new_offsets[
i+1] - new_offsets[
i];
314 info->contexts[
i].query_length = distance ? distance-1 : 0;
318 info->contexts[
i].frame =
321 info->contexts[
i].query_index =
339 if (!one_query_info_ptr || !one_query_ptr || !query_info || !
query ||
344 first_context = query_index*num_frames;
347 one_query_info = *one_query_info_ptr;
350 if (!one_query_info) {
352 *one_query_info_ptr = one_query_info;
355 one_query = *one_query_ptr;
359 *one_query_ptr = one_query;
361 if (!one_query_info || !one_query)
368 &query_info->
contexts[first_context],
372 for (index = 0; index < num_frames; ++index) {
383 one_query->
oid = query_index;
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
#define NUM_STRANDS
Number of frames in a nucleotide sequence.
#define NUM_FRAMES
Number of frames to which we translate in translating searches.
Boolean Blast_ProgramIsMapping(EBlastProgramType p)
Boolean Blast_QueryIsTranslated(EBlastProgramType p)
Returns true if the query is translated.
Boolean Blast_QueryIsProtein(EBlastProgramType p)
Returns true if the query is protein.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
BlastQueryInfo * BlastQueryInfoDup(const BlastQueryInfo *query_info)
Duplicates the query information structure.
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.
BlastQueryInfo * BlastQueryInfoFree(BlastQueryInfo *query_info)
Deallocate memory for query information structure.
Int4 Blast_GetQueryIndexFromContext(Int4 context, EBlastProgramType program)
Given a context from BLAST engine core, return the query index.
static Int4 s_GetTranslatedQueryDNALength(const BlastQueryInfo *query_info, Int4 query_index)
Calculates length of the DNA query from the BlastQueryInfo structure that contains context informatio...
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 con...
Int8 BlastQueryInfoGetEffSearchSpace(const BlastQueryInfo *qinfo, EBlastProgramType program, Int4 query_index)
Retrieve a query sequence's search space.
Int4 BSearchContextInfo(Int4 n, const BlastQueryInfo *A)
Search BlastContextInfo structures for the specified offset.
Int4 * ContextOffsetsToOffsetArray(const BlastQueryInfo *info)
Copy the context query offsets to an allocated array of Int4.
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.
void BlastQueryInfoSetEffSearchSpace(BlastQueryInfo *qinfo, EBlastProgramType program, Int4 query_index, Int8 eff_searchsp)
Set a query sequence's search space.
Uint4 QueryInfo_GetSeqBufLen(const BlastQueryInfo *qinfo)
Get the number of bytes required for the concatenated sequence buffer, given a query info structure.
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 app...
BlastQueryInfo * BlastQueryInfoNew(EBlastProgramType program, int num_queries)
Allocate memory for query information structure.
Definitions and functions associated with the BlastQueryInfo structure.
@ eNoSegments
Sequence is not part of a pair.
Various auxiliary BLAST utility functions.
Int1 BLAST_ContextToFrame(EBlastProgramType prog_number, Uint4 context_number)
This function translates the context number of a context into the frame of the sequence.
unsigned int BLAST_GetNumberOfContexts(EBlastProgramType program)
Get the number of contexts for a given program.
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
const struct ncbi::grid::netcache::search::fields::SIZE size
#define INT1_MAX
largest number represented by signed short (one byte)
#define MIN(a, b)
returns smaller of a and b.
void * BlastMemDup(const void *orig, size_t size)
Copies memory using memcpy and malloc.
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define ASSERT
macro for assert.
Functions for finding pattern matches in sequence (PHI-BLAST).
SPHIQueryInfo * SPHIQueryInfoFree(SPHIQueryInfo *pat_info)
Frees the pattern information structure.
SPHIQueryInfo * SPHIQueryInfoCopy(const SPHIQueryInfo *pat_info)
Copies the SPHIQueryInfo structure.
Structure to hold a sequence.
Int4 oid
The ordinal id of the current sequence.
Boolean sequence_allocated
TRUE if memory has been allocated for sequence.
Int4 length
Length of sequence.
Uint1 * sequence
Sequence used for search (could be translation).
The context related information.
Int4 query_length
Length of this query, strand or frame.
Boolean is_valid
Determine if this context is valid or not.
Int4 segment_flags
Flags describing segments for paired reads.
Int4 query_offset
Offset of this query, strand or frame in the concatenated super-query.
Int8 eff_searchsp
Effective search space for this context.
Int4 query_index
Index of query (same for all frames)
Int1 frame
Frame number (-1, -2, -3, 0, 1, 2, or 3)
The query related information.
Int4 first_context
Index of the first element of the context array.
BlastContextInfo * contexts
Information per context.
int num_queries
Number of query sequences.
struct SPHIQueryInfo * pattern_info
Counts of PHI BLAST pattern occurrences, used in PHI BLAST only.
Int4 last_context
Index of the last element of the context array.
static CS_CONTEXT * context
voidp calloc(uInt items, uInt size)