NCBI C++ ToolKit
Functions
blast_setup.h File Reference

Utilities initialize/setup BLAST. More...

#include <algo/blast/core/ncbi_std.h>
#include <algo/blast/core/blast_export.h>
#include <algo/blast/core/blast_def.h>
#include <algo/blast/core/blast_query_info.h>
#include <algo/blast/core/blast_options.h>
#include <algo/blast/core/blast_parameters.h>
#include <algo/blast/core/blast_message.h>
#include <algo/blast/core/blast_stat.h>
#include <algo/blast/core/blast_gapalign.h>
#include <algo/blast/core/pattern.h>
+ Include dependency graph for blast_setup.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

Int2 BLAST_MainSetUp (EBlastProgramType program_number, const QuerySetUpOptions *qsup_options, const BlastScoringOptions *scoring_options, BLAST_SequenceBlk *query_blk, const BlastQueryInfo *query_info, double scale_factor, BlastSeqLoc **lookup_segments, BlastMaskLoc **mask, BlastScoreBlk **sbpp, Blast_Message **blast_message, GET_MATRIX_PATH get_path)
 "Main" setup routine for BLAST. More...
 
Int2 Blast_ScoreBlkKbpGappedCalc (BlastScoreBlk *sbp, const BlastScoringOptions *scoring_options, EBlastProgramType program, const BlastQueryInfo *query_info, Blast_Message **error_return)
 Blast_ScoreBlkKbpGappedCalc, fills the ScoreBlkPtr for a gapped search. More...
 
Int2 BLAST_CalcEffLengths (EBlastProgramType program_number, const BlastScoringOptions *scoring_options, const BlastEffectiveLengthsParameters *eff_len_params, const BlastScoreBlk *sbp, BlastQueryInfo *query_info, Blast_Message **blast_message)
 Function to calculate effective query length and db length as well as effective search space. More...
 
Int2 BLAST_GapAlignSetUp (EBlastProgramType program_number, const BlastSeqSrc *seq_src, const BlastScoringOptions *scoring_options, const BlastEffectiveLengthsOptions *eff_len_options, const BlastExtensionOptions *ext_options, const BlastHitSavingOptions *hit_options, BlastQueryInfo *query_info, BlastScoreBlk *sbp, BlastScoringParameters **score_params, BlastExtensionParameters **ext_params, BlastHitSavingParameters **hit_params, BlastEffectiveLengthsParameters **eff_len_params, BlastGapAlignStruct **gap_align)
 Set up the auxiliary structures for gapped alignment / traceback only. More...
 
Int2 BLAST_OneSubjectUpdateParameters (EBlastProgramType program_number, Uint4 subject_length, const BlastScoringOptions *scoring_options, BlastQueryInfo *query_info, const BlastScoreBlk *sbp, BlastHitSavingParameters *hit_params, BlastInitialWordParameters *word_params, BlastEffectiveLengthsParameters *eff_len_params)
 Recalculates the parameters that depend on an individual sequence, if this is not a database search. More...
 
Int2 Blast_ScoreBlkMatrixInit (EBlastProgramType program_number, const BlastScoringOptions *scoring_options, BlastScoreBlk *sbp, GET_MATRIX_PATH get_path)
 Initializes the substitution matrix in the BlastScoreBlk according to the scoring options specified. More...
 
Int2 BlastSetup_ScoreBlkInit (BLAST_SequenceBlk *query_blk, const BlastQueryInfo *query_info, const BlastScoringOptions *scoring_options, EBlastProgramType program_number, BlastScoreBlk **sbpp, double scale_factor, Blast_Message **blast_message, GET_MATRIX_PATH get_path)
 Initializes the score block structure. More...
 
void BlastSeqLoc_RestrictToInterval (BlastSeqLoc **mask, Int4 from, Int4 to)
 Adjusts the mask locations coordinates to a sequence interval. More...
 
Int2 Blast_SetPHIPatternInfo (EBlastProgramType program, const SPHIPatternSearchBlk *pattern_blk, const BLAST_SequenceBlk *query, const BlastSeqLoc *lookup_segments, BlastQueryInfo *query_info, Blast_Message **blast_message)
 In a PHI BLAST search, adds pattern information to the BlastQueryInfo structure. More...
 
void BLAST_GetSubjectTotals (const BlastSeqSrc *seqsrc, Int8 *total_length, Int4 *num_seqs)
 Auxiliary function to retrieve the subject's number of sequences and total length. More...
 
Int2 BlastSetup_Validate (const BlastQueryInfo *query_info, const BlastScoreBlk *score_blk)
 Validation function for the setup of queries for the BLAST search. More...
 

Detailed Description

Utilities initialize/setup BLAST.

Definition in file blast_setup.h.

Function Documentation

◆ BLAST_CalcEffLengths()

Int2 BLAST_CalcEffLengths ( EBlastProgramType  program_number,
const BlastScoringOptions scoring_options,
const BlastEffectiveLengthsParameters eff_len_params,
const BlastScoreBlk sbp,
BlastQueryInfo query_info,
Blast_Message **  blast_message 
)

Function to calculate effective query length and db length as well as effective search space.

Parameters
program_numberblastn, blastp, blastx, etc. [in]
scoring_optionsoptions for scoring. [in]
eff_len_paramsUsed to calculate effective lengths [in]
sbpKarlin-Altschul parameters [out]
query_infoThe query information block, which stores the effective search spaces for all queries [in] [out]
blast_messageError message [out]

Definition at line 699 of file blast_setup.c.

References BLAST_ComputeLengthAdjustment(), BLAST_GetAlphaBeta(), Blast_GetNuclAlphaBeta(), BLAST_PENALTY, Blast_ProgramIsMapping(), Blast_ProgramIsPhiBlast(), BLAST_REWARD, Blast_SubjectIsTranslated(), BlastEffectiveLengthsOptions_IsSearchSpaceSet(), BlastQueryInfo::contexts, BlastEffectiveLengthsOptions::db_length, BlastEffectiveLengthsOptions::dbseq_num, eBlastTypeBlastn, BlastContextInfo::eff_searchsp, BlastQueryInfo::first_context, BlastScoringOptions::gap_extend, BlastScoringOptions::gap_open, BlastScoringOptions::gapped_calculation, BlastContextInfo::is_valid, Blast_KarlinBlk::K, BlastScoreBlk::kbp, BlastScoreBlk::kbp_gap_std, BlastScoreBlk::kbp_std, Blast_KarlinBlk::Lambda, BlastContextInfo::length_adjustment, Blast_KarlinBlk::logK, BlastScoreBlk::name, BlastEffectiveLengthsParameters::options, BlastScoringOptions::penalty, BlastContextInfo::query_length, BlastEffectiveLengthsParameters::real_db_length, BlastEffectiveLengthsParameters::real_num_seqs, BlastScoringOptions::reward, and s_GetEffectiveSearchSpaceForContext().

Referenced by BLAST_GapAlignSetUp(), BLAST_OneSubjectUpdateParameters(), BOOST_AUTO_TEST_CASE(), CEffectiveSearchSpaceCalculator::CEffectiveSearchSpaceCalculator(), LinkHspTestFixture::fillEffectiveLengths(), CBlastExtendTestFixture::fillEffectiveLengths(), and CRedoAlignmentTestFixture::runRedoAlignmentCoreUnitTest().

◆ BLAST_GapAlignSetUp()

Int2 BLAST_GapAlignSetUp ( EBlastProgramType  program_number,
const BlastSeqSrc seq_src,
const BlastScoringOptions scoring_options,
const BlastEffectiveLengthsOptions eff_len_options,
const BlastExtensionOptions ext_options,
const BlastHitSavingOptions hit_options,
BlastQueryInfo query_info,
BlastScoreBlk sbp,
BlastScoringParameters **  score_params,
BlastExtensionParameters **  ext_params,
BlastHitSavingParameters **  hit_params,
BlastEffectiveLengthsParameters **  eff_len_params,
BlastGapAlignStruct **  gap_align 
)

Set up the auxiliary structures for gapped alignment / traceback only.

Parameters
program_numberblastn, blastp, blastx, etc. [in]
seq_srcSequence source information, with callbacks to get sequences, their lengths, etc. [in]
scoring_optionsoptions for scoring. [in]
eff_len_optionsOptions overriding real database sizes for calculating effective lengths [in]
ext_optionsoptions for gapped extension. [in]
hit_optionsoptions for saving hits. [in]
query_infoThe query information block [in]
sbpContains scoring information. [in]
score_paramsParameters for scoring [out]
ext_paramsParameters for gapped extension [out]
hit_paramsParameters for saving hits [out]
eff_len_paramsParameters for search space calculations [out]
gap_alignGapped alignment information and allocated memory [out]

Definition at line 888 of file blast_setup.c.

References BLAST_CalcEffLengths(), BLAST_GapAlignStructNew(), Blast_SubjectIsTranslated(), BlastEffectiveLengthsParametersFree(), BlastEffectiveLengthsParametersNew(), BLASTERR_SUBJECT_LENGTH_INVALID, BlastExtensionParametersFree(), BlastExtensionParametersNew(), BlastHitSavingParametersNew(), BlastScoringParametersFree(), BlastScoringParametersNew(), BlastSeqSrcGetMaxSeqLen(), BlastSeqSrcGetMinSeqLen(), BlastSeqSrcGetNumSeqs(), BlastSeqSrcGetNumSeqsStats(), BlastSeqSrcGetSeqLen(), BlastSeqSrcGetTotLen(), BlastSeqSrcGetTotLenStats(), BlastEffectiveLengthsOptions::db_length, Blast_GumbelBlk::db_length, BlastScoreBlk::gbp, and NULL.

Referenced by Blast_RunFullSearch(), Blast_RunPreliminarySearchWithInterrupt(), SThreadLocalDataArraySetup(), and CTracebackTestFixture::x_SetupGapAlign().

◆ BLAST_GetSubjectTotals()

void BLAST_GetSubjectTotals ( const BlastSeqSrc seqsrc,
Int8 total_length,
Int4 num_seqs 
)

Auxiliary function to retrieve the subject's number of sequences and total length.

Note
In the case of a Blast2Sequences search, this function assumes a single sequence and returns the length of the first sequence only

Definition at line 853 of file blast_setup.c.

References ASSERT, BlastSeqSrcGetNumSeqs(), BlastSeqSrcGetNumSeqsStats(), BlastSeqSrcGetSeqLen(), BlastSeqSrcGetTotLen(), and BlastSeqSrcGetTotLenStats().

◆ BLAST_MainSetUp()

Int2 BLAST_MainSetUp ( EBlastProgramType  program_number,
const QuerySetUpOptions qsup_options,
const BlastScoringOptions scoring_options,
BLAST_SequenceBlk query_blk,
const BlastQueryInfo query_info,
double  scale_factor,
BlastSeqLoc **  lookup_segments,
BlastMaskLoc **  mask,
BlastScoreBlk **  sbpp,
Blast_Message **  blast_message,
GET_MATRIX_PATH  get_path 
)

"Main" setup routine for BLAST.

Calculates all information for BLAST search that is dependent on the ASN.1 structures.

Parameters
program_numberType of BLAST program (0=blastn, ...). [in]
qsup_optionsoptions for query setup. [in]
scoring_optionsoptions for scoring. [in]
query_blkBLAST_SequenceBlk* for the query. [in]
query_infoThe query information block [in]
scale_factorMultiplier for cutoff and dropoff scores [in]
lookup_segmentsStart/stop locations for non-masked query segments [out]
maskmasking locations. [out]
sbppContains scoring information. [out]
blast_messageerror or warning [out]
get_pathcallback function to get matrix path [in]

Definition at line 563 of file blast_setup.c.

References ASSERT, BLAST_ComplementMaskLocations(), BLAST_CreateMixedFrameDNATranslation(), Blast_PerrorWithLocation, Blast_QueryIsTranslated(), BlastFilteringOptionsFromString(), BlastMaskLocFree(), BlastMaskLocProteinToDNA(), BlastSetUp_GetFilteringLocations(), BlastSetUp_MaskQuery(), BlastSetup_ScoreBlkInit(), BlastSetup_Validate(), eBlastTypeBlastx, FALSE, QuerySetUpOptions::filter_string, QuerySetUpOptions::filtering_options, BlastScoringOptions::is_ooframe, kBlastMessageNoContext, mask, NULL, SBlastFilterOptionsFree(), SBlastFilterOptionsMaskAtHash(), and TRUE.

Referenced by BOOST_AUTO_TEST_CASE(), CSetupFactory::CreateScoreBlock(), and CTracebackTestFixture::x_SetupMain().

◆ BLAST_OneSubjectUpdateParameters()

Int2 BLAST_OneSubjectUpdateParameters ( EBlastProgramType  program_number,
Uint4  subject_length,
const BlastScoringOptions scoring_options,
BlastQueryInfo query_info,
const BlastScoreBlk sbp,
BlastHitSavingParameters hit_params,
BlastInitialWordParameters word_params,
BlastEffectiveLengthsParameters eff_len_params 
)

Recalculates the parameters that depend on an individual sequence, if this is not a database search.

Parameters
program_numberBLAST program [in]
subject_lengthLength of the current subject sequence [in]
scoring_optionsScoring options [in]
query_infoThe query information structure. Effective lengths are recalculated here. [in] [out]
sbpScoring statistical parameters [in]
hit_paramsParameters for saving hits. Score cutoffs are recalculated here [in] [out]
word_paramsParameters for ungapped extension. Score cutoffs are recalculated here [in] [out]
eff_len_paramsParameters for effective lengths calculation. Reset with the current sequence data [in] [out]

Definition at line 1001 of file blast_setup.c.

References BLAST_CalcEffLengths(), BlastHitSavingParametersUpdate(), BlastInitialWordParametersUpdate(), BlastLinkHSPParametersUpdate(), BlastScoringOptions::gapped_calculation, NULL, and BlastEffectiveLengthsParameters::real_db_length.

Referenced by BLAST_ComputeTraceback_MT(), and BLAST_PreliminarySearchEngine().

◆ Blast_ScoreBlkKbpGappedCalc()

Int2 Blast_ScoreBlkKbpGappedCalc ( BlastScoreBlk sbp,
const BlastScoringOptions scoring_options,
EBlastProgramType  program,
const BlastQueryInfo query_info,
Blast_Message **  error_return 
)

Blast_ScoreBlkKbpGappedCalc, fills the ScoreBlkPtr for a gapped search.

Should be moved to blast_stat.c in the future.

Parameters
sbpContains fields to be set, should not be NULL. [out]
scoring_optionsScoring_options [in]
programUsed to set fields on sbp [in]
query_infoQuery information containing context information [in]
error_returnPointer to structure for returning errors. [in][out]
Returns
Status.

Definition at line 41 of file blast_setup.c.

References Blast_GumbelBlkCalc(), Blast_KarlinBlkCopy(), Blast_KarlinBlkGappedCalc(), Blast_KarlinBlkNew(), Blast_KarlinBlkNuclGappedCalc(), BLAST_PENALTY, Blast_PerrorWithLocation, Blast_QueryIsPssm(), BLAST_REWARD, BLASTERR_INVALIDPARAM, BlastQueryInfo::contexts, eBlastTypeBlastn, eBlastTypeMapping, BlastQueryInfo::first_context, BlastScoringOptions::gap_extend, BlastScoringOptions::gap_open, BlastScoreBlk::gbp, BlastContextInfo::is_valid, BlastScoreBlk::kbp_gap, BlastScoreBlk::kbp_gap_psi, BlastScoreBlk::kbp_gap_std, BlastScoreBlk::kbp_std, BlastScoreBlk::name, NULL, BlastScoringOptions::penalty, BlastScoringOptions::reward, and BlastScoreBlk::round_down.

Referenced by BlastSetup_ScoreBlkInit(), LinkHspTestFixture::setupScoreBlk(), and CBlastExtendTestFixture::setupStructures().

◆ Blast_ScoreBlkMatrixInit()

Int2 Blast_ScoreBlkMatrixInit ( EBlastProgramType  program_number,
const BlastScoringOptions scoring_options,
BlastScoreBlk sbp,
GET_MATRIX_PATH  get_path 
)

◆ Blast_SetPHIPatternInfo()

Int2 Blast_SetPHIPatternInfo ( EBlastProgramType  program,
const SPHIPatternSearchBlk pattern_blk,
const BLAST_SequenceBlk query,
const BlastSeqLoc lookup_segments,
BlastQueryInfo query_info,
Blast_Message **  blast_message 
)

In a PHI BLAST search, adds pattern information to the BlastQueryInfo structure.

Parameters
programType of PHI BLAST program [in]
pattern_blkAuxiliary pattern items structure [in]
queryQuery sequence [in]
lookup_segmentsLocations on query sequence to find pattern on [in]
query_infoQuery information structure, where pattern occurrences will be saved. [in][out]
blast_messagewill be filled in if pattern not found on query [in][out]
Returns
Status, 0 on success, -1 on error.

Definition at line 1065 of file blast_setup.c.

References ASSERT, Blast_MessageWrite(), Blast_ProgramIsPhiBlast(), BlastMemDup(), buffer, BlastQueryInfo::contexts, eBlastSevWarning, eBlastTypePhiBlastn, INT4_MAX, kBlastMessageNoContext, BlastContextInfo::length_adjustment, SPHIPatternSearchBlk::minPatternMatchLength, SPHIQueryInfo::pattern, SPHIPatternSearchBlk::pattern, BlastQueryInfo::pattern_info, SPHIPatternSearchBlk::patternProbability, PHIGetPatternOccurrences(), SPHIQueryInfo::probability, query, and SPHIQueryInfoNew().

Referenced by CSetupFactory::CreateLookupTable(), and CPhiblastTestFixture::x_FindQueryOccurrences().

◆ BlastSeqLoc_RestrictToInterval()

void BlastSeqLoc_RestrictToInterval ( BlastSeqLoc **  mask,
Int4  from,
Int4  to 
)

Adjusts the mask locations coordinates to a sequence interval.

Removes those mask locations that do not intersect the interval. Can do this either for all queries or only for the first one.

Parameters
maskStructure containing a mask location. [in] [out]
fromStarting offset of a sequence interval [in]
toEnding offset of a sequence interval [in]

Definition at line 1030 of file blast_setup.c.

References BlastSeqLocNodeFree(), mask, MAX, MIN, BlastSeqLoc::next, and NULL.

Referenced by BOOST_AUTO_TEST_CASE(), s_GetRestrictedBlastSeqLocs(), and s_RestrictSeqLocs_Multiframe().

◆ BlastSetup_ScoreBlkInit()

Int2 BlastSetup_ScoreBlkInit ( BLAST_SequenceBlk query_blk,
const BlastQueryInfo query_info,
const BlastScoringOptions scoring_options,
EBlastProgramType  program_number,
BlastScoreBlk **  sbpp,
double  scale_factor,
Blast_Message **  blast_message,
GET_MATRIX_PATH  get_path 
)

◆ BlastSetup_Validate()

Int2 BlastSetup_Validate ( const BlastQueryInfo query_info,
const BlastScoreBlk score_blk 
)

Validation function for the setup of queries for the BLAST search.

Parameters
query_infoproperly set up BlastQueryInfo structure [in]
score_blkoptional properly set up BlastScoreBlk structure (may be NULL)[in]
Returns
If no valid queries are found, 1 is returned, otherwise 0.

Definition at line 535 of file blast_setup.c.

References ASSERT, BlastQueryInfo::contexts, FALSE, BlastQueryInfo::first_context, BlastContextInfo::is_valid, BlastScoreBlk::kbp, BlastScoreBlk::kbp_gap, NULL, BlastScoreBlk::sfp, and TRUE.

Referenced by BLAST_MainSetUp(), and SetupQueries_OMF().

Modified on Tue Apr 23 07:36:52 2024 by modify_doxy.py rev. 669887