NCBI C Toolkit Cross Reference

C/algo/blast/api/blast_tabular.h


  1 /* $Id: blast_tabular.h,v 1.14 2006/06/09 17:43:11 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_tabular.h
 28  * Functions needed for formatting of BLAST results
 29  */
 30 
 31 #ifndef __BLAST_TABULAR__
 32 #define __BLAST_TABULAR__
 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 <ncbi.h>
 43 #include <asn.h>
 44 #include <algo/blast/core/blast_hits.h>
 45 #include <algo/blast/core/lookup_wrap.h>
 46 #include <algo/blast/core/blast_seqsrc.h>
 47 #include <algo/blast/core/blast_hspstream.h>
 48 #include <algo/blast/core/blast_gapalign.h>
 49 #include <objloc.h>
 50 
 51 /** @addtogroup CToolkitAlgoBlast
 52  *
 53  * @{
 54  */
 55 
 56 /** Tabular formatting options. */
 57 typedef enum {
 58    eBlastTabularDefault=1,
 59    eBlastTabularAddSequences,
 60    eBlastIncrementalASN
 61 } EBlastTabularFormatOptions;
 62 
 63 /** Data structure containing all information necessary for production of the
 64  * tabular output.
 65  */
 66 typedef struct BlastTabularFormatData {
 67    EBlastProgramType program; /**< Type of BLAST program */
 68    BlastHSPStream* hsp_stream; /**< Source of the BLAST results */
 69    BlastSeqSrc* seq_src; /**< Source of the subject sequences */
 70    BLAST_SequenceBlk* query; /**< Query sequence */
 71    BlastQueryInfo* query_info; /**< Query information, including context
 72                                   offsets and effective lengths. */
 73    BlastScoringParameters* score_params; /**< Scoring parameters. */
 74    BlastExtensionParameters* ext_params; /**< Gapped extension parameters. */
 75    BlastHitSavingParameters* hit_params; /**< Hit saving parameters. */
 76    BlastEffectiveLengthsParameters* eff_len_params; /**< Effective lengths 
 77                                                          parameters. */
 78    Uint1* gen_code_string; /**< Database genetic code string. */
 79    BlastGapAlignStruct* gap_align; /**< Auxiliary structure used for gapped 
 80                                         alignment. */
 81    SeqLoc* query_slp; /**< Source of query sequences identifiers */
 82    FILE* outfp; /**< Output stream (tabular formatted output) */
 83    AsnIoPtr asn_outfp; /**< Output stream (incremental ASN output) */
 84    Boolean perform_traceback; /**< Must gapped extension with traceback be
 85                                  performed before formatting? */
 86    Boolean show_gi; /**< Show gi's instead of full ids in output, if 
 87                        possible. */
 88    Boolean show_accession; /**< Show accessions instead of full ids in output,
 89                               if possible. This option has lower priority than
 90                               show_gi. */
 91    Boolean believe_query; /**< TRUE if query identifiers are parsed; if
 92                                FALSE, the first token in the query defline is
 93                                treated as an identifier */
 94    Boolean is_ooframe; /**< TRUE if incremental ASN output is selected and
 95                             the results contain out-of-frame alignments */
 96    EBlastTabularFormatOptions format_options; /**< Tabular formatting options. */
 97 } BlastTabularFormatData;
 98 
 99 /** Allocate the tabular formatting data structure and save the output 
100  * stream and formatting option. 
101  * @param outfp Output stream to write to (ordinary tabular output) [in]
102  * @param asn_outfp Output stream to write to (incremental ASN output) [in]
103  * @param query_seqloc List of query sequence locations [in]
104  * @param format_option What type of tabular output is requested? [in]
105  * @param believe_query Should query identifiers be parsed? [in]
106  * @return Allocated structure
107  */
108 BlastTabularFormatData*
109 BlastTabularFormatDataNew(FILE* outfp, AsnIoPtr asn_outfp, SeqLoc* query_seqloc,
110                           EBlastTabularFormatOptions format_option,
111                           Boolean believe_query);
112 
113 
114 /** Function initializing the BlastTabularFormatData data structure fields. 
115  * @param tf_data Structure to fill. Must be already allocated. [in] [out]
116  * @param program Type of BLAST program [in]
117  * @param hsp_stream Placeholder for saving HSP lists. [in]
118  * @param seq_src Source of subject sequences [in]
119  * @param query Structure containing query sequence [in]
120  * @param query_info Information about query contexts [in]
121  * @param scoring_options Scoring options [in]
122  * @param sbp Scoring block with matrix, Karlin-Altschul parameters etc. [in]
123  * @param eff_len_options Effective lengths options [in]
124  * @param ext_options Gapped extension options [in]
125  * @param hit_options Hit saving options [in]
126  * @param db_options Structure containing database genetic code option. [in]
127  */
128 Int2
129 Blast_TabularFormatDataSetUp(BlastTabularFormatData* tf_data,
130                              EBlastProgramType program, 
131                              BlastHSPStream* hsp_stream, 
132                              const BlastSeqSrc* seq_src, 
133                              BLAST_SequenceBlk* query, 
134                              BlastQueryInfo* query_info,
135                              const BlastScoringOptions* scoring_options, 
136                              BlastScoreBlk* sbp,
137                              const BlastEffectiveLengthsOptions* eff_len_options,
138                              const BlastExtensionOptions* ext_options,
139                              const BlastHitSavingOptions* hit_options,
140                              const BlastDatabaseOptions* db_options);
141 
142 /** Free the substructures of the tabular formatting data structure that are
143  * allocated internally. 
144  * @param tf_data Structure to clean. [in]
145  */
146 void 
147 BlastTabularFormatDataClean(BlastTabularFormatData* tf_data);
148 
149 /** Free the tabular formatting data structure and all its internally 
150  * allocated substructures. 
151  * @param tf_data Structure to free. [in]
152  * @return NULL.
153  */
154 BlastTabularFormatData* 
155 BlastTabularFormatDataFree(BlastTabularFormatData* tf_data);
156 
157 /** Driver for the thread producing tabular output. 
158  * @param data Pointer to a BlastTabularFormatData structure. [in]
159  */
160 void* Blast_TabularFormatThread(void* data);
161 
162 /* @} */
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* !__BLAST_TABULAR__ */
169 
170 

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.