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

« back to all changes in this revision

Viewing changes to algo/blast/core/blast_util.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: blast_util.h,v 1.72 2005/11/16 14:31:36 madden Exp $
 
1
/* $Id: blast_util.h,v 1.76 2006/05/05 17:45:55 camacho Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
34
34
#define __BLAST_UTIL__
35
35
 
36
36
#include <algo/blast/core/blast_def.h>
 
37
#include <algo/blast/core/blast_query_info.h>
37
38
#include <algo/blast/core/blast_encoding.h>
38
39
 
39
40
#ifdef __cplusplus
86
87
/** Allocates memory for *sequence_blk and then populates it.
87
88
 * @param buffer start of sequence [in]
88
89
 * @param length query sequence length [in]
89
 
 * @param context context number [in]
90
90
 * @param seq_blk SequenceBlk to be allocated and filled in [out]
91
91
 * @param buffer_allocated Is the buffer allocated? If yes, 'sequence_start' is
92
92
 *        the start of the sequence, otherwise it is 'sequence'. [in]
94
94
*/
95
95
NCBI_XBLAST_EXPORT
96
96
Int2
97
 
BlastSetUp_SeqBlkNew (const Uint1* buffer, Int4 length, Int4 context,
 
97
BlastSetUp_SeqBlkNew (const Uint1* buffer, Int4 length,
98
98
    BLAST_SequenceBlk* *seq_blk, Boolean buffer_allocated);
99
99
 
100
100
/** Allocates a new sequence block structure. 
198
198
NCBI_XBLAST_EXPORT
199
199
Int1 BLAST_ContextToFrame(EBlastProgramType prog_number, Uint4 context_number);
200
200
 
201
 
/** Given a context from BLAST engine core, return the query index.
202
 
 * @param context Context saved in a BlastHSP structure [in]
203
 
 * @param program Type of BLAST program [in]
204
 
 * @return Query index in a set of queries or -1 on error
205
 
 */
206
 
NCBI_XBLAST_EXPORT
207
 
Int4 Blast_GetQueryIndexFromContext(Int4 context, EBlastProgramType program);
208
 
 
209
 
/** Deallocate memory for query information structure */
210
 
NCBI_XBLAST_EXPORT
211
 
BlastQueryInfo* BlastQueryInfoFree(BlastQueryInfo* query_info);
212
 
 
213
 
/** Duplicates the query information structure */
214
 
NCBI_XBLAST_EXPORT
215
 
BlastQueryInfo* BlastQueryInfoDup(BlastQueryInfo* query_info);
216
 
 
217
 
/** Obtains the sequence length for a given query in the query, without taking
218
 
 * into consideration any applicable translations 
219
 
 * @param qinfo BlastQueryInfo structure [in]
220
 
 * @param program CORE program type [in]
221
 
 * @param query_index number of the query 
222
 
 * (query_index < BlastQueryInfo::num_queries) [in]
223
 
 * @return the length of the query sequence requested
224
 
 */
225
 
Int4 BlastQueryInfoGetQueryLength(const BlastQueryInfo* qinfo,
226
 
                                  EBlastProgramType program,
227
 
                                  Int4 query_index);
228
 
 
229
 
/** Create auxiliary query structures with all data corresponding
230
 
 * to a single query sequence within a concatenated set. Allocates the 
231
 
 * structures if the pointers are NULL on input; otherwise only changes the
232
 
 * contents.
233
 
 * @param one_query_info_ptr Pointer to the query information structure for a 
234
 
 *                           single query. Allocated and filled here, so the
235
 
 *                           caller of this function will be responsible for
236
 
 *                           freeing it. [out]
237
 
 * @param one_query_ptr Pointer to the query sequence block structure; allocated
238
 
 *                      here, but the contents are not allocated; it is still 
239
 
 *                      safe to free by the caller after use. [out]
240
 
 * @param query_info Query information structure containing information about a 
241
 
 *                   concatenated set. [in]
242
 
 * @param query Query sequence block corresponding to a concatenated set of 
243
 
 *              queries. [in]
244
 
 * @param query_index Which query index to create the auxiliary structures 
245
 
 *                    for? [in]
246
 
 * @return -1 if memory allocation failed; 0 on success
247
 
 */
248
 
NCBI_XBLAST_EXPORT
249
 
Int2 Blast_GetOneQueryStructs(BlastQueryInfo** one_query_info_ptr, 
250
 
                              BLAST_SequenceBlk** one_query_ptr,
251
 
                              const BlastQueryInfo* query_info, 
252
 
                              BLAST_SequenceBlk* query, Int4 query_index);
253
 
 
254
 
 
255
201
/** Convert a sequence in ncbi4na or blastna encoding into a packed sequence
256
202
 * in ncbi2na encoding. Needed for 2 sequences BLASTn comparison.
257
203
 * @param buffer original sequence data (one base per byte) [in]
273
219
 *                   concatenated sequence. [in]
274
220
 */
275
221
NCBI_XBLAST_EXPORT
276
 
Int2 BLAST_InitDNAPSequence(BLAST_SequenceBlk* query_blk, 
277
 
                            const BlastQueryInfo* query_info);
 
222
Int2 BLAST_CreateMixedFrameDNATranslation(BLAST_SequenceBlk* query_blk, 
 
223
                                          const BlastQueryInfo* query_info);
278
224
 
279
225
/** Translate nucleotide into 6 frames. All frames are put into a 
280
226
 * translation buffer, with sentinel NULLB bytes in between.
328
274
NCBI_XBLAST_EXPORT
329
275
Int4 BSearchInt4(Int4 n, Int4* A, Int4 size);
330
276
 
331
 
 
332
 
/** Search BlastContextInfo structures for the specified offset */
333
 
NCBI_XBLAST_EXPORT
334
 
Int4 BSearchContextInfo(Int4 n, BlastQueryInfo * A);
335
 
 
336
 
 
337
 
/** Get the number of bytes required for the concatenated sequence
338
 
 * buffer, given a query info structure.  The context data should
339
 
 * already be assigned.
340
 
 * @param qinfo  Query info structure. [in/out]
341
 
 * @return Number of bytes for all queries and inter-query marks.
342
 
 */
343
 
Uint4
344
 
QueryInfo_GetSeqBufLen(const BlastQueryInfo* qinfo);
345
 
 
346
 
 
347
 
/** Copy the context query offsets to an allocated array of Int4.
348
 
 * @param info Describes the concatenated query.
349
 
 * @return Allocated array.
350
 
 */
351
 
NCBI_XBLAST_EXPORT
352
 
Int4 * ContextOffsetsToOffsetArray(BlastQueryInfo* info);
353
 
 
354
 
 
355
 
/** Copy the context query offsets from an array of Int4, allocating
356
 
 * the context array if needed.
357
 
 * @param info Destination for the values.
358
 
 * @param new_offsets Array of values to copy from.
359
 
 * @param prog        The blast program type.
360
 
 */
361
 
NCBI_XBLAST_EXPORT
362
 
void OffsetArrayToContextOffsets(BlastQueryInfo    * info,
363
 
                                 Int4              * new_offsets,
364
 
                                 EBlastProgramType   prog);
365
 
 
366
 
 
367
277
/** Get the standard amino acid probabilities. This is basically a wrapper for 
368
278
 * BlastScoreBlkNew() and Blast_ResFreqStdComp() from blast_stat.c with a more
369
279
 * intention-revealing name :)