NCBI C++ ToolKit
Functions
blast_extend.c File Reference

Functions to initialize structures used for BLAST extension. More...

#include <algo/blast/core/blast_extend.h>
#include <algo/blast/core/blast_options.h>
+ Include dependency graph for blast_extend.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Functions

static BLAST_DiagTables_BlastDiagTableNew (Int4 qlen, Boolean multiple_hits, Int4 window_size)
 Allocates memory for the BLAST_DiagTable*. More...
 
static BLAST_DiagTables_BlastDiagTableFree (BLAST_DiagTable *diag_table)
 Deallocate memory for the diagonal table structure. More...
 
static Int4 s_BlastDiagClear (BLAST_DiagTable *diag)
 Reset the diagonal array structure. More...
 
Int2 BlastExtendWordNew (Uint4 query_length, const BlastInitialWordParameters *word_params, Blast_ExtendWord **ewp_ptr)
 Initializes the word extension structure. More...
 
Int2 Blast_ExtendWordExit (Blast_ExtendWord *ewp, Int4 subject_length)
 Update the word extension structure after scanning of each subject sequence. More...
 
static BLAST_DiagHashs_BlastDiagHashFree (BLAST_DiagHash *hash_table)
 Deallocate memory for the hash table structure. More...
 
Blast_ExtendWordBlastExtendWordFree (Blast_ExtendWord *ewp)
 Deallocate memory for the word extension structure. More...
 
BlastInitHitListBLAST_InitHitListNew (void)
 Allocate memory for the BlastInitHitList structure. More...
 
void BlastInitHitListReset (BlastInitHitList *init_hitlist)
 Free the ungapped data substructures and reset initial HSP count to 0. More...
 
static void s_BlastInitHitListClean (BlastInitHitList *hi)
 empty an init hitlist but do not deallocate the base structure More...
 
void BlastInitHitListMove (BlastInitHitList *dst, BlastInitHitList *src)
 Move the contents of a BlastInitHitList structure. More...
 
BlastInitHitListBLAST_InitHitListFree (BlastInitHitList *init_hitlist)
 Free memory for the BlastInitList structure. More...
 
static int score_compare_match (const void *v1, const void *v2)
 Callback for sorting an array of initial HSP structures (not pointers to structures!) by score. More...
 
void Blast_InitHitListSortByScore (BlastInitHitList *init_hitlist)
 Sort array of initial HSPs by score. More...
 
Boolean Blast_InitHitListIsSortedByScore (BlastInitHitList *init_hitlist)
 Check if array of initial HSPs is sorted by score. More...
 
Boolean BLAST_SaveInitialHit (BlastInitHitList *init_hitlist, Int4 q_off, Int4 s_off, BlastUngappedData *ungapped_data)
 Save the initial hit data into the initial hit list structure. More...
 
void BlastSaveInitHsp (BlastInitHitList *ungapped_hsps, Int4 q_start, Int4 s_start, Int4 q_off, Int4 s_off, Int4 len, Int4 score)
 Add a new initial (ungapped) HSP to an initial hit list. More...
 

Detailed Description

Functions to initialize structures used for BLAST extension.

Definition in file blast_extend.c.

Function Documentation

◆ Blast_ExtendWordExit()

Int2 Blast_ExtendWordExit ( Blast_ExtendWord ewp,
Int4  subject_length 
)

Update the word extension structure after scanning of each subject sequence.

Parameters
ewpThe structure holding word extension information [in] [out]
subject_lengthThe length of the subject sequence that has just been processed [in]

Definition at line 162 of file blast_extend.c.

References BLAST_DiagHash::backbone, Blast_ExtendWord::diag_table, Blast_ExtendWord::hash_table, INT4_MAX, BLAST_DiagHash::num_buckets, BLAST_DiagHash::occupancy, BLAST_DiagTable::offset, BLAST_DiagHash::offset, s_BlastDiagClear(), BLAST_DiagTable::window, and BLAST_DiagHash::window.

Referenced by BlastNaWordFinder(), BOOST_AUTO_TEST_CASE(), s_BlastAaWordFinder_OneHit(), s_BlastAaWordFinder_TwoHit(), s_BlastRPSWordFinder_OneHit(), and s_BlastRPSWordFinder_TwoHit().

◆ BLAST_InitHitListFree()

BlastInitHitList* BLAST_InitHitListFree ( BlastInitHitList init_hitlist)

◆ Blast_InitHitListIsSortedByScore()

Boolean Blast_InitHitListIsSortedByScore ( BlastInitHitList init_hitlist)

Check if array of initial HSPs is sorted by score.

Parameters
init_hitlistInitial hit list structure to check. [in]
Returns
TRUE if sorted, FALSE otherwise.

Definition at line 312 of file blast_extend.c.

References FALSE, BlastInitHitList::init_hsp_array, score_compare_match(), BlastInitHitList::total, and TRUE.

Referenced by BLAST_GetGappedScore().

◆ BLAST_InitHitListNew()

BlastInitHitList* BLAST_InitHitListNew ( void  )

◆ Blast_InitHitListSortByScore()

void Blast_InitHitListSortByScore ( BlastInitHitList init_hitlist)

Sort array of initial HSPs by score.

Parameters
init_hitlistInitial hit list structure to check. [in]

Definition at line 306 of file blast_extend.c.

References BlastInitHitList::init_hsp_array, score_compare_match(), and BlastInitHitList::total.

Referenced by BlastAaWordFinder(), BlastNaWordFinder(), BlastRPSWordFinder(), BOOST_AUTO_TEST_CASE(), MB_IndexedWordFinder(), and s_TranslateHSPsToDNAPCoord().

◆ BLAST_SaveInitialHit()

Boolean BLAST_SaveInitialHit ( BlastInitHitList init_hitlist,
Int4  q_off,
Int4  s_off,
BlastUngappedData ungapped_data 
)

Save the initial hit data into the initial hit list structure.

Parameters
init_hitlistthe structure holding all the initial hits information [in] [out]
q_offThe query sequence offset [in]
s_offThe subject sequence offset [in]
ungapped_dataThe information about the ungapped extension of this hit [in]

Definition at line 325 of file blast_extend.c.

References BlastInitHitList::allocated, BlastInitHitList::do_not_reallocate, FALSE, BlastInitHitList::init_hsp_array, BlastInitHSP::offsets, BlastOffsetPair::q_off, BlastOffsetPair::qs_offsets, BlastOffsetPair::s_off, BlastInitHitList::total, TRUE, and BlastInitHSP::ungapped_data.

Referenced by BlastSaveInitHsp(), BOOST_AUTO_TEST_CASE(), s_BlastnDiagHashExtendInitialHit(), s_BlastnDiagTableExtendInitialHit(), s_PHISaveInitialHit(), CTrackedSeeds_Base< NHITS >::SaveSeed(), CBlastExtendTestFixture::setupGreedyHitList(), and CBlastExtendTestFixture::setupHitList().

◆ BlastExtendWordFree()

Blast_ExtendWord* BlastExtendWordFree ( Blast_ExtendWord ewp)

◆ BlastExtendWordNew()

Int2 BlastExtendWordNew ( Uint4  query_length,
const BlastInitialWordParameters word_params,
Blast_ExtendWord **  ewp_ptr 
)

◆ BlastInitHitListMove()

void BlastInitHitListMove ( BlastInitHitList dst,
BlastInitHitList src 
)

Move the contents of a BlastInitHitList structure.

Parameters
dstDestination hitlist [in][out]
srcSource hitlist (gets emptied of hits) [in][out]

Definition at line 248 of file blast_extend.c.

References BlastInitHitList::allocated, ASSERT, BlastInitHitList::do_not_reallocate, BlastInitHitList::init_hsp_array, memmove, s_BlastInitHitListClean(), and BlastInitHitList::total.

Referenced by CIndexedDb_Old::GetResults(), and CIndexedDb_New::GetResults().

◆ BlastInitHitListReset()

void BlastInitHitListReset ( BlastInitHitList init_hitlist)

Free the ungapped data substructures and reset initial HSP count to 0.

Definition at line 229 of file blast_extend.c.

References BlastInitHitList::init_hsp_array, sfree, BlastInitHitList::total, and BlastInitHSP::ungapped_data.

Referenced by CIndexedDb_Old::GetResults(), CIndexedDb_New::GetResults(), s_BlastInitHitListClean(), and s_BlastSearchEngineOneContext().

◆ BlastSaveInitHsp()

void BlastSaveInitHsp ( BlastInitHitList ungapped_hsps,
Int4  q_start,
Int4  s_start,
Int4  q_off,
Int4  s_off,
Int4  len,
Int4  score 
)

Add a new initial (ungapped) HSP to an initial hit list.

Parameters
ungapped_hspsHit list where to save a new HSP [in] [out]
q_startStarting offset in query [in]
s_startStarting offset in subject [in]
q_offOffset in query, where lookup table hit was found. [in]
s_offOffset in subject, where lookup table hit was found. [in]
lenLength of the ungapped match [in]
scoreScore of the ungapped match [in]

Definition at line 360 of file blast_extend.c.

References BLAST_SaveInitialHit(), len, BlastUngappedData::length, malloc(), NULL, BlastUngappedData::q_start, BlastUngappedData::s_start, and BlastUngappedData::score.

Referenced by s_BlastAaWordFinder_OneHit(), s_BlastAaWordFinder_TwoHit(), s_BlastRPSWordFinder_OneHit(), and s_BlastRPSWordFinder_TwoHit().

◆ s_BlastDiagClear()

static Int4 s_BlastDiagClear ( BLAST_DiagTable diag)
static

Reset the diagonal array structure.

Used when offset has wrapped around.

Parameters
diagpointer to the diagonal array structure [in]

Definition at line 87 of file blast_extend.c.

References BLAST_DiagTable::diag_array_length, DiagStruct::flag, BLAST_DiagTable::hit_len_array, BLAST_DiagTable::hit_level_array, i, DiagStruct::last_hit, n, NULL, BLAST_DiagTable::offset, and BLAST_DiagTable::window.

Referenced by Blast_ExtendWordExit().

◆ s_BlastDiagHashFree()

static BLAST_DiagHash* s_BlastDiagHashFree ( BLAST_DiagHash hash_table)
static

Deallocate memory for the hash table structure.

Parameters
hash_tableThe hash table structure to free. [in]
Returns
NULL.

Definition at line 191 of file blast_extend.c.

References BLAST_DiagHash::backbone, BLAST_DiagHash::chain, NULL, and sfree.

Referenced by BlastExtendWordFree().

◆ s_BlastDiagTableFree()

static BLAST_DiagTable* s_BlastDiagTableFree ( BLAST_DiagTable diag_table)
static

Deallocate memory for the diagonal table structure.

Parameters
diag_tablethe object to be freed [in]
Returns
NULL

Definition at line 74 of file blast_extend.c.

References BLAST_DiagTable::hit_len_array, BLAST_DiagTable::hit_level_array, NULL, and sfree.

Referenced by BlastExtendWordFree().

◆ s_BlastDiagTableNew()

static BLAST_DiagTable* s_BlastDiagTableNew ( Int4  qlen,
Boolean  multiple_hits,
Int4  window_size 
)
static

Allocates memory for the BLAST_DiagTable*.

This function also sets many of the parametes such as diag_array_length etc.

Parameters
qlenLength of the query [in]
multiple_hitsSpecifies whether multiple hits method is used [in]
window_sizeThe max. distance between two hits that are extended [in]
Returns
The allocated BLAST_DiagTable structure

Definition at line 42 of file blast_extend.c.

References calloc(), BLAST_DiagTable::diag_array_length, BLAST_DiagTable::diag_mask, BLAST_DiagTable::multiple_hits, BLAST_DiagTable::offset, BLAST_DiagTable::window, and window_size.

Referenced by BlastExtendWordNew().

◆ s_BlastInitHitListClean()

static void s_BlastInitHitListClean ( BlastInitHitList hi)
static

empty an init hitlist but do not deallocate the base structure

Parameters
hilist of initial hits to clean [in][out]

Definition at line 242 of file blast_extend.c.

References BlastInitHitListReset(), BlastInitHitList::init_hsp_array, and sfree.

Referenced by BLAST_InitHitListFree(), and BlastInitHitListMove().

◆ score_compare_match()

static int score_compare_match ( const void *  v1,
const void *  v2 
)
static

Callback for sorting an array of initial HSP structures (not pointers to structures!) by score.

Definition at line 274 of file blast_extend.c.

References BLAST_CMP, BlastUngappedData::length, NULL, BlastUngappedData::q_start, result, BlastUngappedData::s_start, BlastUngappedData::score, BlastInitHSP::ungapped_data, and v2.

Referenced by Blast_InitHitListIsSortedByScore(), and Blast_InitHitListSortByScore().

Modified on Tue Apr 23 07:38:50 2024 by modify_doxy.py rev. 669887