253
272
BlastCompo_SequenceRange * subject_range,
254
273
Int4 full_subject_length,
255
274
BlastCompo_GappingParams * gapping_params,
256
ECompoAdjustModes whichMode);
275
EMatrixAdjustRule matrix_adjust_rule);
277
/** Function type: free traceback data in a BlastCompo_Alignment.
279
* @param traceback_data data (of unknown type) to be freed
281
typedef void free_align_traceback_type(void * traceback_data);
258
284
/** Callbacks used by Blast_RedoOneMatch and
259
285
* Blast_RedoOneMatchSmithWaterman routines */
260
struct Blast_RedoAlignCallbacks {
286
typedef struct Blast_RedoAlignCallbacks {
287
/** @sa calc_lambda_type */
261
288
calc_lambda_type * calc_lambda;
289
/** @sa get_range_type */
262
290
get_range_type * get_range;
291
/** @sa redo_one_alignment_type */
263
292
redo_one_alignment_type * redo_one_alignment;
293
/** @sa new_xdrop_align_type */
264
294
new_xdrop_align_type * new_xdrop_align;
265
void (*free_align_traceback)(void*);
267
typedef struct Blast_RedoAlignCallbacks Blast_RedoAlignCallbacks;
295
/** @sa free_align_traceback_type */
296
free_align_traceback_type * free_align_traceback;
297
} Blast_RedoAlignCallbacks;
269
300
/** A parameter block for the Blast_RedoOneMatch and
270
301
* Blast_RedoOneMatchSmithWaterman routines */
271
struct Blast_RedoAlignParams {
272
Blast_MatrixInfo * matrix_info;
273
BlastCompo_GappingParams * gapping_params;
274
int adjustParameters;
277
int subject_is_translated;
278
int ccat_query_length;
284
const Blast_RedoAlignCallbacks * callbacks;
286
typedef struct Blast_RedoAlignParams Blast_RedoAlignParams;
302
typedef struct Blast_RedoAlignParams {
303
Blast_MatrixInfo * matrix_info; /**< information about the scoring
305
BlastCompo_GappingParams *
306
gapping_params; /**< parameters for performing a
308
ECompoAdjustModes compo_adjust_mode; /**< composition adjustment mode */
309
int positionBased; /**< true if the search is position-based */
310
int RE_pseudocounts; /**< number of pseudocounts to use in
311
relative-entropy based composition
313
int subject_is_translated; /**< true if the subject is translated */
314
int ccat_query_length; /**< length of the concatenated query, or
315
just the length of the query if not
317
int cutoff_s; /**< cutoff score for saving alignments when
318
HSP linking is used */
319
double cutoff_e; /**< cutoff e-value for saving alignments */
320
int do_link_hsps; /**< if true, then HSP linking and sum
321
statistics are used to computed e-values */
322
const Blast_RedoAlignCallbacks *
323
callbacks; /**< callback functions used by
324
the Blast_RedoAlign* functions */
325
} Blast_RedoAlignParams;
328
/** Create new Blast_RedoAlignParams object. The parameters of this
329
* function correspond directly to the fields of
330
* Blast_RedoAlignParams. The new Blast_RedoAlignParams object takes
331
* possession of *pmatrix_info and *pgapping_params, so these values
332
* are set to NULL on exit. */
289
333
NCBI_XBLAST_EXPORT
290
334
Blast_RedoAlignParams *
291
335
Blast_RedoAlignParamsNew(Blast_MatrixInfo ** pmatrix_info,
292
336
BlastCompo_GappingParams **pgapping_params,
293
int adjustParameters, int positionBased,
337
ECompoAdjustModes compo_adjust_mode,
294
339
int subject_is_translated,
295
340
int ccat_query_length, int cutoff_s,
296
double cutoff_e, int do_link_hsps, double Lambda,
341
double cutoff_e, int do_link_hsps,
298
342
const Blast_RedoAlignCallbacks * callbacks);
345
/** Free a set of Blast_RedoAlignParams */
300
346
NCBI_XBLAST_EXPORT
301
347
void Blast_RedoAlignParamsFree(Blast_RedoAlignParams ** pparams);
351
* Recompute all alignments for one query/subject pair using the
352
* Smith-Waterman algorithm and possibly also composition-based
353
* statistics or composition-based matrix adjustment.
355
* @param alignments an array of lists containing the newly
356
* computed alignments. There is one array
357
* element for each query in the original
359
* @param params parameters used to redo the alignments
360
* @param incoming_aligns a list of existing alignments
361
* @param hspcnt length of incoming_aligns
362
* @param Lambda statistical parameter
363
* @param logK statistical parameter
364
* @param matchingSeq the database sequence
365
* @param query_info information about all queries
366
* @param numQueries the number of queries
367
* @param matrix the scoring matrix
368
* @param NRrecord a workspace used to adjust the composition.
369
* @param forbidden a workspace used to hold forbidden ranges
370
* for the Smith-Waterman algorithm.
371
* @param significantMatches an array of heaps of alignments for
372
* query-subject pairs that have already
373
* been redone; used to terminate the
374
* Smith-Waterman algorithm early if it is
375
* clear that the current match is not
376
* significant enough to be saved.
377
* @param pvalueThisPair the compositional p-value for this pair of sequences
378
* @param compositionTestIndex index of the test function used to decide
379
* whether to use a compositional p-value
380
* @param LambdaRatio the ratio of the actual value of Lambda to the
383
* @return 0 on success, -1 on out-of-memory
303
385
NCBI_XBLAST_EXPORT
304
386
int Blast_RedoOneMatchSmithWaterman(BlastCompo_Alignment ** alignments,
305
387
Blast_RedoAlignParams * params,
306
BlastCompo_Alignment * in_aligns,
388
BlastCompo_Alignment * incoming_aligns,
390
double Lambda, double logK,
308
391
BlastCompo_MatchingSequence * matchingSeq,
309
BlastCompo_QueryInfo query[],
392
BlastCompo_QueryInfo query_info[],
312
395
Blast_CompositionWorkspace * NRrecord,
313
396
Blast_ForbiddenRanges * forbidden,
314
BlastCompo_Heap * significantMatches);
397
BlastCompo_Heap * significantMatches,
398
double *pvalueThisPair,
399
int compositionTestIndex,
400
double *LambdaRatio);
404
* Recompute all alignments for one query/subject pair using
405
* composition-based statistics or composition-based matrix adjustment.
407
* @param alignments an array of lists containing the newly
408
* computed alignments. There is one array
409
* element for each query in the original
411
* @param params parameters used to redo the alignments
412
* @param incoming_aligns a list of existing alignments
413
* @param hspcnt length of incoming_aligns
414
* @param Lambda statistical parameter
415
* @param matchingSeq the database sequence
416
* @param ccat_query_length the length of the concatenated query
417
* @param query_info information about all queries
418
* @param numQueries the number of queries
419
* @param matrix the scoring matrix
420
* @param NRrecord a workspace used to adjust the composition.
421
* @param pvalueThisPair the compositional p-value for this pair of sequences
422
* @param compositionTestIndex index of the test function used to decide
423
* whether to use a compositional p-value
424
* @param LambdaRatio the ratio of the actual value of Lambda to the
427
* @return 0 on success, -1 on out-of-memory
316
429
NCBI_XBLAST_EXPORT
317
430
int Blast_RedoOneMatch(BlastCompo_Alignment ** alignments,
318
431
Blast_RedoAlignParams * params,
319
432
BlastCompo_Alignment * incoming_aligns,
321
435
BlastCompo_MatchingSequence * matchingSeq,
322
436
int ccat_query_length,
323
BlastCompo_QueryInfo query[],
437
BlastCompo_QueryInfo query_info[],
326
Blast_CompositionWorkspace * NRrecord);
440
Blast_CompositionWorkspace * NRrecord,
441
double *pvalueThisPair,
442
int compositionTestIndex,
443
double *LambdaRatio);
446
/** Return true if a heuristic determines that it is unlikely to be
447
* worthwhile to redo a query-subject pair with the given e-value; used
448
* to terminate the main loop for redoing all alignments early. */
328
449
NCBI_XBLAST_EXPORT
329
450
int BlastCompo_EarlyTermination(double evalue,
330
451
BlastCompo_Heap significantMatches[],