178
181
* @param number_of_contexts how many strands or sequences [in]
179
182
* @return BlastScoreBlk*
181
185
BlastScoreBlk* BlastScoreBlkNew (Uint1 alphabet, Int4 number_of_contexts);
183
187
/** Deallocates BlastScoreBlk as well as all associated structures.
184
188
* @param sbp BlastScoreBlk to be deallocated [in]
185
189
* @return NULL pointer.
187
192
BlastScoreBlk* BlastScoreBlkFree (BlastScoreBlk* sbp);
189
194
/** Set the ambiguous residue (e.g, 'N', 'X') in the BlastScoreBlk*.
193
198
* @param ambiguous_res the residue to be set on the BlastScoreBlk
194
199
* @return zero on success, others on error
196
202
Int2 BLAST_ScoreSetAmbigRes (BlastScoreBlk* sbp, char ambiguous_res);
199
205
/** Calculate and fill the ungapped Karlin-Altschul parameters in the
200
* BlastScoreBlk structure.
206
* BlastScoreBlk structure (fields kbp_std, kbp_psi, and kbp of that structure).
201
207
* @param program BLAST program type, needed to decide whether to substitute
202
208
* ideal values. [in]
203
209
* @param sbp Scoring block to work with [in] [out]
204
210
* @param query Buffer containing (concatenated) query sequence [in]
205
211
* @param query_info Information about offsets of concatenated queries [in]
206
* @return 0 if ungapped Karlin-Altschul parameters could be
207
* calculated for at least one context; 1 otherwise.
212
* @param blast_message returns queries that could not be processed [out]
213
* @return 0 if ungapped Karlin-Altschul parameters could be calculated for
214
* all of the query sequence's contexts; 1 if any of the contexts
215
* failed (but all others will be populated).
210
219
Blast_ScoreBlkKbpUngappedCalc(EBlastProgramType program,
211
220
BlastScoreBlk* sbp, Uint1* query,
212
const BlastQueryInfo* query_info);
221
const BlastQueryInfo* query_info,
222
Blast_Message* *blast_message);
214
224
/** This function fills in the BlastScoreBlk structure.
218
228
* @param sbp Scoring block [in] [out]
219
229
* @param matrix Full path to the matrix in the directory structure [in]
221
232
Int2 Blast_ScoreBlkMatrixFill (BlastScoreBlk* sbp, char* matrix);
223
234
/** Callocs a Blast_KarlinBlk
224
235
* @return pointer to the Blast_KarlinBlk
226
238
Blast_KarlinBlk* Blast_KarlinBlkNew (void);
228
240
/** Copies contents of one Karlin block to another. Both must be allocated
238
251
* @param kbp KarlinBlk to be deallocated [in]
241
255
Blast_KarlinBlk* Blast_KarlinBlkFree(Blast_KarlinBlk* kbp);
243
257
/** Fills in lambda, H, and K values, as calculated by Stephen Altschul
250
264
* @param error_return filled in with error message if needed [out]
251
265
* @return zero on success
253
268
Int2 Blast_KarlinBlkGappedCalc (Blast_KarlinBlk* kbp, Int4 gap_open,
254
269
Int4 gap_extend, Int4 decline_align, const char* matrix_name,
255
270
Blast_Message** error_return);
269
284
* score in some cases [in|out]
270
285
* @param error_return Pointer to error message. [in] [out]
273
289
Blast_KarlinBlkNuclGappedCalc(Blast_KarlinBlk* kbp, Int4 gap_open,
274
290
Int4 gap_extend, Int4 reward, Int4 penalty,
285
301
* @param sbp ScoreBlk used to calculate "ideal" values. [in|out]
286
302
* @return 0 on success, 1 on failure
288
305
Int2 Blast_ScoreBlkKbpIdealCalc(BlastScoreBlk* sbp);
290
307
/** Attempts to fill KarlinBlk for given gap opening, extensions etc.
298
315
* 1 if matrix not found
299
316
* 2 if matrix found, but open, extend etc. values not supported.
301
319
Int2 Blast_KarlinBlkGappedLoadFromTables(Blast_KarlinBlk* kbp, Int4 gap_open, Int4 gap_extend, Int4 decline_align, const char* matrix_name);
303
321
/** Prints a messages about the allowed matrices, BlastKarlinBlkGappedFill should return 1 before this is called.
304
322
* @param matrix the matrix to print a message about [in]
305
323
* @return the message
307
326
char* BLAST_PrintMatrixMessage(const char *matrix);
309
328
/** Prints a messages about the allowed open etc values for the given matrix,
314
333
* @param decline_align cost of declining to align [in]
315
334
* @return message
317
337
char* BLAST_PrintAllowedValues(const char *matrix, Int4 gap_open, Int4 gap_extend, Int4 decline_align);
319
339
/** Calculates the parameter Lambda given an initial guess for its value */
321
342
Blast_KarlinLambdaNR(Blast_ScoreFreq* sfp, double initialLambdaGuess);
327
348
* @param searchsp total search space to be used [in]
328
349
* @return the expect value
330
352
double BLAST_KarlinStoE_simple (Int4 S, Blast_KarlinBlk* kbp, Int8 searchsp);
332
354
/** Compute a divisor used to weight the evalue of a collection of
345
367
* @param nsegs the number of HSPs in the sum group [in]
346
368
* @return divisor used to compensate for multiple tests
348
371
double BLAST_GapDecayDivisor(double decayrate, unsigned nsegs );
350
373
/** Calculate the cutoff score from the expected number of HSPs or vice versa.
355
378
* @param dodecay Use gap decay feature? [in]
356
379
* @param gap_decay_rate Gap decay rate to use, if dodecay is set [in]
358
382
Int2 BLAST_Cutoffs (Int4 *S, double* E, Blast_KarlinBlk* kbp,
359
383
Int8 searchsp, Boolean dodecay, double gap_decay_rate);
373
397
* the calling routine [in]
374
398
* @return the expect value
376
401
double BLAST_SmallGapSumE (Int4 start_points, Int2 num, double xsum,
377
402
Int4 query_length, Int4 subject_length,
378
403
Int8 searchsp_eff, double weight_divisor);
400
425
* the calling routine [in]
401
426
* @return sum expect value.
403
429
double BLAST_UnevenGapSumE (Int4 query_start_points, Int4 subject_start_points,
404
430
Int2 num, double xsum,
405
431
Int4 query_length, Int4 subject_length,
418
444
* calling routine [in]
419
445
* @return sum expect value.
421
448
double BLAST_LargeGapSumE (Int2 num, double xsum,
422
449
Int4 query_length, Int4 subject_length,
423
450
Int8 searchsp_eff, double weight_divisor );
456
485
* @param gap_extend extension cost of a gap [in]
457
486
* @param kbp_ungapped Karlin block with ungapped values of the parameters [in]
459
489
void BLAST_GetAlphaBeta (const char* matrixName, double *alpha,
460
490
double *beta, Boolean gapped, Int4 gap_open,
461
491
Int4 gap_extend, const Blast_KarlinBlk* kbp_ungapped);
474
504
* @param alpha Alpha parameter for this scoring system [out]
475
505
* @param beta Beta parameter for this scoring system [out]
477
508
Int2 Blast_GetNuclAlphaBeta(Int4 reward, Int4 penalty, Int4 gap_open,
478
509
Int4 gap_extend, Blast_KarlinBlk* kbp,
479
510
Boolean gapped_calculation,
495
526
* @param matrix_name Name of the score matrix underlying the RPS search [in]
496
527
* @return rescaled pssm
498
530
Int4 ** RPSRescalePssm(double scalingFactor, Int4 rps_query_length,
499
531
const Uint1 * rps_query_seq, Int4 db_seq_length,
500
532
Int4 **posMatrix, const char *matrix_name);
554
587
based upon the contents of sbp.
555
588
* @param sbp The BlastScoreBlk* used to init prob [in]
557
591
Blast_ResFreq* Blast_ResFreqNew(const BlastScoreBlk* sbp);
559
593
/** Deallocates Blast_ResFreq and prob0 element.
560
594
* @param rfp the Blast_ResFreq to be deallocated.
562
597
Blast_ResFreq* Blast_ResFreqFree(Blast_ResFreq* rfp);
567
602
* @param rfp the prob element on this Blast_ResFreq is used.
568
603
* @return zero on success
570
606
Int2 Blast_ResFreqStdComp(const BlastScoreBlk* sbp, Blast_ResFreq* rfp);
572
608
/** Creates a new structure to keep track of score frequencies for a scoring