92 if (!results || !params)
99 #ifdef ERR_POST_EX_DEFINED
113 if (hsp_list_array ==
NULL)
116 for (index = 0; index < hsp_list->
hspcnt; index++) {
121 if (!(tmp_hsp_list = hsp_list_array[query_index])) {
122 hsp_list_array[query_index] = tmp_hsp_list =
124 if (tmp_hsp_list ==
NULL)
126 sfree(hsp_list_array);
129 tmp_hsp_list->
oid = hsp_list->
oid;
143 for (index = 0; index < results->
num_queries; index++) {
144 if (hsp_list_array[index]) {
150 hsp_list_array[index]);
153 sfree(hsp_list_array);
154 }
else if (hsp_list->
hspcnt > 0) {
206 Int4 index, next_index;
212 if (!hsplist_in || hsplist_in->
hspcnt == 0)
238 for (index = 0; index < hsplist_in->
hspcnt; index = next_index) {
245 for (next_index = index; next_index < hsplist_in->
hspcnt;
251 hspcnt = next_index - index;
257 for ( ; index < next_index; ++index)
316 data->params = params;
326 Int4 compositionBasedStats,
331 if (hit_options ==
NULL)
337 compositionBasedStats, gapped_calculation);
357 writer_info->
params = params;
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
#define BLAST_CMP(a, b)
A macro expression that returns 1, 0, -1 if a is greater than, equal to or less than b,...
int ScoreCompareHSPs(const void *h1, const void *h2)
Comparison callback function for sorting HSPs, first by score in descending order,...
Int4 BlastHspNumMax(Boolean gapped_calculation, const BlastHitSavingOptions *options)
Calculated the number of HSPs that should be saved.
BlastHitList * Blast_HitListNew(Int4 hitlist_size)
Allocate memory for a hit list of a given size.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
Boolean Blast_HSPListIsSortedByScore(const BlastHSPList *hsp_list)
Check if HSP list is sorted by score.
Int2 Blast_HSPListSaveHSP(BlastHSPList *hsp_list, BlastHSP *hsp)
Saves HSP information into a BlastHSPList structure.
Int4 GetPrelimHitlistSize(Int4 hitlist_size, Int4 compositionBasedStats, Boolean gapped_calculation)
BlastHSPList * Blast_HSPListFree(BlastHSPList *hsp_list)
Deallocate memory for an HSP list structure as well as all it's components.
Int2 Blast_HitListUpdate(BlastHitList *hit_list, BlastHSPList *hsp_list)
Insert a new HSP list into the hit list.
Utilities for dealing with BLAST HSPs in the core of BLAST.
Boolean Blast_ProgramIsRpsBlast(EBlastProgramType p)
Returns true if program is RPS-BLAST (i.e.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
Int4 Blast_GetQueryIndexFromContext(Int4 context, EBlastProgramType program)
Given a context from BLAST engine core, return the query index.
Various auxiliary BLAST utility functions.
int32_t Int4
4-byte (32-bit) signed integer
BlastHSPCollectorParams * BlastHSPCollectorParamsNew(const BlastHitSavingOptions *hit_options, Int4 compositionBasedStats, Boolean gapped_calculation)
The following are exported functions to be used by APP.
BlastHSPWriterInfo * BlastHSPCollectorInfoNew(BlastHSPCollectorParams *params)
WriterInfo to create a default writer: the collecter.
struct BlastHSPCollectorData BlastHSPCollectorData
Data structure used by the writer.
static BlastHSPWriter * s_BlastHSPCollectorNew(void *params, BlastQueryInfo *query_info, BLAST_SequenceBlk *sequence)
create the writer
BlastHSPCollectorParams * BlastHSPCollectorParamsFree(BlastHSPCollectorParams *opts)
Deallocates the BlastHSPCollectorParams structure passed in.
static BlastHSPWriter * s_BlastHSPCollectorFree(BlastHSPWriter *writer)
Free the writer.
static int s_BlastHSPCollectorRun_RPS(void *data, BlastHSPList *hsplist_in)
Perform writing task for RPS case For RPS BLAST saving procedure is different, because HSPs from diff...
static int s_BlastHSPCollectorInit(void *data, void *hsp_results)
The following are implementations for BlastHSPWriter ADT.
static int s_ScoreCompareHSPWithContext(const void *h1, const void *h2)
Callback used for sorting HSPs by score, with HSPs from different contexts segregated from each other...
static int s_BlastHSPCollectorRun(void *data, BlastHSPList *hsp_list)
Perform writing task ownership of the HSP list and sets the dereferenced pointer to NULL.
static int s_BlastHSPCollectorFinal(void *data, void *results)
Perform post-run clean-ups.
Implementation of a number of BlastHSPWriters to save hits from a BLAST search, and subsequently retu...
Uint1 Boolean
bool replacment for C
#define ASSERT
macro for assert.
Structure to hold a sequence.
Data structure used by the writer.
BlastHSPResults * results
place to store hits
BlastHSPCollectorParams * params
how many hits to save
Keeps prelim_hitlist_size and HitSavingOptions together.
EBlastProgramType program
program type
Int4 hsp_num_max
number of HSPs to save per db sequence.
Int4 prelim_hitlist_size
number of hits saved during preliminary part of search.
The structure to hold all HSPs for a given sequence after the gapped alignment.
Int4 oid
The ordinal id of the subject sequence this HSP list is for.
Int4 hspcnt
Number of HSPs saved.
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
Int4 query_index
Index of the query which this HSPList corresponds to.
The structure to contain all BLAST results, for multiple queries.
BlastHitList ** hitlist_array
Array of results for individual query sequences.
Int4 num_queries
Number of query sequences.
A wrap of data structure used to create a writer.
BlastHSPWriterNewFn NewFnPtr
ADT definition of BlastHSPWriter.
void * data
data structure
BlastHSPWriterFinalFn FinalFnPtr
BlastHSPWriterFreeFn FreeFnPtr
BlastHSPWriterRunFn RunFnPtr
BlastHSPWriterInitFn InitFnPtr
Structure holding all information about an HSP.
Int4 context
Context number of query.
The structure to contain all BLAST results for one query sequence.
Options used when evaluating and saving hits These include: a.
EBlastProgramType program_number
indicates blastn, blastp, etc.
Int4 hitlist_size
Maximal number of database sequences to return results for.
The query related information.
voidp calloc(uInt items, uInt size)