~ubuntu-branches/debian/experimental/ncbi-tools6/experimental

« 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: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Id: hspstream_collector.h,v 1.7 2005/05/16 12:20:04 madden Exp $
 
1
/*  $Id: hspstream_collector.h,v 1.10 2008/02/14 15:55:42 kazimird Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
32
32
 * a BLAST search, and subsequently return them in sorted order.
33
33
 */
34
34
 
35
 
#ifndef HSPSTREAM_COLLECTOR_H
36
 
#define HSPSTREAM_COLLECTOR_H
 
35
#ifndef ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H
 
36
#define ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H
37
37
 
 
38
#include <algo/blast/core/ncbi_std.h>
 
39
#include <algo/blast/core/blast_program.h>
38
40
#include <algo/blast/core/blast_options.h>
39
41
#include <algo/blast/core/blast_hits.h>
40
42
#include <algo/blast/core/blast_hspstream.h>
44
46
extern "C" {
45
47
#endif
46
48
 
 
49
/** Auxiliary structure to allow sorting the results by score for the
 
50
 * composition-based statistics code */
 
51
typedef struct SSortByScoreStruct {
 
52
    Boolean sort_on_read;    /**< Should the results be sorted on the first read
 
53
                               call? */
 
54
    Int4 first_query_index;  /**< Index of the first query to try getting
 
55
                               results from */
 
56
} SSortByScoreStruct;
 
57
 
47
58
/** Default implementation of BlastHSPStream */
48
59
typedef struct BlastHSPListCollectorData {
49
60
   EBlastProgramType program;           /**< BLAST program type */
50
61
   SBlastHitsParameters* blasthit_params; /**< specifies how many 
51
62
                               hits to save etc. */
 
63
   Int4 num_hsplists;          /**< number of HSPlists saved */
 
64
   Int4 num_hsplists_alloc;    /**< number of entries in sorted_hsplists */
 
65
   BlastHSPList **sorted_hsplists; /**< list of all HSPlists from 'results'
 
66
                                       combined, sorted in order of
 
67
                                       decreasing subject OID */
52
68
   BlastHSPResults* results;/**< Structure for saving HSP lists */
53
69
   Boolean results_sorted;  /**< Have the results already been sorted? 
54
70
                               Set to true after the first read call. */
55
 
   Boolean sort_on_read;    /**< Should the results be sorted on the first
56
 
                               read call? */
57
 
   Int4 first_query_index;  /**< Index of the first query to try getting 
58
 
                               results from. */
 
71
   /**< Non-NULL if the results should be sorted by score as opposed to subject
 
72
    * OID. This is necessary to meet a pre-condition of the composition-based
 
73
    * statistics processing */
 
74
   SSortByScoreStruct* sort_by_score;
59
75
   MT_LOCK x_lock;   /**< Mutex for writing and reading results. */
60
76
                                  
61
77
} BlastHSPListCollectorData;
64
80
 * locking facility must be instantiated before this function is called. 
65
81
 * @param program Type of BlAST program [in]
66
82
 * @param blasthit_params Specifies how many hits to save etc. [in]
 
83
 * @param extn_opts Extension options to determine composition-based statistics
 
84
 * mode [in]
 
85
 * @param sort_on_read Should results be sorted on the first read call? Only
 
86
 * applicable if composition-based statistics is on [in]
67
87
 * @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
88
 * @param lock        Pointer to locking structure for writing by multiple
70
89
 *                    threads. Locking will not be performed if NULL. [in]
71
90
 */
72
91
BlastHSPStream* 
73
92
Blast_HSPListCollectorInitMT(EBlastProgramType program, 
74
93
                             SBlastHitsParameters* blasthit_params, 
75
 
                             Int4 num_queries, Boolean sort_on_read, 
76
 
                             MT_LOCK lock);
 
94
                             const BlastExtensionOptions* extn_opts,
 
95
                             Boolean sort_on_read,
 
96
                             Int4 num_queries, MT_LOCK lock);
77
97
 
78
98
/** Initialize the collector HSP stream for a single-threaded search, i.e. 
79
99
 * no locking is done when reading/writing from/to the stream.
80
100
 * @param program Type of BlAST program [in]
81
101
 * @param blasthit_params Specifies how many hits to save etc. [in]
 
102
 * @param extn_opts Extension options to determine composition-based statistics
 
103
 * mode [in]
 
104
 * @param sort_on_read Should results be sorted on the first read call? Only
 
105
 * applicable if composition-based statistics is on [in]
82
106
 * @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
107
 */
85
108
BlastHSPStream* 
86
109
Blast_HSPListCollectorInit(EBlastProgramType program, 
87
110
                           SBlastHitsParameters* blasthit_params, 
88
 
                           Int4 num_queries, Boolean sort_on_read);
 
111
                           const BlastExtensionOptions* extn_opts,
 
112
                           Boolean sort_on_read,
 
113
                           Int4 num_queries);
89
114
 
90
115
#ifdef __cplusplus
91
116
}
92
117
#endif
93
118
 
94
 
#endif /* HSPSTREAM_COLLECTOR_H */
 
119
#endif /* !ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H */