1 /* ===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================*/
24 /*****************************************************************************
25 
26 File name: blastpri.h
27 
28 Author: Tom Madden
29 
30 Contents: prototypes for "private" BLAST functions, these should not be called
31 	by outside utilities.
32 
33 ******************************************************************************/
34 
35 /* $Revision: 6.125 $
36 * $Log: blastpri.h,v $
37 * Revision 6.125  2007/03/13 20:39:04  madden
38 *   - In the prototype for blast_set_parameters, change the type of the
39 *     function arguments dropoff_number_of_bits_1st_pass and
40 *     dropoff_number_of_bits_2nd_pass to Nlm_FloatHi.
41 *   [from Mike Gertz]
42 *
43 * Revision 6.124  2007/01/17 15:46:00  madden
44 * remove FilterDNA
45 *
46 * Revision 6.123  2006/09/21 13:42:37  madden
47 * BlastProcessGiLists returns a boolean to specify that an attempt was made to process a list of GIs.  If no matches were found this can be reported back to the user
48 *
49 * Revision 6.122  2006/04/26 12:42:36  madden
50 * BlastSetUserErrorString and BlastDeleteUserErrorString moved from blastool.c to blfmtutl.c
51 *
52 * Revision 6.121  2005/12/29 19:56:06  madden
53 * Moved functions to print tabular output to blfmtutl
54 *
55 * Revision 6.120  2005/12/01 15:10:23  madden
56 * Gave BLASTCheckHSPInclusion external linkage (i.e. removed the static specifier).
57 *
58 * Revision 6.119  2005/09/29 17:39:46  coulouri
59 * from mike gertz:
60 *    To handle concatenated queries properly, changed prototype of
61 *    RedoAlignmentCore to return and array of lists to SeqAligns.
62 *
63 * Revision 6.118  2005/08/31 20:33:08  coulouri
64 * From Mike Gertz:
65 *     Added a prototype for the new BlastSingleQueryResultSize routine.
66 *
67 * Revision 6.117  2005/07/28 14:57:09  coulouri
68 * remove dead code
69 *
70 * Revision 6.116  2005/05/16 17:44:24  papadopo
71 * From Alejandro Schaffer: Change in prototype for RedoAlignmentCore to
72 * support more than two options for adjustParameters
73 *
74 * Revision 6.115  2005/05/02 16:03:14  coulouri
75 * refactor code to set db_chunk_size
76 *
77 * Revision 6.114  2004/08/23 17:03:52  papadopo
78 * From Michael Gertz: make CopyResultHspToHSP public
79 *
80 * Revision 6.113  2004/06/30 12:28:20  madden
81 * Removed some function prototypes and moved to blfmtutl.h
82 *
83 * Revision 6.112  2004/03/31 17:58:51  papadopo
84 * Mike Gertz' changes for length adjustment calculations
85 *
86 * Revision 6.111  2004/01/16 23:43:43  dondosha
87 * No more need for special argument for partial search: it is set in options
88 *
89 * Revision 6.110  2004/01/06 22:36:24  dondosha
90 * Added BLAST_HSPFree function that frees the edit block and the HSP
91 *
92 * Revision 6.109  2003/08/20 22:12:56  dondosha
93 * Added BlastPrintTabularResults with an extra boolean parameter for OOF alignments
94 *
95 * Revision 6.108  2003/08/04 16:19:16  dondosha
96 * Added effective HSP length (length adjustment) to other returns, so it can be reported in XML output
97 *
98 * Revision 6.107  2003/04/22 21:52:13  dondosha
99 * Added function OOFBlastHSPGetNumIdentical
100 *
101 * Revision 6.106  2003/03/24 19:42:14  madden
102 * Changes to support query concatenation for blastn and tblastn
103 *
104 * Revision 6.105  2002/11/04 22:47:02  dondosha
105 * Added prototype for BlastHSPGetNumIdentical
106 *
107 * Revision 6.104  2002/08/30 15:50:06  dondosha
108 * Several prototypes moved from mblast.h
109 *
110 * Revision 6.103  2002/08/01 20:45:35  dondosha
111 * Changed prototype of the BLASTPostSearchLogic function to make it
112 * more convenient
113 *
114 * Revision 6.102  2002/07/09 16:09:42  camacho
115 * Changed interface to BlastCreateVirtualOIDList
116 *
117 * Revision 6.101  2002/06/26 00:56:29  camacho
118 *
119 * 1. Fixed bug when searching a mixture of real and mask databases.
120 * 2. Clean up of code that calculates the number of sequences and database
121 *    length.
122 *
123 * Revision 6.100  2002/06/25 19:46:07  camacho
124 * Added PROTO around function declaration
125 *
126 * Revision 6.99  2002/06/25 19:39:38  camacho
127 * Made BlastCreateVirtualOIDList public for use by neighboring software
128 *
129 * Revision 6.98  2002/06/21 21:43:01  camacho
130 * Removed obsolete BlastSeqIdList structure and functions
131 *
132 * Revision 6.97  2002/06/19 22:50:33  dondosha
133 * Added all queries information for tabular output with multiple queries
134 *
135 * Revision 6.96  2002/06/11 14:44:48  dondosha
136 * Return status from some functions instead of search block pointer
137 *
138 * Revision 6.95  2002/04/18 16:18:20  dondosha
139 * Added BlastPrintTabulatedResultsEx with extra argument to keep track of progress
140 *
141 * Revision 6.94  2002/04/15 20:42:05  jianye
142 * Added getFastaStyleTitle(BioseqPtr bsp)
143 *
144 * Revision 6.93  2002/03/26 16:46:41  madden
145 * Move calculation of effective lengths to BlastCalculateEffectiveLengths
146 *
147 * Revision 6.92  2002/03/06 18:34:32  dondosha
148 * Pass the filtered locations back from the megablast engine to use in formatting
149 *
150 * Revision 6.91  2002/03/05 17:58:57  dondosha
151 * Set same offsets for the traceback as for preliminary extension for megablast with non-greedy extensions
152 *
153 * Revision 6.90  2002/01/04 20:16:12  dondosha
154 * Correction for single strand blastx with OOF gapping
155 *
156 * Revision 6.89  2001/11/13 18:17:27  dondosha
157 * Added BlastNtWordUngappedExtend for use in Mega BLAST
158 *
159 * Revision 6.88  2001/10/12 15:22:49  dondosha
160 * Added prototype for BLASTPostSearchLogic
161 *
162 * Revision 6.87  2001/09/07 14:46:44  dondosha
163 * Roll back removal of threshold_first from functions and structures
164 *
165 * Revision 6.86  2001/09/06 20:24:34  dondosha
166 * Removed threshold_first
167 *
168 * Revision 6.85  2001/08/20 21:13:41  dondosha
169 * Added two declarations for clustering hits
170 *
171 * Revision 6.84  2001/07/31 16:42:40  dondosha
172 * Added function FastaCheckDna
173 *
174 * Revision 6.83  2001/06/15 16:38:46  dondosha
175 * Correction to previous changes
176 *
177 * Revision 6.82  2001/06/14 22:09:15  dondosha
178 * Rearranged code for gi lists and oid masks processing to get rid of duplication
179 *
180 * Revision 6.81  2001/06/13 21:42:19  dondosha
181 * Added prototypes for functions needed to deal with gi lists
182 *
183 * Revision 6.80  2001/06/07 19:30:03  dondosha
184 * Pass believe query argument to BlastPrintTabulatedResults
185 *
186 * Revision 6.79  2001/06/06 21:22:43  dondosha
187 * Added (query) Bioseq and SeqLoc arguments to function BlastPrintTabulatedResults
188 *
189 * Revision 6.78  2001/05/11 22:04:42  dondosha
190 * Added prototype for BlastPrintTabulatedResults function
191 *
192 * Revision 6.77  2001/03/19 18:54:50  madden
193 * Added BlastSeqLocFillDoubleIntEx, changed BlastSeqLocFillDoubleIntRev
194 *
195 * Revision 6.76  2001/02/08 20:38:30  dondosha
196 * Added prototype for BLASTHspToStdSeg
197 *
198 * Revision 6.75  2001/02/07 21:08:33  dondosha
199 * 1. Added prototypes of callback functions to handle results
200 * 2. Two private auxiliary functions made public
201 *
202 * Revision 6.74  2001/01/23 20:25:43  dondosha
203 * 1. Renamed BlastParceInputString to BlastParseInputString
204 * 2. Recognize a double quoted string as an option value in
205 *    BlastParseInputString
206 *
207 * Revision 6.73  2000/12/19 18:39:50  madden
208 * Add function BlastSetUserErrorString and BlastDeleteUserErrorString
209 *
210 * Revision 6.72  2000/11/17 17:51:59  dondosha
211 * Removed is_megablast argument from BLASTSetUpSearchWithReadDbInternalEx since it is part of options
212 *
213 * Revision 6.71  2000/10/12 21:40:36  shavirin
214 * Added is_oofalign to definition of the function BLASTFilterOverlapRegions().
215 *
216 * Revision 6.70  2000/10/11 21:51:17  shavirin
217 * Added definition of the function BLASTFilterOverlapRegions()
218 *
219 * Revision 6.69  2000/08/31 16:29:11  shavirin
220 * Added definition of *QueryDNAP set of functions related to OOF.
221 *
222 * Revision 6.68  2000/08/28 21:51:53  shavirin
223 * Added definition of the function BlastOtherReturnsFree().
224 *
225 * Revision 6.67  2000/07/21 21:26:43  dondosha
226 * Added BLASTSetUpSearchWithReadDbInternalEx with Boolean argument is_megablast
227 *
228 * Revision 6.66  2000/07/08 20:44:11  vakatov
229 * Get all "#include" out of the 'extern "C" { }' scope;  other cleanup...
230 *
231 * Revision 6.65  2000/06/13 20:54:39  shavirin
232 * Added return of EFF_SEARCH_SPACE in the function BlastOtherReturnsPrepare
233 *
234 * Revision 6.64  2000/04/10 19:57:20  dondosha
235 * Added prototype for BlastSeqLocFillDoubleIntRev
236 *
237 * Revision 6.63  2000/03/30 21:46:08  madden
238 * prototypes for BLASTResultHitlistFreeEx and BlastDeleteHeap
239 *
240 * Revision 6.62  2000/03/29 22:16:08  dondosha
241 * Added edit_script argument to BlastSaveCurrentHspGapped
242 *
243 * Revision 6.61  2000/03/08 20:51:21  madden
244 * Add prototype for BlastGetAllowedGis
245 *
246 * Revision 6.60  2000/03/06 23:29:09  kans
247 * added prototype for BlastConvertDNASeqLoc
248 *
249 * Revision 6.59  2000/02/17 19:00:45  shavirin
250 * Removed theCacheSize parameter from everywhere.
251 *
252 * Revision 6.58  2000/02/01 18:08:59  dondosha
253 * Added prototype for BlastSaveCurrentHspGapped
254 *
255 * Revision 6.57  2000/01/11 17:04:48  shavirin
256 * Added parameter theCacheSize into BlastSearchBlkNew and BlastSearchBlkNewExtra
257 *
258 * Revision 6.56  1999/12/22 21:07:19  shavirin
259 * Added definition of the function BlastNewFindWordsEx()
260 *
261 * Revision 6.55  1999/12/14 15:35:13  madden
262 * Added BlastPrintFilterWarning
263 *
264 * Revision 6.54  1999/11/29 12:58:59  madden
265 * Added prototypes for BlastNTGetGappedScore, BlastNTPreliminaryGappedScore and BlastNtSaveCurrentHsp
266 *
267 * Revision 6.53  1999/11/02 15:24:03  madden
268 * Add BlastParseInputString and BlastGetLetterIndex
269 *
270 * Revision 6.52  1999/10/05 18:16:07  shavirin
271 * Functions tick_proc and get_db_chunk were renamed and become public.
272 *
273 * Revision 6.51  1999/09/22 20:59:56  egorov
274 * Add mask DB stuff
275 *
276 * Revision 6.50  1999/08/20 19:48:37  madden
277 * Changed call to BlastSearchBlkNew(Extra)
278 *
279 * Revision 6.49  1999/05/27 17:33:06  madden
280 * Fixed Int2 (should have been Int4) problem
281 *
282 * Revision 6.48  1999/04/15 13:25:07  madden
283 * RealBlastGetGappedAlignmentTraceback returns Int4
284 *
285 * Revision 6.47  1999/04/01 21:42:47  madden
286 * Fix memory leaks when gi list is used
287 *
288 * Revision 6.46  1999/03/17 16:49:10  madden
289 * Removed comment within comment
290 *
291 * Revision 6.45  1999/03/04 14:18:10  egorov
292 * Do correct filter masking when query is seqloc
293 * The only BlastMaskTheResidues() function is changed:
294 *
295 * Revision 6.44  1999/02/11 13:53:31  madden
296 * Added combine Boolean to HitRangeToSeqLoc
297 *
298 * Revision 6.43  1999/01/28 17:20:17  madden
299 * Added BlastGetNonSumStatsEvalue prototype
300 *
301 * Revision 6.42  1999/01/28 16:05:21  madden
302 * HspArrayPurge change
303 *
304 * Revision 6.41  1999/01/26 17:57:14  madden
305 * ContextToFrame prototype added
306 *
307 * Revision 6.40  1999/01/19 13:26:47  madden
308 * Change to HspArrayPurge
309 *
310  * Revision 6.39  1999/01/08 22:08:43  madden
311  * BlastScaleMatrix returns factor as FloatHi
312  *
313  * Revision 6.38  1998/12/18 16:19:58  madden
314  * Make BLASTSetUpSearchWithReadDbInternal public, add BlastSearchBlkNewExtra
315  *
316  * Revision 6.37  1998/09/17 19:53:03  madden
317  * Added fillCandLambda
318  *
319  * Revision 6.36  1998/09/16 18:59:55  madden
320  * Added subset Boolean
321  *
322  * Revision 6.35  1998/09/14 15:11:16  egorov
323  * Add support for Int8 length databases; remove unused variables
324  *
325  * Revision 6.34  1998/09/10 22:36:10  madden
326  * Added convertSeqAlignListToValNodeList and convertValNodeListToSeqAlignList
327  *
328  * Revision 6.33  1998/09/09 21:18:10  madden
329  * Added PrintKAParametersExtra
330  *
331  * Revision 6.32  1998/09/04 14:45:43  madden
332  * Moved code from blast.c blastool.c
333  *
334  * Revision 6.31  1998/07/21 20:58:07  madden
335  * Changes to allow masking at hash only
336  *
337  * Revision 6.30  1998/06/12 16:08:50  madden
338  * BlastHitRange stuff
339  *
340  * Revision 6.29  1998/06/04 16:23:04  madden
341  * BioseqSeg to MyBioseqSeg
342  *
343  * Revision 6.28  1998/05/17 16:28:44  madden
344  * Allow changes to filter options and cc filtering.
345  *
346  * Revision 6.27  1998/05/05 14:05:36  madden
347  * Added functions BlastStartAwakeThread and BlastStopAwakeThread
348  *
349  * Revision 6.26  1998/04/24 19:28:48  madden
350  * Added BlastScaleMatrix (and other rescaling code moved from posit.c)
351  *
352  * Revision 6.25  1998/04/15 20:23:49  madden
353  * offset arg removed from BlastMaskTheResidues
354  *
355  * Revision 6.24  1998/03/26 14:21:35  madden
356  * Added GetScoreSetFromBlastResultHsp prototype
357  *
358  * Revision 6.23  1998/03/25 22:27:27  madden
359  * Remove GetScoreSetFromBlastResultHsp prototype
360  *
361  * Revision 6.22  1998/03/24 15:38:24  madden
362  * Use BlastDoubleInt4Ptr to keep track of gis and ordinal_ids
363  *
364  * Revision 6.21  1998/03/18 14:14:16  madden
365  * Support random access by gi list
366  *
367  * Revision 6.20  1998/03/16 14:02:13  madden
368  * Changed call to BlastSeqIdListDestruct
369  *
370  * Revision 6.19  1998/02/27 16:52:07  madden
371  * Added BlastGetSequenceFromBioseq
372  *
373  * Revision 6.18  1998/02/27 14:34:51  madden
374  * Added error message prototypes
375  *
376  * Revision 6.17  1998/02/26 22:34:25  madden
377  * Changes for 16 bit windows
378  *
379  * Revision 6.16  1998/02/26 19:11:38  madden
380  * Added prototypes for BlastNtFindWords BlastPopulateAllWordArrays
381  *
382  * Revision 6.15  1998/02/19 17:17:12  madden
383  * Use of Int4 rather than Int2 when pruning SeqAlign
384  *
385  * Revision 6.14  1998/02/11 17:18:17  madden
386  * Made BlastGetGappedAlignmentTraceback functions to BlastGetGapAlgnTbck (shorter than 32 chars)
387  *
388  * Revision 6.13  1998/01/05 16:46:54  madden
389  * One or both strands can be searched, as opposed to only both, changes to number of contexts
390  *
391  * Revision 6.12  1997/12/31 17:53:11  madden
392  * Removed BLAST_WordFinderNew and BLAST_WordFinderDestruct prototypes
393  *
394  * Revision 6.11  1997/12/23 18:12:38  madden
395  * Changes for range-dependent blast
396  *
397  * Revision 6.10  1997/12/12 20:38:36  madden
398  * ContextToFrame lost last parameter
399  *
400  * Revision 6.9  1997/11/28 18:19:37  madden
401  * Changes to TxDfDbInfoNew
402  *
403  * Revision 6.8  1997/11/07 00:48:29  madden
404  * Added TXMATRIX defintion
405  *
406  * Revision 6.7  1997/10/24 20:46:55  madden
407  * Removed BLASTResultsStructNew prototype
408  *
409  * Revision 6.6  1997/10/24 19:09:19  madden
410  * Removed BlastSetReadDB and BlastGetReadDB_ID, changed to ReadDBGetDb and ReadDBGetDbId
411  *
412  * Revision 6.5  1997/10/03 21:27:34  madden
413  * Added BlastGetTypes
414  *
415  * Revision 6.4  1997/10/02 17:29:27  madden
416  * Added PrintDbInformationBasic
417  *
418  * Revision 6.3  1997/09/18 22:22:09  madden
419  * Added prune functions
420  *
421  * Revision 6.2  1997/09/16 16:31:33  madden
422  * More changes for multiple db runs
423  *
424  * Revision 6.1  1997/09/11 18:49:28  madden
425  * Changes to enable searches against multiple databases.
426  *
427  * Revision 6.0  1997/08/25 18:52:44  madden
428  * Revision changed to 6.0
429  *
430  * Revision 1.48  1997/08/22 18:37:49  madden
431  * Added function BlastOtherReturnsPrepare
432  *
433  * Revision 1.47  1997/07/24 20:34:50  madden
434  * define change for masking
435  *
436  * Revision 1.46  1997/07/18 14:26:42  madden
437  * call to AcknowledgeBlastQuery changed
438  *
439  * Revision 1.45  1997/07/17 20:27:11  madden
440  * Changed defines to indicate frame
441  *
442  * Revision 1.44  1997/07/16 20:34:48  madden
443  * Added function BlastConvertProteinSeqLoc
444  *
445  * Revision 1.43  1997/07/15 20:36:11  madden
446  * Added BioseqSeg and SeqLocSeg
447  *
448  * Revision 1.42  1997/07/14 15:32:25  madden
449  * prototype for BlastConstructErrorMessage
450  *
451  * Revision 1.41  1997/06/27 14:30:42  madden
452  * prototypes for BlastAddSeqIdToList and BlastSeqIdListDestruct
453  *
454  * Revision 1.40  1997/06/06 21:29:36  madden
455  * Added Boolean html to AcknowledgeBlastQuery and PrintDbInformation
456  *
457  * Revision 1.39  1997/06/06 19:50:58  madden
458  * Added BlastMakeFakeBioseq and BlastDeleteFakeBioseq
459  *
460  * Revision 1.38  1997/05/27 20:20:08  madden
461  * Added function BlastMaskTheResidues
462  *
463  * Revision 1.37  1997/04/23 21:56:07  madden
464  * Changes in BlastGetGappedAlignmentTraceback for in-frame gapping tblastn.
465  *
466  * Revision 1.36  1997/04/11  21:18:45  madden
467  * Added GetSequenceWithDenseSeg.
468  *
469  * Revision 1.35  1997/04/07  18:17:09  madden
470  * Added prototype for BioseqBlastEngineCore
471  *
472  * Revision 1.34  1997/03/06  21:47:10  madden
473  * Added FormatBlastParameters.
474  *
475  * Revision 1.33  1997/03/05  14:29:46  madden
476  * Added prototype for BlastSaveCurrentHsp.
477  *
478  * Revision 1.32  1997/03/04  21:34:59  madden
479  * Added in HspArrayPurge.
480  *
481  * Revision 1.31  1997/03/04  20:36:51  madden
482  * *** empty log message ***
483  *
484  * Revision 1.30  1997/03/03  22:39:45  madden
485  * Moved code from blast.c to blastutl.c.
486  *
487  * Revision 1.29  1997/03/03  21:48:52  madden
488  * *** empty log message ***
489  *
490  * Revision 1.28  1997/03/01  18:25:33  madden
491  * reverse flag added to BlastGetGappedAlignmentTraceback functions.
492  *
493  * Revision 1.27  1997/02/26  23:39:54  madden
494  * Added Txdfline stuff.
495  *
496  * Revision 1.26  1997/02/12  22:19:08  madden
497  * Added prototype for BlastNewFindWords.
498  *
499  * Revision 1.25  1997/02/11  19:30:54  madden
500  * Added prototypes for BlastGetGappedScoreWithReaddb and BlastGetGapped
501  *
502  * Revision 1.24  1997/02/10  20:03:58  madden
503  * Added specific to BlastAllWordNew.
504  *
505  * Revision 1.23  1997/02/07  22:43:03  madden
506  * Moved BLAST_WordFinderNew and Destruct from blast.c to blastutl.c, made
507  * non-static.
508  *
509  * Revision 1.22  1997/02/07  22:32:40  madden
510  * Changed prototypes for BlastGetSubjectId and GetSeqAlignForResultHitList.
511  *
512  * Revision 1.21  1997/01/30  21:41:17  madden
513  * Prototype for FormatBlastParameters added.
514  *
515  * Revision 1.20  1997/01/11  18:58:29  madden
516  * Removed defunct PerformBlastSearch... functions.
517  *
518  * Revision 1.19  1997/01/07  20:40:29  madden
519  * Added reverse Boolean to GetSeqAlignForResultHitList.
520  *
521  * Revision 1.18  1997/01/06  22:41:46  madden
522  * Added prototype BlastGetSubjectId.
523  *
524  * Revision 1.17  1996/12/23  22:02:05  madden
525  * Changes to allow two sequences to be compared.
526  *
527  * Revision 1.16  1996/12/20  15:31:39  madden
528  * Removed prototype for Perform2PassBlastSearchWithReadDb.
529  *
530  * Revision 1.15  1996/12/20  14:22:48  madden
531  * Added discontinuous Boolean to GetSeqAlignForResultHitList.
532  *
533  * Revision 1.14  1996/12/12  16:46:25  madden
534  * Changed CONTAINED_IN_HSP.
535  *
536  * Revision 1.13  1996/12/08  15:19:59  madden
537  * Added defines and prototypes for gapped alignments.
538  *
539  * Revision 1.12  1996/11/14  16:21:55  madden
540  * changed CharPtr to Uint1Ptr in GetTranslation.
541  *
542  * Revision 1.11  1996/11/13  22:35:18  madden
543  * Added prototype for GetTranslation.
544  *
545  * Revision 1.10  1996/11/05  23:19:08  madden
546  * Changed BlastTranslateUnambiguousSequence prototype.
547  *
548  * Revision 1.9  1996/09/26  20:18:43  madden
549  * Changed prototype for GetSeqAlignForResultHitList
550  *
551  * Revision 1.8  1996/09/12  21:12:23  madden
552  * Removed prototypes for BLAST_WordFinderNew and BLAST_WordFinderDestruct.
553  *
554  * Revision 1.7  1996/09/11  22:22:12  madden
555  * Added prototpe for BLASTPerformSearchWithReadDb.
556  *
557  * Revision 1.6  1996/08/26  17:24:19  shavirin
558  * Added definition of function Win32TimeFill()
559  *
560  * Revision 1.5  1996/08/23  16:30:11  shavirin
561  * Fixed NT compiler warnings type mismatch
562  *
563  * Revision 1.4  1996/08/15  18:58:49  madden
564  * Changed context from Int2 to Int1
565  *
566  * Revision 1.3  1996/08/14  15:20:37  madden
567  * Added prototype for BlastTranslateUnambiguousSequence.
568  *
569  * Revision 1.2  1996/08/07  14:24:15  madden
570  * Removed functions that depend on BLAST0 structures.
571  *
572  * Revision 1.1  1996/08/05  19:46:53  madden
573  * Initial revision
574  *
575  * Revision 1.32  1996/07/31  13:10:53  madden
576  * Added BlastSearchBlkDuplicate prototype.
577  *
578  * Revision 1.31  1996/07/25  20:47:49  madden
579  * Change to arguments of Perform2PassBlastSearchWithReadDb.
580  *
581  * Revision 1.30  1996/07/18  22:01:35  madden
582  * Changed call to BlastFindWords
583  *
584  * Revision 1.29  1996/06/21  15:15:21  madden
585  * Removed unused prototype
586  *
587  * Revision 1.28  1996/06/20  16:15:57  madden
588  * Replaced int's with Int4's.
589  *
590  * Revision 1.27  1996/06/17  21:07:32  madden
591  * Added prototype for GetSeqAlignForResultHitList and some LIBCALL's.
592  *
593  * Revision 1.26  1996/06/17  19:02:35  madden
594  * Removed unused prototypes.
595  *
596  * Revision 1.25  1996/06/13  21:16:33  madden
597  * removed BLAST_ExtendWordNew prototype.
598  *
599  * Revision 1.24  1996/06/11  17:58:31  madden
600  * removed prototype for BLAST_ExtendWordDiagResize.
601  *
602  * Revision 1.23  1996/06/06  14:09:22  madden
603  * Removed blast_set_parameters prototype (it became static).
604  *
605  * Revision 1.22  1996/06/06  13:54:51  madden
606  * Removed defunct function BLAST_ParameterBlkFill
607  *
608  * Revision 1.21  1996/06/04  15:33:55  madden
609  * Changed BlastHitList function prototypes.
610  *
611  * Revision 1.20  1996/05/29  12:44:40  madden
612  * Added prototype for BlastTimeFillStructure.
613  *
614  * Revision 1.19  1996/05/16  19:51:09  madden
615  * Added documentation block.
616  *
617  * Revision 1.18  1996/05/14  16:15:59  madden
618  * Added protoytpe for BLASTResultsStruc functions.
619  *
620  * Revision 1.17  1996/05/01  14:59:41  madden
621  * *** empty log message ***
622  *
623  * Revision 1.16  1996/04/03  19:14:08  madden
624  * added functions PerformBlastSearchWithReadDb and Perform2PassBlastSearchWithReadDb.
625  *
626  * Revision 1.15  1996/03/29  21:28:20  madden
627  * *** empty log message ***
628  *
629  * Revision 1.14  1996/03/29  14:09:37  madden
630  * prototype for GetSeqAlignForSparseHitList added.
631  *
632  * Revision 1.13  1996/02/28  21:38:36  madden
633  * Changed prototypes for discontiguous words.
634  *
635  * Revision 1.12  1996/02/05  18:46:57  madden
636  * *** empty log message ***
637  *
638  * Revision 1.11  1996/02/02  19:25:32  madden
639  * Changed BlastFindWords prototype.
640  *
641  * Revision 1.10  1996/01/31  22:28:46  madden
642  * Added prototype for BlastReapHitlistByEvalue.
643  *
644  * Revision 1.9  1996/01/17  13:47:13  madden
645  * *** empty log message ***
646  *
647  * Revision 1.8  1996/01/11  15:17:58  madden
648  * Added prototype for do_MPblast_search.
649  *
650  * Revision 1.7  1996/01/10  17:51:09  madden
651  * Added SortHitListByPvalue.
652  *
653  * Revision 1.6  1996/01/06  18:58:45  madden
654  * Added prototype for BlastLinkHsps.
655  *
656  * Revision 1.5  1995/12/30  18:39:27  madden
657  * Added prototype for GetBLAST0KABlk.
658  *
659  * Revision 1.4  1995/12/28  21:26:30  madden
660  * Added in prototype for do_blast_search.
661  *
662  * Revision 1.3  1995/12/26  23:05:29  madden
663  * Added prototype for blast_set_parameters.
664  *
665  * Revision 1.2  1995/12/21  23:11:11  madden
666  *  BLAST_Score prototypes moved to blastkar.h.
667  *
668  * Revision 1.1  1995/12/19  22:31:17  madden
669  * Initial revision
670  *
671  * Revision 1.1  1995/12/08  15:48:23  madden
672  * Initial revision
673  *
674  * */
675 #ifndef __BLASTPRI__
676 #define __BLASTPRI__
677 
678 #include <blast.h>
679 #include <blastkar.h>
680 #include <posit.h>
681 #include <seed.h>
682 #include <ffprint.h>
683 
684 
685 #ifdef __cplusplus
686 extern "C" {
687 #endif
688 
689 /*
690 	Defines for the return values in "other_returns".
691 */
692 
693 #define SEQLOC_MASKING_NOTSET 0
694 #define SEQLOC_MASKING_PLUS1 1
695 #define SEQLOC_MASKING_PLUS2 2
696 #define SEQLOC_MASKING_PLUS3 3
697 #define SEQLOC_MASKING_MINUS1 4
698 #define SEQLOC_MASKING_MINUS2 5
699 #define SEQLOC_MASKING_MINUS3 6
700 #define TXDBINFO 10
701 #define TXKABLK_NOGAP 12
702 #define TXKABLK_GAP 13
703 #define TXPARAMETERS 14
704 #define TXMATRIX 15
705 #define EFF_SEARCH_SPACE 16
706 #define EFF_HSP_LENGTH 17
707 
708 /*
709 	Print a warning about the filtering used.
710 */
711 Boolean LIBCALL BlastPrintFilterWarning PROTO((CharPtr filter_string, Int4 line_length, FILE *outfp, Boolean html));
712 
713 
714 /* How many interations should be done in the bisection. */
715 #define BLAST_SAVE_ITER_MAX 20
716 
717 
718 /*
719 	TRUE if c is between a and b; f between d and f.  Determines if the
720 	coordinates are already in an HSP that has been evaluated.
721 */
722 #define CONTAINED_IN_HSP(a,b,c,d,e,f) (((a <= c && b >= c) && (d <= f && e >= f)) ? TRUE : FALSE)
723 
724 Int2 LIBCALL BlastFindWords PROTO((BlastSearchBlkPtr search, Int4 start, Int4 len, BLAST_Score threshold, Int1 context_index));
725 
726 
727 Int2 LIBCALL BlastNewFindWords PROTO((BlastSearchBlkPtr search, Int4 start, Int4 len, BLAST_Score threshold, Int1 context_index));
728 
729 Int2 BlastNewFindWordsEx(LookupTablePtr lookup, BLAST_ScorePtr PNTR posMatrix, Int4 start, Int4 len, BlastAllWordPtr all_words, BLAST_Score threshold, Int4 wordsize, Int1 context_index);
730 
731 Int2 LIBCALL BlastLinkHsps PROTO ((BlastSearchBlkPtr search));
732 
733 Int2 LIBCALL BlastReapHitlistByEvalue PROTO ((BlastSearchBlkPtr search));
734 
735 Int4 LIBCALL BlastSaveCurrentHitlist PROTO((BlastSearchBlkPtr search));
736 
737 Int2 LIBCALL BLASTPerformSearchWithReadDb PROTO((BlastSearchBlkPtr search, Int4 sequence_number));
738 
739 Int2 LIBCALL BLASTPerformSearch PROTO((BlastSearchBlkPtr search, Int4 subject_length, Uint1Ptr subject_seq));
740 
741 BLASTResultsStructPtr LIBCALL BLASTResultsStructDelete PROTO((BLASTResultsStructPtr result_struct));
742 
743 SeqAlignPtr LIBCALL GetSeqAlignForResultHitList PROTO((BlastSearchBlkPtr search, Boolean getdensediag, Boolean ordinal_number, Boolean discontinuous, Boolean reverse, Boolean get_redundant_seq));
744 
745 Int2 LIBCALL BlastTimeFillStructure PROTO((BlastTimeKeeperPtr btkp));
746 
747 BlastSearchBlkPtr LIBCALL BlastSearchBlkDuplicate PROTO((BlastSearchBlkPtr search));
748 
749 BlastSearchBlkPtr LIBCALL BlastSearchBlkNew PROTO((Int2 wordsize, Int4 qlen, CharPtr dbname, Boolean multiple_hits, BLAST_Score threshold_first, BLAST_Score threshold_second, Int4 result_size, CharPtr prog_name, BlastAllWordPtr all_words, Int2 first_context, Int2 last_context, Int4 window_size));
750 
751 /* Allocates a search Block, except it only attaches to the rdfp, does not allocate it. */
752 BlastSearchBlkPtr LIBCALL BlastSearchBlkNewExtra PROTO((Int2 wordsize, Int4 qlen, CharPtr dbname, Boolean multiple_hits, BLAST_Score threshold_first, BLAST_Score threshold_second, Int4 result_size, CharPtr prog_name, BlastAllWordPtr all_words, Int2 first_context, Int2 last_context, ReadDBFILEPtr rdfp, Int4 window_size));
753 
754 BlastSearchBlkPtr LIBCALL BlastSearchBlkDestruct PROTO((BlastSearchBlkPtr search));
755 
756 Int4 BlastSingleQueryResultSize PROTO((BLAST_OptionsBlkPtr options));
757 
758 BlastSearchBlkPtr BLASTSetUpSearchWithReadDbInternal PROTO((SeqLocPtr query_slp, BioseqPtr query_bsp, CharPtr prog_name, Int4 qlen, CharPtr dbname, BLAST_OptionsBlkPtr options, int (LIBCALLBACK *callback)PROTO((Int4 done, Int4 positives)), SeqIdPtr seqid_list, BlastDoubleInt4Ptr gi_list, Int4 gi_list_total, ReadDBFILEPtr rdfp));
759 
760 BlastSearchBlkPtr BLASTSetUpSearchWithReadDbInternalMult PROTO((SeqLocPtr query_slp, BioseqPtr query_bsp, CharPtr prog_name, Int4 qlen, CharPtr dbname, BLAST_OptionsBlkPtr options, int (LIBCALLBACK *callback)PROTO((Int4 done, Int4 positives)), SeqIdPtr seqid_list, BlastDoubleInt4Ptr gi_list, Int4 gi_list_total, ReadDBFILEPtr rdfp, QueriesPtr mult_queries));
761 /* --KM added mult_queries param */
762 
763 BlastSearchBlkPtr LIBCALL
764 BLASTSetUpSearchWithReadDbInternalEx PROTO((SeqLocPtr query_slp, BioseqPtr query_bsp,
765 				      CharPtr prog_name, Int4 qlen, CharPtr
766 				      dbname, BLAST_OptionsBlkPtr options, int
767 				      (LIBCALLBACK *callback)PROTO((Int4 done,
768 								    Int4
769 								    positives)),
770 				      SeqIdPtr seqid_list, BlastDoubleInt4Ptr
771 				      gi_list, Int4 gi_list_total, ReadDBFILEPtr
772 				      rdfp));
773 
774 Int4 LIBCALL BlastTranslateUnambiguousSequence PROTO((BlastSearchBlkPtr search, Int4 length, Uint1Ptr prot_seq, Uint1Ptr nt_seq, Int2 frame));
775 
776 Uint1Ptr LIBCALL GetTranslation PROTO((Uint1Ptr query_seq, Int4 nt_length, Int2 frame, Int4Ptr length, CharPtr genetic_code));
777 
778 SeqAlignPtr LIBCALL BlastGetGapAlgnTbck PROTO((BlastSearchBlkPtr search, Int4 hit_number, Boolean reverse, Boolean ordinal_number, Uint1Ptr subject, Int4 subject_length, Uint1Ptr rev_subject, Int4 rev_subject_length));
779 
780 SeqAlignPtr LIBCALL BlastGetGapAlgnTbckWithReaddb PROTO((BlastSearchBlkPtr search, Int4 hit_number, Boolean ordinal_number));
781 
782 Int2 LIBCALL BlastGetGappedScoreWithReaddb PROTO((BlastSearchBlkPtr search, Int4 sequence_number));
783 
784 Int2 LIBCALL BlastGetGappedScore PROTO((BlastSearchBlkPtr search, Int4 subject_length, Uint1Ptr subject, Int2 frame));
785 
786 Int2 LIBCALL BlastNTGetGappedScore PROTO((BlastSearchBlkPtr search, Int4 subject_length, Uint1Ptr subject));
787 
788 
789 SeqIdPtr LIBCALL BlastGetSubjectId PROTO((BlastSearchBlkPtr search, Int4 hit_number, Boolean ordinal_number, ValNodePtr *vnpp));
790 
791 
792 
793 BlastAllWordPtr LIBCALL BlastAllWordNew PROTO((Int4 num_of_cols, Int4 wordsize, Boolean rows_allocated, Boolean specific));
794 
795 BlastAllWordPtr LIBCALL BlastAllWordDestruct PROTO((BlastAllWordPtr all_words));
796 
797 
798 BLAST_HitListPtr LIBCALL BlastHitListDestruct PROTO((BLAST_HitListPtr hitlist));
799 
800 BLAST_HitListPtr LIBCALL BlastHitListNew PROTO((BlastSearchBlkPtr search));
801 
802 
803 
804 void LIBCALL BlastExtendWordExit PROTO((BlastSearchBlkPtr search));
805 
806 
807 
808 Boolean LIBCALL FilterWithSeg PROTO((Uint1Ptr sequence, Int4 length, Uint1 alphabet));
809 
810 BLASTResultHitlistPtr LIBCALL BLASTResultHitlistFree PROTO((BLASTResultHitlistPtr result));
811 BLASTResultHitlistPtr LIBCALL BLASTResultHitlistFreeEx PROTO((BlastSearchBlkPtr search, BLASTResultHitlistPtr result));
812 
813 BLASTResultHitlistPtr LIBCALL BLASTResultHitlistNew PROTO((Int4 hspcnt));
814 Boolean LIBCALL
815 CopyResultHspToHSP PROTO((BLASTResultHspPtr result_hsp, BLAST_HSPPtr hsp));
816 
817 Nlm_FloatHi LIBCALL GetDbSubjRatio PROTO((BlastSearchBlkPtr search, Int4 subject_length));
818 
819 Int2 LIBCALL BlastPreliminaryGappedScore PROTO((BlastSearchBlkPtr search, Uint1Ptr subject, Int4 subject_length, Int2 frame));
820 
821 Int2 LIBCALL BlastNTPreliminaryGappedScore PROTO((BlastSearchBlkPtr search, Uint1Ptr subject, Int4 subject_length));
822 
823 
824 Int2 LIBCALL BlastHitListPurge PROTO((BLAST_HitListPtr hitlist));
825 
826 Int4 LIBCALL HspArrayPurge PROTO((BLAST_HSPPtr PNTR hsp_array, Int4 hspcnt, Boolean clear_num));
827 
828 
829 void BlastSaveCurrentHsp PROTO((BlastSearchBlkPtr search, BLAST_Score score, Int4 q_offset, Int4 s_offset, Int4 length, Int2 context));
830 
831 void BlastSaveCurrentHspGapped PROTO((BlastSearchBlkPtr search, BLAST_Score
832 				      score, Int4 q_offset, Int4 s_offset, Int4
833 				      q_length, Int4 s_length, Int2 context,
834 				      GapXEditScriptPtr esp));
835 void BlastNtSaveCurrentHspGapped PROTO((BlastSearchBlkPtr search, BLAST_Score
836 				      score, Int4 q_offset, Int4 s_offset, Int4
837 				      q_length, Int4 s_length,
838                                       Int4 q_gapped_start, Int4 s_gapped_start,
839                                       Int2 context, GapXEditScriptPtr esp));
840 
841 void BlastNtSaveCurrentHsp PROTO((BlastSearchBlkPtr search, BLAST_Score score, Int4 q_offset, Int4 s_offset, Int4 length, Int2 context, Int4 query_gap_start, Int4 subject_gap_start));
842 
843 CharPtr FormatBlastParameters PROTO((BlastSearchBlkPtr search));
844 
845 
846 SeqAlignPtr LIBCALL BioseqBlastEngineCore PROTO((BlastSearchBlkPtr search, BLAST_OptionsBlkPtr options, Int4Ptr *pos_matrix));
847 
848 Uint1Ptr GetSequenceWithDenseSeg PROTO((DenseSegPtr dsp, Boolean query, Int4Ptr start, Int4Ptr length));
849 
850 void BlastMaskTheResidues PROTO((Uint1Ptr buffer, Int4 max_length, Uint1 mask_residue, SeqLocPtr mask_slp, Boolean reverse, Int4 offset));
851 
852 BioseqPtr LIBCALL BlastMakeFakeBioseq PROTO((BioseqPtr bsp, CharPtr name));
853 
854 BioseqPtr LIBCALL BlastDeleteFakeBioseq PROTO((BioseqPtr fake_bsp));
855 
856 Boolean BlastAddSeqIdToList PROTO((BlastSearchBlkPtr search, Int4 ordinal_id, SeqIdPtr sip));
857 
858 ValNodePtr BlastConstructErrorMessage PROTO((CharPtr function, CharPtr message, Uint1 level, ValNodePtr PNTR vnpp));
859 
860 BlastErrorMsgPtr BlastDestroyErrorMessage PROTO((BlastErrorMsgPtr error_msg));
861 
862 ValNodePtr BlastErrorChainDestroy PROTO((ValNodePtr vnp));
863 
864 ValNodePtr LIBCALL BlastOtherReturnsPrepare PROTO((BlastSearchBlkPtr search));
865 void LIBCALL BlastOtherReturnsFree PROTO((ValNodePtr other_returns));
866 
867 SeqLocPtr BlastBioseqFilter PROTO((BioseqPtr bsp, CharPtr instructions));
868 
869 SeqLocPtr BlastSeqLocFilter PROTO((SeqLocPtr slp, CharPtr instructions));
870 
871 SeqLocPtr BlastBioseqFilterEx PROTO((BioseqPtr bsp, CharPtr instructions, BoolPtr mask_at_hash));
872 
873 SeqLocPtr BlastSeqLocFilterEx PROTO((SeqLocPtr slp, CharPtr instructions, BoolPtr mask_at_hash));
874 
875 SeqLocPtr MyBioseqSeg PROTO((BioseqPtr bsp_unfilter));
876 
877 SeqLocPtr SeqLocSeg PROTO((SeqLocPtr slp));
878 
879 Boolean BlastConvertProteinSeqLoc PROTO((SeqLocPtr slp, Int2 frame, Int4 full_length));
880 
881 Boolean BlastConvertDNASeqLoc (SeqLocPtr slp, Int2 frame, Int4 full_length);
882 
883 Uint1 LIBCALL BlastGetTypes PROTO((CharPtr blast_program, Boolean PNTR query_is_na, Boolean PNTR db_is_na));
884 
885 BLASTResultsStructPtr BLASTResultsStructNew PROTO((Int4 results_size, Int4 max_pieces, Int4 range_max));
886 
887 Int2 BlastNtFindWords PROTO((BlastSearchBlkPtr search, Int4 start, Int4 len, Int1 context_index));
888 
889 BlastAllWordPtr BlastPopulateAllWordArrays PROTO((Int4 wordsize, Int4 alphabet_size));
890 
891 Uint1Ptr BlastGetSequenceFromBioseq PROTO((BioseqPtr bsp, Int4Ptr length));
892 
893 /* Retrieve the virtual oidlist from rdfp_chain */
894 OIDListPtr LIBCALL BlastGetVirtualOIDList PROTO((ReadDBFILEPtr rdfp_chain));
895 
896 Boolean BlastAdjustDbNumbers PROTO((ReadDBFILEPtr rdfp_list, Int8Ptr db_length, Int4Ptr db_number, SeqIdPtr seqid_list, BlastDoubleInt4Ptr gi_list, OIDListPtr oidlist, BlastDoubleInt4Ptr PNTR gi_list_pointers, Int4 gi_list_total));
897 
898 BlastGiListPtr BlastGiListDestruct PROTO((BlastGiListPtr blast_gi_list, Boolean contents));
899 BlastGiListPtr BlastGiListNew PROTO((BlastDoubleInt4Ptr gi_list, Int4 total));
900 
901 
902 ScorePtr LIBCALL GetScoreSetFromBlastResultHsp PROTO((BLASTResultHspPtr hsp, SeqIdPtr gi_list));
903 
904 Nlm_FloatHi BlastScaleMatrix PROTO((BlastMatrixRescalePtr matrix_rescale, Boolean position_dependent));
905 
906 BlastMatrixRescalePtr BlastMatrixRescaleNew PROTO((Int4 alphabet_size, Int4 query_length, Uint1Ptr query,  Nlm_FloatHiPtr standardProb, Int4Ptr *matrix, Int4Ptr *private_matrix, BLAST_KarlinBlkPtr *kbp_std, BLAST_KarlinBlkPtr *kbp_psi, BLAST_KarlinBlkPtr *kbp_gap_std, BLAST_KarlinBlkPtr *kbp_gap_psi, Nlm_FloatHi lambda_ideal,  Nlm_FloatHi K_ideal));
907 
908 BlastMatrixRescalePtr BlastMatrixRescaleDestruct PROTO((BlastMatrixRescalePtr matrix_rescale));
909 
910 /*
911         starts the awake thread using static variables in this file.
912 */
913 
914 void BlastStartAwakeThread PROTO((BlastThrInfoPtr thr_info));
915 
916 /* Change the awake flag.  This thread will die in one second. */
917 void BlastStopAwakeThread PROTO((BlastThrInfoPtr thr_info));
918 
919 SeqLocPtr HitRangeToSeqLoc PROTO((BlastHitRangePtr bhrp, Int4 link_value, Boolean combine));
920 
921 
922 ValNodePtr BlastSeqLocFillDoubleInt PROTO((SeqLocPtr mask_slp, Int4 max_length, Boolean reverse));
923 ValNodePtr BlastSeqLocFillDoubleIntEx PROTO((SeqLocPtr mask_slp, Int4 full_query_length, Int4 max_length, Boolean reverse, Int4 offset));
924 ValNodePtr BlastSeqLocFillDoubleIntRev PROTO((ValNodePtr location, SeqLocPtr mask_slp, Int4 full_query_length, Int4 max_length, Int4 offset));
925 
926 
927 Int2 BlastInsertList2Heap PROTO((BlastSearchBlkPtr search, BLASTResultHitlistPtr result_hitlist));
928 
929 void BlastFreeHeap PROTO((BlastSearchBlkPtr search, BLASTResultHitlistPtr result_hitlist));
930 
931 ValNodePtr convertSeqAlignListToValNodeList(SeqAlignPtr seqAlignList, SeqAlignPtr * lastSeqAligns, Int4 numLastSeqAligns);
932 
933 SeqAlignPtr convertValNodeListToSeqAlignList(ValNodePtr seqAlignDoubleList, SeqAlignPtr ** lastSeqAligns, Int4 * numLastSeqAligns);
934 
935 void LIBCALL fillCandLambda(seedSearchItems * seedSearch, Char *matrixName, BLAST_OptionsBlkPtr options);
936 
937 Int4 RealBlastGetGappedAlignmentTraceback(BlastSearchBlkPtr search, Uint1Ptr subject, Int4 subject_length, Uint1Ptr rev_subject, Int4 rev_subject_length, SeqIdPtr subject_id, BLAST_HSPPtr *hsp_array, Int4 hspcnt, SeqAlignPtr *head, BlastHitRangePtr bhrp, Int4 min_score_to_keep, Boolean reverse, Int4 ordinal_id, Boolean do_traceback);
938 
939 Int2 ContextToFrame PROTO((BlastSearchBlkPtr search, Int2 context_number));
940 
941 int LIBCALLBACK score_compare_hsps PROTO((VoidPtr v1, VoidPtr v2));
942 
943 Int2 LIBCALL BlastGetNonSumStatsEvalue PROTO((BlastSearchBlkPtr search));
944 
945 Boolean BlastGetDbChunk(ReadDBFILEPtr rdfp, Int4Ptr start, Int4Ptr stop,
946                         Int4Ptr id_list, Int4Ptr id_list_number,
947                         BlastThrInfoPtr thr_info);
948 void BlastTickProc(Int4 sequence_number, BlastThrInfoPtr thr_info);
949 
950 Boolean BlastParseInputString(CharPtr string, CharPtr letters, CharPtr PNTR *values_in, CharPtr PNTR ErrorMessage);
951 
952 Int4 BlastGetLetterIndex(CharPtr letters, Char ch);
953 
954 SeqIdPtr BlastGetAllowedGis PROTO((BlastSearchBlkPtr search, Int4 ordinal_id, SeqIdPtr PNTR seqid));
955 
956 Int4 BlastDeleteHeap PROTO((BLASTHeapPtr which_heap, Int4 position));
957 
958 
959 
960 /* Functions used in OOF calculations */
961 
962 BlastSequenceBlkPtr PNTR LIBCALL
963 BlastMakeCopyQueryDNAP PROTO((BlastSequenceBlkPtr PNTR bsbpp_in));
964 
965 void LIBCALL BlastFreeQueryDNAP PROTO((BlastSequenceBlkPtr PNTR bsbpp));
966 
967     BlastSequenceBlkPtr PNTR LIBCALL
968 BlastCreateQueryDNAP PROTO((BlastSearchBlkPtr search, Int4 length));
969 
970 /* -----------------------------------------------------------------
971    This function will filter given SeqAlignPtr for overlaping
972    regions for the same query/subject pair. Another input parameter is
973    percentage of overlapping required for the alignment to be removed
974    from SeqAlignPtr
975    ---------------------------------------------------------------- */
976 SeqAlignPtr BLASTFilterOverlapRegions(SeqAlignPtr sap, Int4 pct,
977                                       Boolean subject_is_aa,
978                                       Boolean is_ooframe,
979                                       Boolean sort_array);
980 
981 /* End of functions used in OOF calculations */
982 
983 Int4
984 BlastGetNumIdentical PROTO((Uint1Ptr query, Uint1Ptr subject, Int4 q_start,
985                          Int4 s_start, Int4 length, Boolean reverse));
986 
987 Int2
988 BlastHSPGetNumIdentical PROTO((BlastSearchBlkPtr search, BLAST_HSPPtr hsp,
989    BLASTResultHspPtr result_hsp, Int4Ptr num_ident, Int4Ptr align_length));
990 Int2
991 OOFBlastHSPGetNumIdentical PROTO((Uint1Ptr query_seq, Uint1Ptr subject_seq,
992    BLAST_HSPPtr hsp, BLASTResultHspPtr result_hsp, Int4Ptr num_ident,
993    Int4Ptr align_length));
994 
995 SeqIdPtr GetTheSeqAlignID PROTO((SeqIdPtr seq_id));
996 StdSegPtr BLASTHspToStdSeg PROTO((BlastSearchBlkPtr search, Int4 subject_length, BLAST_HSPPtr hsp, SeqIdPtr sip, Boolean reverse, SeqIdPtr gi_list));
997 
998 /* Callbacks to handle results instead of saving hit lists */
999 #define BUFFER_LENGTH 255
1000 #define LARGE_BUFFER_LENGTH 1024
1001 
1002 int LIBCALLBACK BlastPrintAlignInfo PROTO((VoidPtr srch));
1003 int LIBCALLBACK MegaBlastPrintAlignInfo PROTO((VoidPtr srch));
1004 
1005 Boolean
1006 BlastProcessGiLists PROTO((BlastSearchBlkPtr search,
1007             BLAST_OptionsBlkPtr options, BlastDoubleInt4Ptr gi_list,
1008             Int4 gi_list_size));
1009 
1010 /* Purpose: Create the virtual oidlist that ultimately will limit the
1011  * blast search being set up. This will be an intersection of the bglp
1012  * parameter as well as any oidlists attached to the rdfp_chain.
1013  *
1014  * Parameters:
1015  * bglp: The gi list to limit the search (this will be freed this by this
1016  * function)
1017  * rdfp_chain: The head of the rdfp list that will be searched.
1018  * oidlist_for_all_rdfp: if true, the virtual oidlist will be attached to the
1019  * beginning of the rdfp_chain, else it will be attached to the first rdfp in
1020  * rdfp_chain that had an oidlist (and therefore covering all remaining
1021  * rdfps).
1022  * options: the blast options structure (see comments in blastool.c).
1023  *
1024  * Return value:
1025  * The intersection of the bglp parameter and any oidlists attached to the
1026  * rdfp_chain. */
1027 BlastGiListPtr BlastCreateVirtualOIDList PROTO((BlastGiListPtr bglp,
1028                                          ReadDBFILEPtr rdfp_chain,
1029                                          Boolean oidlist_forall_rdfp,
1030                                          BLAST_OptionsBlkPtr options));
1031 Boolean FastaCheckDna PROTO((CharPtr seq));
1032 BLASTHSPSegmentPtr BLASTHSPSegmentFromSeqAlign PROTO((SeqAlignPtr sap));
1033 SeqAlignPtr BlastClusterHitsFromSeqAlign PROTO((SeqAlignPtr seqalign, CharPtr prog_name, CharPtr database, BLAST_OptionsBlkPtr options, FloatHi length_thresh, FloatHi score_thresh, FloatHi overlap_thresh, Boolean two_sided));
1034 
1035 SeqAlignPtr PNTR
1036 RedoAlignmentCore PROTO((BlastSearchBlkPtr search,
1037                          BLAST_OptionsBlkPtr options,
1038                          Int4 hitlist_count,
1039                          Int4 adjustParameters,
1040                          Boolean SmithWaterman));
1041 
1042 BLAST_HSPPtr BLAST_HSPFree PROTO((BLAST_HSPPtr hsp));
1043 void BLASTResultFreeHsp PROTO((BLASTResultHitlistPtr result));
1044 void BLASTPostSearchLogic PROTO((BlastSearchBlkPtr search, BLAST_OptionsBlkPtr
1045                                  options, SeqAlignPtr PNTR seqalignp,
1046                                  Boolean single_chain));
1047 Boolean
1048 BlastNtWordUngappedExtend PROTO((BlastSearchBlkPtr search, Int4 q_off,
1049                                  Int4 s_off, Int4 cutoff));
1050 SeqLocPtr blastMergeFilterLocs PROTO((SeqLocPtr filter_slp,
1051                                       SeqLocPtr lcmask, Boolean translate,
1052                                       Int2 frame, Int4 length));
1053 
1054 /*
1055         function to calculate effective query length and
1056         effective db length.
1057 */
1058 
1059 /*return query fasta style title(id+title). New memory was allocated for this title*/
1060 CharPtr getFastaStyleTitle(BioseqPtr bsp);
1061 
1062 CharPtr load_options_to_buffer(CharPtr instructions, CharPtr buffer);
1063 
1064 VoidPtr index_proc PROTO((VoidPtr dummy));
1065 
1066 CharPtr BlastConstructFilterString PROTO((Int4 filter_value));
1067 
1068 int LIBCALLBACK evalue_compare_hits PROTO((VoidPtr v1, VoidPtr v2));
1069 
1070 Uint1 FrameToDefine PROTO((Int2 frame));
1071 
1072 Uint1Ptr
1073 GetPrivatTranslationTable PROTO((CharPtr genetic_code,
1074                                  Boolean reverse_complement));
1075 Int2 blast_set_parameters PROTO((BlastSearchBlkPtr search, Nlm_FloatHi
1076                                  dropoff_number_of_bits_1st_pass, Nlm_FloatHi
1077                                  dropoff_number_of_bits_2nd_pass, Nlm_FloatHi
1078                                  avglen, Nlm_FloatHi searchsp, Int4 window));
1079 Boolean
1080 BlastGetFirstAndLastContext PROTO((CharPtr prog_name, SeqLocPtr query_slp, Int2Ptr first_context, Int2Ptr last_context, Uint1 strand_options));
1081 
1082 void ConfigureDbChunkSize(BlastSearchBlkPtr search, Int4 num_seq);
1083 
1084 void BLASTCheckHSPInclusion(BLAST_HSPPtr *hsp_array, Int4 hspcnt,
1085                             Boolean is_ooframe);
1086 
1087 #ifdef __cplusplus
1088 }
1089 #endif
1090 #endif /* !__BLASTPRI__ */
1091 
1092