bestScore, subject_index;
110 void* theseAlignments;
140 intleft = 2 *
i, right = 2 *
i+ 1;
144&(heapArray[
i])) &&
149&(heapArray[
i])) &&
169 int i, left, right, largest;
185&heapArray[largest])) {
191}
while(largest !=
i);
233 if(
NULL!= self->array) {
236 self->heapArray =
self->array;
237 self->array =
NULL;
240 for(
i=
n/ 2;
i>= 1; --
i) {
257 if(self->n < self->heapThreshold ||
258eValue <= self->ecutoff ||
259eValue < self->worstEvalue) {
303 if(*length >= *capacity) {
310new_array = realloc(*
array, (new_capacity + 1) *
312 if(new_array ==
NULL) {
316*capacity = new_capacity;
318heapRecord = &(*array)[++(*length)];
335 void** discardedAlignments)
337*discardedAlignments =
NULL;
338 if(self->array && self->n >= self->heapThreshold) {
341 if(self->array !=
NULL) {
345&self->capacity, alignments,
351 if(self->worstEvalue < eValue) {
352 self->worstEvalue = eValue;
355 if(self->n < self->heapThreshold ||
356(eValue <= self->ecutoff &&
357self->worstEvalue <= self->ecutoff)) {
365score, subject_index);
384*discardedAlignments =
self->heapArray[1].theseAlignments;
385memcpy(&self->heapArray[1], &heapRecord,
393 self->worstEvalue =
self->heapArray[1].bestEvalue;
407 return self->n >=
self->heapThreshold &&
408 self->worstEvalue <=
self->ecutoff;
418 self->heapThreshold = heapThreshold;
419 self->ecutoff = ecutoff;
420 self->heapArray =
NULL;
422 self->worstEvalue = 0;
426 return self->array !=
NULL? 0 : -1;
434 if(self->heapArray)
free(self->heapArray);
435 if(self->array)
free(self->array);
437 self->n =
self->capacity =
self->heapThreshold = 0;
438 self->heapArray =
NULL;
self->array =
NULL;
454 first= &
self->heapArray[1];
455 last= &
self->heapArray[
self->n];
static void s_ConvertToHeap(BlastCompo_Heap *self)
Convert a BlastCompo_Heap from a representation as an unordered array to a representation as a heap-o...
void * BlastCompo_HeapPop(BlastCompo_Heap *self)
Remove and return the element in the BlastCompo_Heap with largest (worst) evalue; ties are broken acc...
int BlastCompo_HeapFilledToCutoff(const BlastCompo_Heap *self)
Return true if only matches with evalue <= self->ecutoff may be inserted.
static int s_CompHeapRecordInsertAtEnd(BlastCompo_HeapRecord **array, int *length, int *capacity, void *alignments, double eValue, int score, int subject_index)
Insert a new heap record at the end of *array, possibly resizing the array to hold the new record.
int BlastCompo_HeapInsert(BlastCompo_Heap *self, void *alignments, double eValue, int score, int subject_index, void **discardedAlignments)
Try to insert a collection of alignments into a heap.
void BlastCompo_HeapRelease(BlastCompo_Heap *self)
Release the storage associated with the fields of a BlastCompo_Heap.
#define COMPO_INTENSE_DEBUG
Define COMPO_INTENSE_DEBUG to be true to turn on rigorous but expensive consistency tests in the comp...
#define HEAP_RESIZE_FACTOR
When the heap is about to exceed its capacity, it will be grown by the minimum of a multiplicative fa...
struct BlastCompo_HeapRecord BlastCompo_HeapRecord
The struct BlastCompo_HeapRecord data type is used below to define the internal structure of a BlastC...
static int s_CompoHeapRecordCompare(BlastCompo_HeapRecord *place1, BlastCompo_HeapRecord *place2)
Compare two records in the heap.
static void s_CompoHeapifyDown(BlastCompo_HeapRecord *heapArray, int top, int n)
Relocate the top element of a subtree so that on exit the subtree is in valid heap order.
int BlastCompo_HeapInitialize(BlastCompo_Heap *self, int heapThreshold, double ecutoff)
Initialize a new BlastCompo_Heap; parameters to this function correspond directly to fields in the Bl...
static void s_CompoHeapRecordSwap(BlastCompo_HeapRecord *record1, BlastCompo_HeapRecord *record2)
Swap two records in the heap.
#define CMP(a, b)
Return -1/0/1 if a is less than/equal to/greater than b.
static int s_CompoHeapIsValid(BlastCompo_HeapRecord *heapArray, int i, int n)
Verify that the subtree rooted at element i is ordered so as to be as to be a valid heap.
int BlastCompo_HeapWouldInsert(BlastCompo_Heap *self, double eValue, int score, int subject_index)
Return true if self may insert a match that had the given eValue, score and subject_index.
#define HEAP_INITIAL_CAPACITY
The initial capacity of the heap will be set to the smaller of this and the heap threshold.
static void s_CompoHeapifyUp(BlastCompo_HeapRecord *heapArray, int i)
Relocate a leaf in the heap so that the entire heap is in valid heap order.
Declares a "heap" data structure that is used to store computed alignments when composition adjustmen...
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Type and macro definitions from C toolkit that are not defined in C++ toolkit.
#define MIN(a, b)
returns smaller of a and b.
#define TRUE
bool replacment for C indicating true.
#define MAX(a, b)
returns larger of a and b.
The struct BlastCompo_HeapRecord data type is used below to define the internal structure of a BlastC...
int bestScore
best (largest) score; used to break ties between records with the same e-value
double bestEvalue
best (smallest) evalue of all alignments in the record
int subject_index
index of the subject sequence in the database
void * theseAlignments
a collection of alignments
A BlastCompo_Heap represents a collection of alignments between one query sequence and several matchi...
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