~ubuntu-branches/ubuntu/saucy/ncbi-tools6/saucy-proposed

« 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: 2009-08-11 22:03:47 UTC
  • mfrom: (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090811220347-g4b6lzdvphvvbpiu
* New upstream release.
* debian/libncbi6.symbols: update accordingly.
* debian/control: clean up obsolete or redundant relationship declarations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Id: hspstream_collector.h,v 1.10 2008/02/14 15:55:42 kazimird 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 ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H
36
 
#define ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H
37
 
 
38
 
#include <algo/blast/core/ncbi_std.h>
39
 
#include <algo/blast/core/blast_program.h>
40
 
#include <algo/blast/core/blast_options.h>
41
 
#include <algo/blast/core/blast_hits.h>
42
 
#include <algo/blast/core/blast_hspstream.h>
43
 
#include <connect/ncbi_core.h>
44
 
 
45
 
#ifdef __cplusplus
46
 
extern "C" {
47
 
#endif
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
 
 
58
 
/** Default implementation of BlastHSPStream */
59
 
typedef struct BlastHSPListCollectorData {
60
 
   EBlastProgramType program;           /**< BLAST program type */
61
 
   SBlastHitsParameters* blasthit_params; /**< specifies how many 
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 */
68
 
   BlastHSPResults* results;/**< Structure for saving HSP lists */
69
 
   Boolean results_sorted;  /**< Have the results already been sorted? 
70
 
                               Set to true after the first read call. */
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;
75
 
   MT_LOCK x_lock;   /**< Mutex for writing and reading results. */
76
 
                                  
77
 
} BlastHSPListCollectorData;
78
 
 
79
 
/** Initialize the collector HSP stream for a multi-threaded search. The 
80
 
 * locking facility must be instantiated before this function is called. 
81
 
 * @param program Type of BlAST program [in]
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]
87
 
 * @param num_queries Number of query sequences in this BLAST search [in]
88
 
 * @param lock        Pointer to locking structure for writing by multiple
89
 
 *                    threads. Locking will not be performed if NULL. [in]
90
 
 */
91
 
BlastHSPStream* 
92
 
Blast_HSPListCollectorInitMT(EBlastProgramType program, 
93
 
                             SBlastHitsParameters* blasthit_params, 
94
 
                             const BlastExtensionOptions* extn_opts,
95
 
                             Boolean sort_on_read,
96
 
                             Int4 num_queries, MT_LOCK lock);
97
 
 
98
 
/** Initialize the collector HSP stream for a single-threaded search, i.e. 
99
 
 * no locking is done when reading/writing from/to the stream.
100
 
 * @param program Type of BlAST program [in]
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]
106
 
 * @param num_queries Number of query sequences in this BLAST search [in]
107
 
 */
108
 
BlastHSPStream* 
109
 
Blast_HSPListCollectorInit(EBlastProgramType program, 
110
 
                           SBlastHitsParameters* blasthit_params, 
111
 
                           const BlastExtensionOptions* extn_opts,
112
 
                           Boolean sort_on_read,
113
 
                           Int4 num_queries);
114
 
 
115
 
#ifdef __cplusplus
116
 
}
117
 
#endif
118
 
 
119
 
#endif /* !ALGO_BLAST_CORE__HSPSTREAM_COLLECTOR__H */