(2 *overlap < l2) {
99d = 4*s1*l1 + 2*s1*l2 - 2*s2*l1 - 4*s2*l2;
101 if(((s1 == s2) && (b1==b2) && (l1 == l2)) || (d == 0)) {
105 if(p->
sid!= y->
sid) {
106 return(p->
sid< y->
sid);
146 if(
r->merit <= 0) {
175 if(
r->merit <= 0) {
236 if(!parent)
returnnode;
238midpt = (parent->
begin+ parent->
end) / 2;
243node->
begin= midpt;
244node->
end= parent->
end;
269midpt = (node->
begin+ node->
end) /2;
273 if(p->
end< midpt) {
277child = node->
left;
278}
else if(p->
begin> midpt) {
279 if(!node->
right) {
282child = node->
right;
311s_Debug(node->
left);
312s_Debug(node->
right);
320 if(! (*node))
return;
325&& !(*node)->left && !(*node)->right) {
337 if(! (*node))
return;
340 if(x->
begin<= (*node)->begin && x->
end>= (*node)->end) {
346 if(!(*node)->left && !(*node)->right) {
355midpt = ((*node)->begin + (*node)->end) / 2;
356 if(x->
end< midpt) {
358}
else if(x->
begin> midpt) {
364&& !(*node)->left && !(*node)->right) {
435 Int4kNumHSPtoFork = 20;
446 if(
A->end < midpt)
tree=
tree->left;
447 else if(
A->begin > midpt)
tree=
tree->right;
503 intcid, qid, sid, id, new_allocated;
512 doublebest_evalue, worst_evalue;
514 const intkStartValue = 100;
520 if(!
results->hitlist_array[qid]) {
523hitlist =
results->hitlist_array[qid];
536 if(p->
sid== list->
oid) {
548new_allocated =
MAX(kStartValue, 2*sid);
560new_allocated = 2*id;
568cull_list = p->
next;
578 for(
id=0;
id< list->
hspcnt; ++id) {
583worst_evalue =
MAX(worst_evalue, best_evalue);
612 if(!hsp_list)
return0;
614 for(
i=0;
i<hsp_list->
hspcnt; ++
i) {
617 A.cid = isBlastn ? (
A.hsp->context -
A.hsp->context %
NUM_STRANDS) :
A.hsp->context;
618 A.sid = hsp_list->
oid;
622 A.begin = qlen -
A.hsp->query.end;
623 A.end = qlen -
A.hsp->query.offset;
626 A.begin =
A.hsp->query.offset;
627 A.end =
A.hsp->query.end;
631 if(! c_tree[
A.cid]) {
675 if(! query_info)
return NULL;
688 data.params = params;
689 data.query_info = query_info;
702 intqid, sid, num_list;
705 for(qid = 0; qid <
results->num_queries; ++qid) {
706 if(!(
results->hitlist_array[qid]))
continue;
707num_list =
results->hitlist_array[qid]->hsplist_count;
708 for(sid = 0; sid < num_list; ++sid) {
709hsp_list =
results->hitlist_array[qid]->hsplist_array[sid];
716 for(qid = 0; qid <
results->num_queries; ++qid) {
717 if(!(
results->hitlist_array[qid]))
continue;
718num_list =
results->hitlist_array[qid]->hsplist_count;
719 for(sid = 0; sid < num_list; ++sid) {
721 results->hitlist_array[qid]->hsplist_array[sid]);
722 results->hitlist_array[qid]->hsplist_array[sid] =
NULL;
724 results->hitlist_array[qid]->hsplist_count = 0;
760 if(! query_info)
return NULL;
771 data.params = params;
772 data.query_info = query_info;
786 Int4compositionBasedStats,
818writer_info->
params= params;
827pipe_info->
params= params;
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
#define NUM_STRANDS
Number of frames in a nucleotide sequence.
void Blast_HSPListSortByEvalue(BlastHSPList *hsp_list)
Sort the HSPs in an HSP list by e-value, with scores and other criteria used to resolve ties.
BlastHitList * Blast_HitListFree(BlastHitList *hitlist)
Deallocate memory for the hit list.
BlastHitList * Blast_HitListNew(Int4 hitlist_size)
Allocate memory for a hit list of a given size.
Int2 Blast_HitListSortByEvalue(BlastHitList *hit_list)
Sort BlastHitLIst bon evalue.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
BlastHSP * Blast_HSPFree(BlastHSP *hsp)
Deallocate memory for an HSP structure.
BlastHSPList * Blast_HSPListFree(BlastHSPList *hsp_list)
Deallocate memory for an HSP list structure as well as all it's components.
void Blast_HSPListSortByScore(BlastHSPList *hsp_list)
Sort the HSPs in an HSP list by score.
Int4 Blast_GetQueryIndexFromContext(Int4 context, EBlastProgramType program)
Given a context from BLAST engine core, return the query index.
Various auxiliary BLAST utility functions.
definition of a Culling tree
pre_order_iterator begin() const
pre_order_iterator end() const
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
Implementation of a number of BlastHSPWriters to save hits from a BLAST search, and subsequently retu...
BlastHSPCollectorParams * BlastHSPCollectorParamsNew(const BlastHitSavingOptions *hit_options, Int4 compositionBasedStats, Boolean gapped_calculation)
Sets up parameter set for use by collector.
BlastHSPCollectorParams * BlastHSPCollectorParamsFree(BlastHSPCollectorParams *opts)
Deallocates the BlastHSPCollectorParams structure passed in.
static int s_BlastHSPCullingInit(void *data, void *results)
Perform pre-run stage-specific initialization.
static CTreeNode * s_CTreeFree(CTreeNode *tree)
Recursively deallocate a tree, assuming all hsps are already ripped off.
static BlastHSPWriter * s_BlastHSPCullingNew(void *params, BlastQueryInfo *query_info, BLAST_SequenceBlk *sequence)
create the writer
static Int4 s_ProcessHSPList(LinkedHSP **list, LinkedHSP *y)
update merit for hsps in list; also returns the number of hsps in list
BlastHSPWriterInfo * BlastHSPCullingInfoNew(BlastHSPCullingParams *params)
WriterInfo and PipeInfo to create a best hit writer/pipe.
static Boolean s_FullPass(LinkedHSP *list, LinkedHSP *y)
check how many hsps in list dominates y, and update merit of y accordingly
static int s_BlastHSPCullingRun(void *data, BlastHSPList *hsp_list)
Perform writing task ownership of the HSP list and sets the dereferenced pointer to NULL.
static void s_AddHSPtoList(LinkedHSP **list, LinkedHSP *y)
add an hsp to the front of hsp list
static LinkedHSP * s_RipHSPOffCTree(CTreeNode *tree)
Recursively rip off hsps into a link list.
static CTreeNode * s_CTreeNodeFree(CTreeNode *node)
Free an individual node.
BlastHSPCullingParams * BlastHSPCullingParamsFree(BlastHSPCullingParams *opts)
Deallocates the BlastHSPCullingParams structure passed in.
static Boolean s_SaveHSP(CTreeNode *tree, LinkedHSP *A)
A full traverse to determine the merit of A, in addition, insert A to the proper place if A is valid,...
struct LinkedHSP LinkedHSP
linked list of HSPs used to store hsps in culling tree.
static Boolean s_DominateTest(LinkedHSP *p, LinkedHSP *y)
return true if p dominates y
ECTreeChild
functions to manipulate Culling Tree (private)
static BlastHSPWriter * s_BlastHSPCullingFree(BlastHSPWriter *writer)
Free the writer.
static BlastHSPPipe * s_BlastHSPCullingPipeFree(BlastHSPPipe *pipe)
Free the pipe.
static Int4 s_MarkDownHSPList(LinkedHSP **list)
decrease merit for all hsps in list; also returns the number of hsps in list
static int s_BlastHSPCullingPipeRun(void *data, BlastHSPResults *results)
The pipe version of best-hit writer.
static CTreeNode * s_CTreeNew(Int4 qlen)
functions to manipulate Culling Tree (public)
struct BlastHSPCullingData BlastHSPCullingData
The following are implementations for BlastHSPWriter ADT.
struct CTreeNode CTreeNode
definition of a Culling tree
static void s_ForkChildren(CTreeNode *node)
Fork children from a node.
static BlastHSPPipe * s_BlastHSPCullingPipeNew(void *params, BlastQueryInfo *query_info)
create the pipe
static CTreeNode * s_CTreeNodeNew(CTreeNode *parent, ECTreeChild dir)
Allocate and return a new node for use.
BlastHSPPipeInfo * BlastHSPCullingPipeInfoNew(BlastHSPCullingParams *params)
BlastHSPCullingParams * BlastHSPCullingParamsNew(const BlastHitSavingOptions *hit_options, const BlastHSPCullingOptions *culling_opts, Int4 compositionBasedStats, Boolean gapped_calculation)
The following are exported functions to be used by APP.
static void s_MarkDownCTree(CTreeNode **node)
recursively decrease the merit of all hsps within a subtree, return TRUE if whole node is empty and s...
static CTreeNode * s_RetNode(CTreeNode *node)
static int s_BlastHSPCullingFinal(void *data, void *hsp_results)
Perform post-run clean-ups.
static CTreeNode * s_GetNode()
static LinkedHSP * s_HSPFree(LinkedHSP *x)
free x
static void s_ProcessCTree(CTreeNode **node, LinkedHSP *x)
recursively search and update merit hsps in culling tree due to addition of hsp x
static LinkedHSP * s_HSPCopy(LinkedHSP *x)
functions to manipulate LinkedHSPs
Implementation of the BlastHSPWriter interface to perform culling.
#define MIN(a, b)
returns smaller of a and b.
#define INT4_MAX
largest nubmer represented by signed int
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define ASSERT
macro for assert.
#define MAX(a, b)
returns larger of a and b.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Structure to hold a sequence.
Int4 query_length
Length of this query, strand or frame.
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 following are implementations for BlastHSPWriter ADT.
BlastHSPCullingParams * params
parameters for culling.
CTreeNode ** c_tree
forest of culling trees
BlastQueryInfo * query_info
information about queries
Int4 num_contexts
number of contexts
Options for the HSP culling algorithm.
int max_hits
Maximum number of hits per area of query.
Keeps parameters used in best hit algorithm.
Int4 culling_max
number of HSPs allowed per query region.
Int4 hsp_num_max
number of HSPs to save per db sequence.
EBlastProgramType program
program type
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.
double best_evalue
Smallest e-value for HSPs in this list.
Int4 allocated
The allocated size of the hsp_array.
Int4 query_index
Index of the query which this HSPList corresponds to.
A wrap of data structure used to create a pipe.
BlastHSPPipeNewFn NewFnPtr
struct BlastHSPPipeInfo * next
the next pipe inf in chain
ADT definition of BlastHSPPipe.
void * data
data structure
BlastHSPPipe * next
the next pipe in chain
BlastHSPPipeRunFn RunFnPtr
BlastHSPPipeFreeFn FreeFnPtr
The structure to contain all BLAST results, for multiple queries.
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.
double evalue
This HSP's e-value.
BlastSeg subject
Subject sequence info.
Int4 score
This HSP's raw score.
The structure to contain all BLAST results for one query sequence.
double worst_evalue
Highest of the best e-values among the HSP lists.
BlastHSPList ** hsplist_array
Array of HSP lists for individual database hits.
Int4 hsplist_count
Filled size of the HSP lists array.
Int4 low_score
The lowest of the best scores among the HSP lists.
Int4 hsplist_current
Number of allocated HSP list arrays.
Options used when evaluating and saving hits These include: a.
The query related information.
BlastContextInfo * contexts
Information per context.
Int4 last_context
Index of the last element of the context array.
Int4 offset
Start of hsp.
linked list of HSPs used to store hsps in culling tree.
voidp calloc(uInt items, uInt size)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4