NCBI C++ ToolKit
|
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>
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... | |
Utilities initialize/setup BLAST.
Definition in file blast_setup.h.
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.
program_number | blastn, blastp, blastx, etc. [in] |
scoring_options | options for scoring. [in] |
eff_len_params | Used to calculate effective lengths [in] |
sbp | Karlin-Altschul parameters [out] |
query_info | The query information block, which stores the effective search spaces for all queries [in] [out] |
blast_message | Error 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().
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.
program_number | blastn, blastp, blastx, etc. [in] |
seq_src | Sequence source information, with callbacks to get sequences, their lengths, etc. [in] |
scoring_options | options for scoring. [in] |
eff_len_options | Options overriding real database sizes for calculating effective lengths [in] |
ext_options | options for gapped extension. [in] |
hit_options | options for saving hits. [in] |
query_info | The query information block [in] |
sbp | Contains scoring information. [in] |
score_params | Parameters for scoring [out] |
ext_params | Parameters for gapped extension [out] |
hit_params | Parameters for saving hits [out] |
eff_len_params | Parameters for search space calculations [out] |
gap_align | Gapped 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().
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.
Definition at line 853 of file blast_setup.c.
References ASSERT, BlastSeqSrcGetNumSeqs(), BlastSeqSrcGetNumSeqsStats(), BlastSeqSrcGetSeqLen(), BlastSeqSrcGetTotLen(), and BlastSeqSrcGetTotLenStats().
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.
program_number | Type of BLAST program (0=blastn, ...). [in] |
qsup_options | options for query setup. [in] |
scoring_options | options for scoring. [in] |
query_blk | BLAST_SequenceBlk* for the query. [in] |
query_info | The query information block [in] |
scale_factor | Multiplier for cutoff and dropoff scores [in] |
lookup_segments | Start/stop locations for non-masked query segments [out] |
mask | masking locations. [out] |
sbpp | Contains scoring information. [out] |
blast_message | error or warning [out] |
get_path | callback 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().
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.
program_number | BLAST program [in] |
subject_length | Length of the current subject sequence [in] |
scoring_options | Scoring options [in] |
query_info | The query information structure. Effective lengths are recalculated here. [in] [out] |
sbp | Scoring statistical parameters [in] |
hit_params | Parameters for saving hits. Score cutoffs are recalculated here [in] [out] |
word_params | Parameters for ungapped extension. Score cutoffs are recalculated here [in] [out] |
eff_len_params | Parameters 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().
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.
sbp | Contains fields to be set, should not be NULL. [out] |
scoring_options | Scoring_options [in] |
program | Used to set fields on sbp [in] |
query_info | Query information containing context information [in] |
error_return | Pointer to structure for returning errors. [in][out] |
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().
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.
program_number | Used to set fields on sbp [in] |
scoring_options | Scoring_options [in] |
sbp | Contains fields to be set, should not be NULL. [out] |
get_path | callback function to get matrix path [in] |
Definition at line 330 of file blast_setup.c.
References BLAST_PENALTY, BLAST_REWARD, Blast_ScoreBlkMatrixFill(), BLAST_ScoreSetAmbigRes(), BLAST_StrToUpper(), buffer, eBlastTypeBlastn, eBlastTypeMapping, FALSE, BlastScoringOptions::matrix, BlastScoreBlk::matrix_only_scoring, BlastScoreBlk::name, NULLB, BlastScoringOptions::penalty, BlastScoreBlk::penalty, BlastScoreBlk::read_in_matrix, BlastScoringOptions::reward, BlastScoreBlk::reward, strdup, and TRUE.
Referenced by AascanTestFixture::AascanTestFixture(), BlastSetup_ScoreBlkInit(), BOOST_AUTO_TEST_CASE(), CompressedAascanTestFixture::CompressedAascanTestFixture(), CompressedAalookupTestFixture::FillLookupTable(), AalookupTestFixture::FillLookupTable(), NuclWordFinderTextFixture::setupScoreBlk(), LinkHspTestFixture::setupScoreBlk(), CBlastExtendTestFixture::setupStructures(), and CScoreBuilder::x_Initialize().
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.
program | Type of PHI BLAST program [in] |
pattern_blk | Auxiliary pattern items structure [in] |
query | Query sequence [in] |
lookup_segments | Locations on query sequence to find pattern on [in] |
query_info | Query information structure, where pattern occurrences will be saved. [in][out] |
blast_message | will be filled in if pattern not found on query [in][out] |
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().
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.
mask | Structure containing a mask location. [in] [out] |
from | Starting offset of a sequence interval [in] |
to | Ending 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().
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.
query_blk | Query sequence(s) [in] |
query_info | Additional query information [in] |
scoring_options | Scoring options [in] |
program_number | BLAST program type [in] |
sbpp | Initialized score block [out] |
scale_factor | Matrix scaling factor for this search [in] |
blast_message | Error message [out] |
get_path | callback function to get matrix path [in] |
Definition at line 456 of file blast_setup.c.
References ASSERT, Blast_PerrorWithLocation, Blast_ProgramIsMapping(), Blast_ProgramIsPhiBlast(), Blast_ScoreBlkKbpGappedCalc(), Blast_ScoreBlkKbpUngappedCalc(), Blast_ScoreBlkMatrixInit(), BLASTAA_SEQ_CODE, BLASTERR_MEMORY, BLASTNA_SEQ_CODE, BlastScoreBlkNew(), BlastScoringOptions::complexity_adjusted_scoring, BlastScoreBlk::complexity_adjusted_scoring, eBlastTypeBlastn, eBlastTypeMapping, BlastScoringOptions::gapped_calculation, BlastScoreBlk::gbp, kBlastMessageNoContext, BlastScoreBlk::kbp_gap, BlastQueryInfo::last_context, NULL, s_JumperScoreBlkFill(), s_PHIScoreBlkFill(), BlastScoreBlk::scale_factor, BLAST_SequenceBlk::sequence, and sfree.
Referenced by BLAST_MainSetUp(), BOOST_AUTO_TEST_CASE(), CPhiblastTestFixture::CPhiblastTestFixture(), InitializeBlastScoreBlk(), CRedoAlignmentTestFixture::runRedoAlignmentCoreUnitTest(), TestFixture::SetUpLookupTable(), CPssmEngine::x_InitializeScoreBlock(), and CSeedTop::x_MakeScoreBlk().
Int2 BlastSetup_Validate | ( | const BlastQueryInfo * | query_info, |
const BlastScoreBlk * | score_blk | ||
) |
Validation function for the setup of queries for the BLAST search.
query_info | properly set up BlastQueryInfo structure [in] |
score_blk | optional properly set up BlastScoreBlk structure (may be NULL)[in] |
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().