1 /* $Id: xmlblast.h,v 6.14 2004/04/29 19:55:35 dondosha Exp $ */
2 /**************************************************************************
3 *                                                                         *
4 *                             COPYRIGHT NOTICE                            *
5 *                                                                         *
6 * This software/database is categorized as "United States Government      *
7 * Work" under the terms of the United States Copyright Act.  It was       *
8 * produced as part of the author's official duties as a Government        *
9 * employee and thus can not be copyrighted.  This software/database is    *
10 * freely available to the public for use without a copyright notice.      *
11 * Restrictions can not be placed on its present or future use.            *
12 *                                                                         *
13 * Although all reasonable efforts have been taken to ensure the accuracy  *
14 * and reliability of the software and data, the National Library of       *
15 * Medicine (NLM) and the U.S. Government do not and can not warrant the   *
16 * performance or results that may be obtained by using this software,     *
17 * data, or derivative works thereof.  The NLM and the U.S. Government     *
18 * disclaim any and all warranties, expressed or implied, as to the        *
19 * performance, merchantability or fitness for any particular purpose or   *
20 * use.                                                                    *
21 *                                                                         *
22 * In any work or product derived from this material, proper attribution   *
23 * of the author(s) as the source of the software or data would be         *
24 * appreciated.                                                            *
25 *                                                                         *
26 **************************************************************************
27 * File Name:  xmlblast.c
28 *
29 * Author:  Sergei B. Shavirin
30 *
31 * Version Creation Date: 05/17/2000
32 *
33 * $Revision: 6.14 $
34 *
35 * File Description:  Functions to print simplified BLAST output (XML)
36 *
37 *
38 * $Log: xmlblast.h,v $
39 * Revision 6.14  2004/04/29 19:55:35  dondosha
40 * Mask filtered locations in query sequence lines
41 *
42 * Revision 6.13  2004/03/31 17:58:23  dondosha
43 * Added PSIXmlReset function to allow keeping the AsnIoPtr between outputs for multiple queries in blastpgp
44 *
45 * Revision 6.12  2003/01/06 23:01:40  dondosha
46 * Added function to create a multi-query XML output for web megablast
47 *
48 * Revision 6.11  2002/11/14 15:37:18  dondosha
49 * Added functions to extract all hit information from seqalign that can be extracted without loading sequences
50 *
51 * Revision 6.10  2002/07/17 22:28:13  dondosha
52 * Added support for megablast XML output
53 *
54 * Revision 6.9  2000/11/28 20:51:58  shavirin
55 * Adopted for usage with mani-iterational XML definition.
56 *
57 * Revision 6.8  2000/11/22 21:55:49  shavirin
58 * Added function BXMLPrintOutputEx() with new parameter iteration_number
59 * for usage with PSI-Blast.
60 *
61 * Revision 6.7  2000/11/07 21:50:52  shavirin
62 * Added external definition of the function  BXMLSeqAlignToHits().
63 *
64 * Revision 6.6  2000/10/24 17:49:42  egorov
65 * Remove blstxml.h because it makes impossible to use this ASN.1 spec together
66 * with another ASN.1 spec
67 *
68 * Revision 6.5  2000/10/23 19:55:15  dondosha
69 * Changed prototype of function BXMLPrintOutput
70 *
71 * Revision 6.4  2000/10/12 21:35:31  shavirin
72 * Added support for OOF alignment.
73 *
74 * Revision 6.3  2000/10/12 15:46:19  shavirin
75 * Added definition of the function BXMLGetHspFromSeqAlign().
76 *
77 * Revision 6.2  2000/08/10 14:42:33  shavirin
78 * Added missing comment.
79 *
80 * Revision 6.1  2000/08/10 13:58:36  shavirin
81 * Initial revision.
82 * *
83 *
84 */
85 
86 #ifndef XMLBLAST_H
87 #define XMLBLAST_H
88 
89 #include <ncbi.h>
90 #include <readdb.h>
91 #include <txalign.h>
92 #include <bxmlobj.h>
93 #include <blastdef.h>
94 #include <blastpri.h>
95 
96 #ifdef __cplusplus
97 extern "C" { /* } */
98 #endif
99 
100 typedef struct PSIXml {
101     BlastOutputPtr boutp;
102     AsnIoPtr   aip;
103     AsnTypePtr atp;
104     AsnTypePtr BlastOutput;
105     AsnTypePtr BlastOutput_iterations;
106    AsnTypePtr BlastOutput_mbstat;
107 } PSIXml, MBXml, PNTR PSIXmlPtr, PNTR MBXmlPtr;
108 
109 #define BXML_INCLUDE_QUERY 0x1
110 
111 #define MACRO_atp_find(atp,name)\
112         if((atp = AsnTypeFind(amp, #name))==NULL){\
113                 ErrPostEx(SEV_ERROR,0,0,\
114                         "Could not find type <%s>", #name);\
115                 return NULL; \
116         }
117 
118 Boolean BXMLPrintOutput(AsnIoPtr aip, SeqAlignPtr seqalign,
119                         BLAST_OptionsBlkPtr options, CharPtr program,
120                         CharPtr database, BioseqPtr query,
121                         ValNodePtr other_returns, Int4 option,
122                         CharPtr message, ValNodePtr mask_loc);
123 
124 Boolean BXMLPrintMultiQueryOutput(AsnIoPtr aip, SeqAlignPtr seqalign,
125            BLAST_OptionsBlkPtr options, CharPtr program, CharPtr database,
126            BioseqSetPtr query_set, ValNodePtr other_returns, Int4 flags,
127            CharPtr message, ValNodePtr mask_loc);
128 
129 StatisticsPtr BXMLBuildStatistics(ValNodePtr other_returns, Boolean ungapped);
130 BlastOutputPtr BXMLCreateBlastOutputHead(CharPtr program, CharPtr database,
131                                          BLAST_OptionsBlkPtr options,
132                                          BioseqPtr query, Int4 flags);
133 
134 IterationPtr BXMLBuildOneIteration(SeqAlignPtr seqalign,
135                                    ValNodePtr other_returns,
136                                    Boolean is_ooframe, Boolean ungapped,
137                                    Int4 iter_num, CharPtr message,
138                                    ValNodePtr mask_loc);
139 
140 IterationPtr BXMLBuildOneQueryIteration(SeqAlignPtr seqalign,
141                                    ValNodePtr other_returns,
142                                    Boolean is_ooframe, Boolean ungapped,
143                                    Int4 iter_num, CharPtr message,
144                                    BioseqPtr query, ValNodePtr mask_loc);
145 
146 HspPtr BXMLGetHspFromSeqAlign(SeqAlignPtr sap, Boolean is_aa, Int4 chain,
147                               Boolean is_ooframe, ValNodePtr mask_loc);
148 
149 HitPtr BXMLSeqAlignToHits(SeqAlignPtr seqalign, Boolean ungapped,
150                           Boolean is_ooframe, ValNodePtr mask_loc);
151 
152 PSIXmlPtr PSIXmlInit(AsnIoPtr aip, CharPtr program, CharPtr database,
153                      BLAST_OptionsBlkPtr options, BioseqPtr query, Int4 flags);
154 
155 /* Close printing of this XML output, but only reset the ASN.1 output stream,
156    so it is ready for the next output. */
157 void PSIXmlReset(PSIXmlPtr psixp);
158 /* Finish printing XML output and close the output stream */
159 void PSIXmlClose(PSIXmlPtr psixp);
160 void MBXmlClose(PSIXmlPtr mbxp, ValNodePtr other_returns, Boolean ungapped);
161 
162 HitPtr SeqAlignToHits PROTO((SeqAlignPtr seqalign, Boolean ungapped));
163 
164 #ifdef __cplusplus
165 /* { */ }
166 #endif
167 
168 #endif /* XMLBLAST_H */
169