|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/api/asn2gnbp.h |
source navigation diff markup identifier search freetext search file search |
1 /* asn2gnbp.h
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information (NCBI)
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 do not place any restriction on its use or reproduction.
13 * We would, however, appreciate having the NCBI and the author cited in
14 * any work or product based on this material
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name: asn2gnbp.h
27 *
28 * Author: Karl Sirotkin, Tom Madden, Tatiana Tatusov, Jonathan Kans
29 *
30 * Version Creation Date: 10/21/98
31 *
32 * $Revision: 6.44 $
33 *
34 * File Description: New GenBank flatfile generator, private header
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * ==========================================================================
39 */
40
41 #ifndef _ASN2NGNBP_
42 #define _ASN2NGNBP_
43
44 #include <asn2gnbk.h>
45 #include <objgbseq.h>
46 #include <objinsdseq.h>
47
48 #undef NLM_EXTERN
49 #ifdef NLM_IMPORT
50 #define NLM_EXTERN NLM_IMPORT
51 #else
52 #define NLM_EXTERN extern
53 #endif
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* internal block type identifiers */
60
61 typedef enum {
62 HEAD_BLOCK = 1,
63 LOCUS_BLOCK,
64 DEFLINE_BLOCK,
65 ACCESSION_BLOCK,
66 VERSION_BLOCK,
67 PROJECT_BLOCK,
68 PID_BLOCK,
69 DBSOURCE_BLOCK,
70 DATE_BLOCK,
71 KEYWORDS_BLOCK,
72 SEGMENT_BLOCK,
73 SOURCE_BLOCK,
74 ORGANISM_BLOCK,
75 REF_STATS_BLOCK,
76 REFERENCE_BLOCK,
77 PRIMARY_BLOCK,
78 COMMENT_BLOCK,
79 FEAT_STATS_BLOCK,
80 FEATHEADER_BLOCK,
81 SOURCEFEAT_BLOCK,
82 FEATURE_BLOCK,
83 BASECOUNT_BLOCK,
84 ORIGIN_BLOCK,
85 SEQUENCE_BLOCK,
86 CONTIG_BLOCK,
87 WGS_BLOCK,
88 GENOME_BLOCK,
89 SLASH_BLOCK,
90 TAIL_BLOCK
91 } BlockType;
92
93 NLM_EXTERN CharPtr asn2gnbk_block_label (
94 BlockType blocktype
95 );
96
97 typedef enum {
98 HEAD_MASK = 0x00000001,
99 LOCUS_MASK = 0x00000002,
100 DEFLINE_MASK = 0x00000004,
101 ACCESSION_MASK = 0x00000008,
102 VERSION_MASK = 0x00000010,
103 PROJECT_MASK = 0x00000020,
104 PID_MASK = 0x00000040,
105 DBSOURCE_MASK = 0x00000080,
106 DATE_MASK = 0x00000100,
107 KEYWORDS_MASK = 0x00000200,
108 SEGMENT_MASK = 0x00000400,
109 SOURCE_MASK = 0x00000800,
110 ORGANISM_MASK = 0x00001000,
111 REF_STATS_MASK = 0x00002000,
112 REFERENCE_MASK = 0x00004000,
113 PRIMARY_MASK = 0x00008000,
114 COMMENT_MASK = 0x00010000,
115 FEAT_STATS_MASK = 0x00020000,
116 FEATHEADER_MASK = 0x00040000,
117 SOURCEFEAT_MASK = 0x00080000,
118 FEATURE_MASK = 0x00100000,
119 BASECOUNT_MASK = 0x00200000,
120 ORIGIN_MASK = 0x00400000,
121 SEQUENCE_MASK = 0x00800000,
122 CONTIG_MASK = 0x01000000,
123 WGS_MASK = 0x02000000,
124 GENOME_MASK = 0x04000000,
125 SLASH_MASK = 0x08000000,
126 TAIL_MASK = 0x10000000
127 } BlockMask;
128
129 #define ASN2GB_BASE_BLOCK \
130 Uint2 entityID; \
131 Uint2 itemtype; \
132 Uint4 itemID; \
133 Int4 section; \
134 Int4 paragraph; \
135 BlockType blocktype; \
136 CharPtr string; \
137
138 /* base block structure for most paragraph types */
139
140 typedef struct base_block {
141 ASN2GB_BASE_BLOCK
142 } BaseBlock, PNTR BaseBlockPtr;
143
144 /* version block includes VERSION and NID sections */
145 /* organism block includes SOURCE and ORGANISM sections */
146 /* source (feat) block should be the same as the organism block */
147
148 /* references are grouped by published, unpublished, and cit-subs */
149
150 typedef enum {
151 REF_CAT_PUB = 1,
152 REF_CAT_UNP,
153 REF_CAT_SUB
154 } RefType;
155
156 typedef struct ref_block {
157 ASN2GB_BASE_BLOCK
158 Int4 pmid;
159 Int4 muid;
160 CharPtr uniquestr;
161 Int2 serial;
162 RefType category;
163 Int2 sites;
164 } RefBlock, PNTR RefBlockPtr;
165
166 /* featdeftype allows specific feature classes to be identified */
167
168 typedef struct feat_block {
169 ASN2GB_BASE_BLOCK
170 Uint1 featdeftype;
171 } FeatBlock, PNTR FeatBlockPtr;
172
173 /* sequences are broken up into paragraphs and use the section's internal SeqPort */
174
175 typedef struct seq_block {
176 ASN2GB_BASE_BLOCK
177 Int4 start;
178 Int4 stop;
179 Int4 extend;
180 CharPtr bases;
181 } SeqBlock, PNTR SeqBlockPtr;
182
183 typedef struct IndxData {
184 CharPtr locus;
185 CharPtr accession;
186 CharPtr version;
187 CharPtr gi;
188 CharPtr div;
189 CharPtr base_cnt;
190 ValNodePtr authors;
191 ValNodePtr genes;
192 ValNodePtr journals;
193 ValNodePtr keywords;
194 ValNodePtr secondaries;
195 } IndxBlock, PNTR IndxPtr;
196
197 /* structure for single segment or pop/phy/mut set component */
198
199 typedef struct asn2gb_sect {
200
201 /* data identifiers for individual accession report */
202
203 BioseqPtr target;
204 BioseqPtr bsp;
205 SeqLocPtr slp;
206 Uint2 seg;
207 Int2 numsegs;
208 Int4 from;
209 Int4 to;
210
211 /* local array pointing to all blocks in this section */
212
213 BaseBlockPtr PNTR blockArray;
214 Int4 numBlocks;
215
216 /* references for feature citation matching, serial number assignment */
217
218 RefBlockPtr PNTR referenceArray;
219 Int2 numReferences;
220
221 /* index is needed per section -- EY --- */
222
223 IndxBlock index;
224
225 /* gbseq block is needed per section for GenBank-style XML */
226
227 GBSeq gbseq;
228
229 } Asn2gbSect, PNTR Asn2gbSectPtr;
230
231
232 /* master pointer returned to application */
233
234 typedef struct asn2gb_job {
235
236 /* data identifiers for sequence or sequences to report */
237
238 Uint2 entityID;
239 BioseqPtr bsp;
240 BioseqSetPtr bssp;
241 SeqLocPtr slp;
242
243 /* each accession report from LOCUS to // is a single section */
244
245 Asn2gbSectPtr PNTR sectionArray;
246 Int4 numSections;
247
248 /* master array pointing to all blocks in all sections */
249
250 BaseBlockPtr PNTR paragraphArray;
251 Int4 numParagraphs;
252
253 /* sorted array to get paragraphs for entityID/itemtype/itemID */
254
255 BaseBlockPtr PNTR paragraphByIDs;
256 } Asn2gbJob, PNTR Asn2gbJobPtr;
257
258
259 /* callback types and structure for special extensions */
260
261 typedef void (*Asn2gbWriteFunc) (
262 CharPtr str,
263 Pointer userdata,
264 BlockType blocktype,
265 Uint2 entityID,
266 Uint2 itemtype,
267 Uint4 itemID
268 );
269
270 typedef ValNodePtr (*Asn2gbLockFunc) (SeqIdPtr sip, Pointer remotedata);
271 typedef void (*Asn2gbFreeFunc) (ValNodePtr vnp, Pointer remotedata);
272
273 typedef struct XtraData {
274 Asn2gbWriteFunc ffwrite;
275 CharPtr ffhead;
276 CharPtr fftail;
277 IndxPtr index;
278 GBSeqPtr gbseq;
279 AsnIoPtr aip;
280 AsnTypePtr atp;
281 Pointer userdata;
282 Asn2gbLockFunc remotelock;
283 Asn2gbFreeFunc remotefree;
284 Pointer remotedata;
285 Int4 prevGi;
286 Int4 nextGi;
287 BlockMask bkmask;
288 Boolean reindex;
289 } XtraBlock;
290
291
292 /*
293 asn2gnbk_setup creates a structure laying out the flatfile structure.
294
295 Of the first three parameters (bsp, bssp, slp), only one should not be NULL.
296 If bsp is passed in, that is the target bioseq. If bssp is passed in, it is
297 expected to be a population/phylogenetic/mutation study, and all records are
298 shown, but with no segment numbers.
299
300 asn2gnbk_format creates a string for a given paragraph.
301
302 asn2gnbk_cleanup frees the structure and all components.
303
304 SeqEntryToGnbk calls asn2gnbk_setup, _format, and _cleanup internally.
305 */
306
307 NLM_EXTERN Asn2gbJobPtr asn2gnbk_setup (
308 BioseqPtr bsp,
309 BioseqSetPtr bssp,
310 SeqLocPtr slp,
311 FmtType format,
312 ModType mode,
313 StlType style,
314 FlgType flags,
315 LckType locks,
316 CstType custom,
317 XtraPtr extra
318 );
319
320 NLM_EXTERN CharPtr asn2gnbk_format (
321 Asn2gbJobPtr ajp,
322 Int4 paragrap
323 );
324
325 NLM_EXTERN Asn2gbJobPtr asn2gnbk_cleanup (
326 Asn2gbJobPtr ajp
327 );
328
329 /* public function to get URLs for collaboration-approved db_xrefs */
330
331 NLM_EXTERN CharPtr asn2gnbk_dbxref (
332 DbtagPtr dbt
333 );
334
335 /* public function to get string of genbank-style feature qualifiers */
336
337 NLM_EXTERN CharPtr FormatFeatureQuals (
338 SeqFeatPtr sfp
339 );
340
341
342 #ifdef __cplusplus
343 }
344 #endif
345
346 #undef NLM_EXTERN
347 #ifdef NLM_EXPORT
348 #define NLM_EXTERN NLM_EXPORT
349 #else
350 #define NLM_EXTERN
351 #endif
352
353 #endif /* ndef _ASN2NGNBP_ */
354
355 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |