~ubuntu-branches/ubuntu/maverick/ncbi-tools6/maverick

« back to all changes in this revision

Viewing changes to algo/blast/core/hspstream_collector.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  $Id: hspstream_collector.h,v 1.5 2004/09/24 14:19:26 camacho Exp $
 
2
 * ===========================================================================
 
3
 *
 
4
 *                            PUBLIC DOMAIN NOTICE
 
5
 *               National Center for Biotechnology Information
 
6
 *
 
7
 *  This software/database is a "United States Government Work" under the
 
8
 *  terms of the United States Copyright Act.  It was written as part of
 
9
 *  the author's official duties as a United States Government employee and
 
10
 *  thus cannot be copyrighted.  This software/database is freely available
 
11
 *  to the public for use. The National Library of Medicine and the U.S.
 
12
 *  Government have not placed any restriction on its use or reproduction.
 
13
 *
 
14
 *  Although all reasonable efforts have been taken to ensure the accuracy
 
15
 *  and reliability of the software and data, the NLM and the U.S.
 
16
 *  Government do not and cannot warrant the performance or results that
 
17
 *  may be obtained by using this software or data. The NLM and the U.S.
 
18
 *  Government disclaim all warranties, express or implied, including
 
19
 *  warranties of performance, merchantability or fitness for any particular
 
20
 *  purpose.
 
21
 *
 
22
 *  Please cite the author in any work or product based on this material.
 
23
 *
 
24
 * ===========================================================================
 
25
 *
 
26
 * Author:  Ilya Dondoshansky
 
27
 *
 
28
 */
 
29
 
 
30
/** @file hspstream_collector.h
 
31
 * Default implementation of the BlastHSPStream interface to save hits from
 
32
 * a BLAST search, and subsequently return them in sorted order.
 
33
 */
 
34
 
 
35
#ifndef HSPSTREAM_COLLECTOR_H
 
36
#define HSPSTREAM_COLLECTOR_H
 
37
 
 
38
#include <algo/blast/core/blast_options.h>
 
39
#include <algo/blast/core/blast_hits.h>
 
40
#include <algo/blast/core/blast_hspstream.h>
 
41
#include <connect/ncbi_core.h>
 
42
 
 
43
#ifdef __cplusplus
 
44
extern "C" {
 
45
#endif
 
46
 
 
47
/** Default implementation of BlastHSPStream */
 
48
typedef struct BlastHSPListCollectorData {
 
49
   EBlastProgramType program;           /**< BLAST program type */
 
50
   BlastHitSavingOptions* hit_options; /**< Hit saving options */
 
51
   BlastHSPResults* results;/**< Structure for saving HSP lists */
 
52
   Boolean results_sorted;  /**< Have the results already been sorted? 
 
53
                               Set to true after the first read call. */
 
54
   Boolean sort_on_read;    /**< Should the results be sorted on the first
 
55
                               read call? */
 
56
   Int4 first_query_index;  /**< Index of the first query to try getting 
 
57
                               results from. */
 
58
   MT_LOCK x_lock;   /**< Mutex for writing and reading results. */
 
59
                                  
 
60
} BlastHSPListCollectorData;
 
61
 
 
62
/** Initialize the collector HSP stream for a multi-threaded search. The 
 
63
 * locking facility must be instantiated before this function is called. 
 
64
 * @param program Type of BlAST program [in]
 
65
 * @param hit_options Hit saving options containing limits on numbers of 
 
66
 *                    results to save[in]
 
67
 * @param num_queries Number of query sequences in this BLAST search [in]
 
68
 * @param sort_on_read Should results be sorted on the first read call? [in]
 
69
 * @param lock        Pointer to locking structure for writing by multiple
 
70
 *                    threads. Locking will not be performed if NULL. [in]
 
71
 */
 
72
BlastHSPStream* 
 
73
Blast_HSPListCollectorInitMT(EBlastProgramType program, 
 
74
   BlastHitSavingOptions* hit_options, Int4 num_queries, 
 
75
   Boolean sort_on_read, MT_LOCK lock);
 
76
 
 
77
/** Initialize the collector HSP stream for a single-threaded search, i.e. 
 
78
 * no locking is done when reading/writing from/to the stream.
 
79
 * @param program Type of BlAST program [in]
 
80
 * @param hit_options Hit saving options containing limits on numbers of 
 
81
 *                    results to save[in]
 
82
 * @param num_queries Number of query sequences in this BLAST search [in]
 
83
 * @param sort_on_read Should results be sorted on the first read call? [in]
 
84
 */
 
85
BlastHSPStream* 
 
86
Blast_HSPListCollectorInit(EBlastProgramType program, BlastHitSavingOptions* hit_options, 
 
87
                           Int4 num_queries, Boolean sort_on_read);
 
88
 
 
89
#ifdef __cplusplus
 
90
}
 
91
#endif
 
92
 
 
93
#endif /* HSPSTREAM_COLLECTOR_H */