NCBI C Toolkit Cross Reference

C/algo/blast/api/blast_returns.h


  1 /* $Id: blast_returns.h,v 1.15 2007/07/10 15:28:07 papadopo 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 offical 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 *  Author: Ilya Dondoshansky
 25 * ===========================================================================*/
 26 
 27 /** @file blast_returns.h
 28  * Manipulation of data returned from BLAST other than Seq-aligns
 29  */
 30 
 31 #ifndef __BLAST_RETURNS__
 32 #define __BLAST_RETURNS__
 33 
 34 #ifdef __cplusplus
 35 extern "C" {
 36 #endif
 37 
 38 #ifndef NCBI_C_TOOLKIT
 39 #define NCBI_C_TOOLKIT
 40 #endif
 41 
 42 #include <algo/blast/core/blast_options.h>
 43 #include <algo/blast/core/blast_hits.h>
 44 #include <algo/blast/core/blast_diagnostics.h>   
 45 #include <algo/blast/api/blast_message_api.h>   
 46 #include <blfmtutl.h>
 47 
 48 /** @addtogroup CToolkitAlgoBlast
 49  *
 50  * @{
 51  */
 52 
 53 /** Small structure containing the just those Karlin-Altschul parameters needed
 54  * for the BLAST formatting */
 55 typedef struct BLAST_KAParameters {
 56    double Lambda;     /**< Karlin-Altschul scaling parameter. */
 57    double K;          /**< Karlin-Altschul K parameter. */
 58    double H;          /**< Karlin-Altschul entropy */
 59    double C;          /**< Constant factor for PHI BLAST e-values. */ 
 60 } BLAST_KAParameters;
 61 
 62 /** Small structure containing some numbers about database length, adjustment, 
 63  * etc.
 64  */
 65 typedef struct BLAST_DatabaseStats {
 66    Int4 dbnum;              /**< number of sequences in database search */
 67    Int8 dblength;           /**< Length of databases. */
 68    Int8 eff_dblength;       /**< Length of databases with edge corrections. */
 69    Int4 qlen;               /**< Length of query with edge corrections. */
 70    Int4 eff_qlen;           /**< Length of query with edge corrections. */
 71    Int4 hsp_length;         /**< Expect length of an HSP. */
 72    Int8 eff_searchsp;       /**< effective search-space */
 73    Int8 eff_searchsp_used;  /**< effective search-space actually used. */
 74 } Blast_DatabaseStats;
 75 
 76 /** Small structure containing relevant search parameters. 
 77  *  Mostly for use in building XML or footer in BLAST report.
 78  */
 79 typedef struct Blast_SearchParams {
 80    Boolean gapped_search;   /**< true if a gapped search. */
 81    Int4 gap_open;           /**< Cost of gap existence. */
 82    Int4 gap_extension;      /**< Cost to extend gap by one letter. */
 83    char* filter_string;     /**< filtering command. */
 84    char* matrix;            /**< name of matrix (e.g., BLOSUM62) */
 85    double expect;           /**< expect value cutoff. */
 86    Int4 match;              /**< reward for a match (blastn only) */
 87    Int4 mismatch;           /**< penalty for a mismatch (blastn only) */
 88    char* pattern;           /**< phi-blast pattern used. */
 89    char* entrez_query;      /**< query to entrez */
 90    double ethresh;          /**< PSI-BLAST threshold to keep HSPs in profile. */
 91    double threshold;        /**< threshold to start extension of hits. */
 92    Int4 window_size;        /**< max allowed distance between hits to init extension in 2-hit mode. */
 93 } Blast_SearchParams;
 94 
 95 Int2 
 96 Blast_SearchParamsFill(EBlastProgramType program_number,
 97                        const BlastScoringOptions* score_options,
 98                        const LookupTableOptions* lookup_options,
 99                        const BlastHitSavingOptions* hit_options,
100                        const QuerySetUpOptions* query_setup, 
101                        const BlastInitialWordOptions* word_options,
102                        const char* entrez_query,
103                        Blast_SearchParams** search_params);
104 
105 /** Structure holding all calculated data returned from a BLAST search other
106  * than the alignment.
107  */
108 typedef struct Blast_SummaryReturn {
109     BLAST_KAParameters* ka_params; /**< Ungapped Karlin-Altschul parameters */
110     BLAST_KAParameters* ka_params_gap;/**< Gapped Karlin-Altschul parameters */
111     Blast_DatabaseStats* db_stats; /**< database numbers and adjustments */
112     Blast_SearchParams* search_params;/**< parameters used in search. */
113     BlastDiagnostics* diagnostics; /**< diagnositics from engine. */
114     SBlastMessage* error;          /**< Error or warning message. */
115     SPHIQueryInfo* pattern_info; /**< In PHI BLAST only: information about 
116                                           pattern occurrences in query. */
117 } Blast_SummaryReturn;
118 
119 /** Retrieves necessary information from a sequence source and fills the 
120  * TxDfDbInfo structure.
121  * @param rdfp pointer to BLAST db reader [in]
122  * @return pointer to info about database.
123  */
124 TxDfDbInfo* Blast_GetDbInfo(ReadDBFILE* rdfp);
125 
126 /** Formats the BLAST parameters for the BLAST report.
127  *
128  * @param program_number indicates blastn, blastp, etc. [in]
129  * @param sum_return object constructed by Blast_SummaryReturnFill, used 
130  *    to fill buffer [in]
131  * @return char* with information, newlines indicated by tildes ('~').
132  */     
133 char*
134 Blast_GetParametersBuffer(EBlastProgramType program_number,
135         const Blast_SummaryReturn* sum_return);
136 
137 /** Fills the summary returns from the provided information.
138  * NOTE: either one of rdfp or subject_loc (below) can be NULL,
139  * but not both.
140  * @param program_number Type of BLAST program [in]
141  * @param score_options pointer for scoring options [in]
142  * @param sbp Karlin-Altschul/statistics information [in]
143  * @param lookup_options pointer for lookup table options [in]
144  * @param word_options pointer for word finding options [in]
145  * @param ext_options pointer for extension options [in]
146  * @param hit_options pointer for hit saving options [in]
147  * @param eff_len_options pointer for effective length options [in]
148  * @param query_setup pointer for query setup options [in]
149  * @param query_info Information about query. Note: in PHI BLAST, the query 
150  *                   pattern information pointer is passed on to the sum_returns 
151  *                   structure and set to NULL in the query_info within this 
152  *                   function. [in]
153  * @param seq_src Source of subject sequences [in]
154  * @param diagnostics pointer to diagnostic information, SET to NULL
155  *    on return [in|out]
156  * @param sum_returns Object to be filled in. Must be already allocated. [out]
157  * @return zero returned on success
158  */
159 Int2 Blast_SummaryReturnFill(EBlastProgramType program_number, 
160         const BlastScoringOptions* score_options, 
161         const BlastScoreBlk* sbp,
162         const LookupTableOptions* lookup_options,
163         const BlastInitialWordOptions* word_options,
164         const BlastExtensionOptions* ext_options,
165         const BlastHitSavingOptions* hit_options,
166         const BlastEffectiveLengthsOptions* eff_len_options,
167         const QuerySetUpOptions* query_setup,
168         const BlastQueryInfo* query_info,
169         const BlastSeqSrc* seq_src,
170         BlastDiagnostics** diagnostics,
171         Blast_SummaryReturn* sum_returns);
172 
173 /** Allocate the Blast_SummaryReturn structure */
174 Blast_SummaryReturn* Blast_SummaryReturnNew(void);
175 
176 /** Deallocates memory for the summary returns structure 
177  * @param sum_return object to be freed [in]
178  * @return NULL pointer
179  */
180 Blast_SummaryReturn* Blast_SummaryReturnFree(Blast_SummaryReturn* sum_return);
181 
182 /** Frees the contents of the summary returns structure, but not the structure
183  * itself.
184  * @param sum_returns Structure to clean. [in] [out]
185  */
186 void 
187 Blast_SummaryReturnClean(Blast_SummaryReturn* sum_returns);
188 
189 /** Updates the summary returns structure in case of multiple iterations
190  * over the database. The hit counts from all iterations are aggregated in the
191  * diagnostics structure. The rest of the data is copied from the new summary
192  * returns.
193  * @param new_return Data returned from the new database scan [in]
194  * @param full_return The aggregate return. [in] [out]
195  */
196 int Blast_SummaryReturnUpdate(const Blast_SummaryReturn* new_return,
197                               Blast_SummaryReturn* *full_return);
198 
199 /* @} */
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 
205 #endif /* !__BLAST_FORMAT__ */
206 
207 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.