62
62
#define CODON_LENGTH 3
65
/** for traslated gapped searches, this is the default value in nucleotides of
65
/** For translated gapped searches, this is the default value in
66
* nucleotides of longest_intron (for ungapped translated searches,
67
* the default value of longest_intron is zero, which causes a legacy
68
* method of HSP linking that does not use longest_intron to be
71
* The value 122 corresponds to 40 amino acids: 40 codons * 3
72
* nucleotides per codon + up to 2 frame shifts. 40 amino acids is
73
* the maximum gap size in the untranslated sequence, so
74
* DEFAULT_LONGEST_INTRON makes these two gap sizes equal.
67
76
#ifndef DEFAULT_LONGEST_INTRON
68
77
#define DEFAULT_LONGEST_INTRON 122
150
159
Uint1* sequence_start; /**< Start of sequence, usually one byte before
151
160
sequence as that byte is a NULL sentinel byte.*/
152
161
Int4 length; /**< Length of sequence. */
153
Int4 context; /**< Context of the query, needed for multi-query searches */
154
162
Int2 frame; /**< Frame of the query, needed for translated searches */
155
163
Int4 oid; /**< The ordinal id of the current sequence */
156
164
Boolean sequence_allocated; /**< TRUE if memory has been allocated for
169
177
} BLAST_SequenceBlk;
171
/** The context related information
173
typedef struct BlastContextInfo {
174
Int4 query_offset; /**< Offset of this query, strand or frame in the
175
concatenated super-query. */
176
Int4 query_length; /**< Length of this query, strand or frame */
177
Int8 eff_searchsp; /**< Effective search space for this context. */
178
Int4 length_adjustment; /**< Length adjustment for boundary conditions */
179
Int4 query_index; /**< Index of query (same for all frames) */
180
Int1 frame; /**< Frame number (-1, -2, -3, 0, 1, 2, or 3) */
183
179
/** Information about a single pattern occurence in the query. */
184
180
typedef struct SPHIPatternInfo {
185
181
Int4 offset; /**< Starting offset of this pattern occurrence. */
197
193
double probability; /**< Probability of the pattern */
200
/** The query related information
202
typedef struct BlastQueryInfo {
203
Int4 first_context; /**< Index of the first element of the context array */
204
Int4 last_context; /**< Index of the last element of the context array */
205
int num_queries; /**< Number of query sequences */
206
BlastContextInfo * contexts; /**< Information per context */
207
Uint4 max_length; /**< Length of the longest among the concatenated
209
SPHIQueryInfo* pattern_info; /**< Counts of PHI BLAST pattern
210
occurrences, used in PHI BLAST only. */
196
/************************* Progress monitoring/interruptible API *************/
198
/** Enumeration for the stages in the BLAST search */
199
typedef enum EBlastStage {
204
/** Progress monitoring structure. This is updated by the engine to provided to
205
* the user as an argument to the user-supplied callback function
206
* (TInterruptFnPtr). This function then can assess whether the search
207
* should proceed or exit prematurely.
208
* @sa TInterruptFnPtr
210
typedef struct SBlastProgress {
211
EBlastStage stage; /**< Stage of the BLAST search currently in
213
void* user_data; /**< Pointer to user-provided data */
216
/** Prototype for function pointer to determine whether the BLAST search
217
* should proceed or be interrupted. If this function returns true, all
218
* processing must stop and the search must discard all interim results
219
* @note In order to avoid undue overhead, this function should not perform any
220
* time consuming operations and should always return (i.e.: it should never
223
typedef Boolean (*TInterruptFnPtr) (SBlastProgress* progress_info);
225
/** Allocates and initializes a new SBlastProgress structure.
226
* @param user_data user-provided data (not owned by the resulting structure)
228
* Implemented in blast_util.c
230
SBlastProgress* SBlastProgressNew(void* user_data);
232
/** Deallocates a SBlastProgress structure.
233
* Implemented in blast_util.c */
234
SBlastProgress* SBlastProgressFree(SBlastProgress* progress_info);
236
/** Resets the progress structure to its original state (as if newly allocated)
237
* for a fresh start without touching the user_data field */
238
void SBlastProgressReset(SBlastProgress* progress_info);
214
240
#ifdef __cplusplus