~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to algo/blast/composition_adjustment/compo_heap.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: compo_heap.h,v 1.1 2005/12/01 13:52:20 gertz Exp $
 
1
/* $Id: compo_heap.h,v 1.3 2005/12/19 15:38:01 gertz Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
24
24
 * ===========================================================================*/
25
25
 
26
26
/** @file compo_heap.h
27
 
 * @author Alejandro Schaffer, E. Michael Gertz
28
 
 *
29
27
 * Declares a "heap" data structure that is used to store computed alignments
30
28
 * when composition adjustment of scoring matrices is used.
 
29
 *
 
30
 * @author Alejandro Schaffer, E. Michael Gertz
31
31
 */
32
32
 
33
33
#ifndef __COMPO_HEAP__
91
91
    double worstEvalue;         /**< the worst (biggest) evalue currently in
92
92
                                    the heap */
93
93
 
 
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;
97
101
 
98
102
 
 
103
/** Return true if self may insert a match that had the given eValue,
 
104
 * score and subject_index.
 
105
 *
 
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.
 
110
 */
99
111
NCBI_XBLAST_EXPORT
100
112
int BlastCompo_HeapWouldInsert(BlastCompo_Heap * self, double eValue,
101
113
                               int score, int subject_index);
 
114
 
 
115
 
 
116
/**
 
117
 * Try to insert a collection of alignments into a heap.
 
118
 *
 
119
 * @param self              the heap
 
120
 * @param alignments        a collection of alignments, in an unspecified
 
121
 *                          format
 
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
 
129
 */
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);
106
134
 
 
135
 
 
136
/**
 
137
 * Return true if only matches with evalue <= self->ecutoff may be
 
138
 * inserted.
 
139
 *
 
140
 * @param self          a BlastCompo_Heap
 
141
 */
107
142
NCBI_XBLAST_EXPORT
108
143
int BlastCompo_HeapFilledToCutoff(const BlastCompo_Heap * self);
109
144
 
 
145
 
 
146
/** Initialize a new BlastCompo_Heap; parameters to this function correspond
 
147
 * directly to fields in the BlastCompo_Heap 
 
148
 *
 
149
 * @return 0 on success,  -1 for out of memory
 
150
 */
110
151
NCBI_XBLAST_EXPORT
111
152
int BlastCompo_HeapInitialize(BlastCompo_Heap * self, int heapThreshold,
112
153
                              double ecutoff);
113
154
 
114
 
NCBI_XBLAST_EXPORT
115
 
void BlastCompo_HeapRelease(BlastCompo_Heap * self);
116
 
 
 
155
 
 
156
/**
 
157
 * Release the storage associated with the fields of a BlastCompo_Heap. Don't
 
158
 * delete the BlastCompo_Heap structure itself.
 
159
 *
 
160
 * @param self          BlastCompo_Heap whose storage will be released
 
161
 */
 
162
NCBI_XBLAST_EXPORT void BlastCompo_HeapRelease(BlastCompo_Heap * self);
 
163
 
 
164
 
 
165
/**
 
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.
 
169
 *
 
170
 * @param self           a BlastCompo_Heap
 
171
 */
117
172
NCBI_XBLAST_EXPORT
118
173
void * BlastCompo_HeapPop(BlastCompo_Heap * self);
119
174