91
91
double worstEvalue; /**< the worst (biggest) evalue currently in
94
/** If the data is currently stored in an array, this field points to
95
the data. Otherwise, it is NULL */
94
96
struct BlastCompo_HeapRecord *array;
97
/** If the data is currently stored in as a heap, this field points to
98
the data. Otherwise, it is NULL */
95
99
struct BlastCompo_HeapRecord *heapArray;
96
100
} BlastCompo_Heap;
103
/** Return true if self may insert a match that had the given eValue,
104
* score and subject_index.
106
* @param self a BlastCompo_Heap
107
* @param eValue the evalue to be tested.
108
* @param score the score to be tested
109
* @param subject_index the subject_index to be tested.
99
111
NCBI_XBLAST_EXPORT
100
112
int BlastCompo_HeapWouldInsert(BlastCompo_Heap * self, double eValue,
101
113
int score, int subject_index);
117
* Try to insert a collection of alignments into a heap.
119
* @param self the heap
120
* @param alignments a collection of alignments, in an unspecified
122
* @param eValue the best evalue among the alignments
123
* @param score the best score among the alignments
124
* @param subject_index the index of the subject sequence in the database
125
* @param discardedAligns a collection of alignments that must be
126
* deleted (passed back to the calling routine
127
* as this routine does know how to delete them)
128
* @return 0 on success, -1 for out of memory
102
130
NCBI_XBLAST_EXPORT
103
131
int BlastCompo_HeapInsert(BlastCompo_Heap * self, void * alignments,
104
132
double eValue, int score, int
105
133
subject_index, void ** discardedAligns);
137
* Return true if only matches with evalue <= self->ecutoff may be
140
* @param self a BlastCompo_Heap
107
142
NCBI_XBLAST_EXPORT
108
143
int BlastCompo_HeapFilledToCutoff(const BlastCompo_Heap * self);
146
/** Initialize a new BlastCompo_Heap; parameters to this function correspond
147
* directly to fields in the BlastCompo_Heap
149
* @return 0 on success, -1 for out of memory
110
151
NCBI_XBLAST_EXPORT
111
152
int BlastCompo_HeapInitialize(BlastCompo_Heap * self, int heapThreshold,
115
void BlastCompo_HeapRelease(BlastCompo_Heap * self);
157
* Release the storage associated with the fields of a BlastCompo_Heap. Don't
158
* delete the BlastCompo_Heap structure itself.
160
* @param self BlastCompo_Heap whose storage will be released
162
NCBI_XBLAST_EXPORT void BlastCompo_HeapRelease(BlastCompo_Heap * self);
166
* Remove and return the element in the BlastCompo_Heap with largest
167
* (worst) evalue; ties are broken according to the order specified
168
* by the s_CompoHeapRecordCompare routine.
170
* @param self a BlastCompo_Heap
117
172
NCBI_XBLAST_EXPORT
118
173
void * BlastCompo_HeapPop(BlastCompo_Heap * self);