1 /*  objfdef.h
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 * File Name:  objfdef.h
27 *
28 * Author:  James Ostell
29 *
30 * Version Creation Date: 9/94
31 *
32 * $Revision: 6.14 $
33 *
34 * File Description:  Object manager for feature definitions
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date	   Name        Description of modification
39 * -------  ----------  -----------------------------------------------------
40 *
41 * ==========================================================================
42 */
43 
44 #ifndef _NCBI_FeatDef_
45 #define _NCBI_FeatDef_
46 
47 #ifndef _NCBI_SeqFeat_
48 #include <objfeat.h>
49 #endif
50 
51 #undef NLM_EXTERN
52 #ifdef NLM_IMPORT
53 #define NLM_EXTERN NLM_IMPORT
54 #else
55 #define NLM_EXTERN extern
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /*****************************************************************************
63 *
64 *   loader
65 *
66 *****************************************************************************/
67 NLM_EXTERN Boolean LIBCALL FeatDefAsnLoad PROTO((void));
68 
69 /*****************************************************************************
70 *
71 *   FeatDef
72 *
73 *****************************************************************************/
74 typedef struct featdef {
75     CharPtr typelabel,
76         menulabel;
77 	Uint1 featdef_key,
78 		seqfeat_key,
79 		entrygroup,
80 		displaygroup,
81 		molgroup;
82     struct featdef PNTR next;
83 } FeatDef, PNTR FeatDefPtr;
84 
85 NLM_EXTERN FeatDefPtr LIBCALL FeatDefNew PROTO((void));
86 NLM_EXTERN Boolean   LIBCALL FeatDefAsnWrite PROTO((FeatDefPtr fdp, AsnIoPtr aip, AsnTypePtr atp));
87 NLM_EXTERN FeatDefPtr LIBCALL FeatDefAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
88 NLM_EXTERN FeatDefPtr LIBCALL FeatDefFree PROTO((FeatDefPtr fdp));
89 
90 NLM_EXTERN Boolean   LIBCALL FeatDefSetAsnWrite PROTO((FeatDefPtr fdp, AsnIoPtr aip, AsnTypePtr atp));
91 NLM_EXTERN FeatDefPtr LIBCALL FeatDefSetAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
92 NLM_EXTERN FeatDefPtr LIBCALL FeatDefSetFree PROTO((FeatDefPtr fdp));
93 
94 
95 /*****************************************************************************
96 *
97 *   FeatDispGroup
98 *
99 *****************************************************************************/
100 typedef struct featdispgroup {
101 	Uint1 groupkey;
102     CharPtr groupname;
103     struct featdispgroup PNTR next;
104 } FeatDispGroup, PNTR FeatDispGroupPtr;
105 
106 NLM_EXTERN FeatDispGroupPtr LIBCALL FeatDispGroupNew PROTO((void));
107 NLM_EXTERN Boolean   LIBCALL FeatDispGroupAsnWrite PROTO((FeatDispGroupPtr fdp, AsnIoPtr aip, AsnTypePtr atp));
108 NLM_EXTERN FeatDispGroupPtr LIBCALL FeatDispGroupAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
109 NLM_EXTERN FeatDispGroupPtr LIBCALL FeatDispGroupFree PROTO((FeatDispGroupPtr fdp));
110 
111 NLM_EXTERN Boolean   LIBCALL FeatDispGroupSetAsnWrite PROTO((FeatDispGroupPtr fdp, AsnIoPtr aip, AsnTypePtr atp));
112 NLM_EXTERN FeatDispGroupPtr LIBCALL FeatDispGroupSetAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
113 NLM_EXTERN FeatDispGroupPtr LIBCALL FeatDispGroupSetFree PROTO((FeatDispGroupPtr fdp));
114 
115 
116 /*****************************************************************************
117 *
118 *   Data Loader Function
119 *   	Loads default FeatDefSet and FeatDispGroupSet from "featdef.val"
120 *       located in /ncbi/data directory
121 *       returns head of linked list
122 *
123 *****************************************************************************/
124 
125 NLM_EXTERN FeatDefPtr LIBCALL FeatDefSetLoad PROTO((void));
126 
127 /*****************************************************************************
128 *
129 *   FindFeatDefType(sfp)
130 *   	Finds the featdef_type for a SeqFeat
131 *       returns FEATDEF_BAD if can't find it
132 *
133 *****************************************************************************/
134 NLM_EXTERN Uint1 LIBCALL FindFeatDefType PROTO((SeqFeatPtr sfp));
135 
136 /*****************************************************************************
137 *
138 *   FeatDefLabel(sfp, buf, buflen, type)
139 *   	fills in buf with a content based label
140 *   	if longer than buflen, makes the last visible char >
141 *   	guarantees a '\0' at the end of the string
142 *
143 *   NOTE: buf MUST be (buflen+1) long
144 *
145 *   	This function makes nicer labels since it can combine elements
146 *   	returns length of string or 0 on failure
147 *
148 *   	type is OM_LABEL_TYPE_ defined in objmgr.h
149 *
150 *****************************************************************************/
151 NLM_EXTERN Int2 LIBCALL FeatDefLabel PROTO((SeqFeatPtr sfp, CharPtr buf, Int2 buflen, Uint1 labeltype));
152 
153 /*****************************************************************************
154 *
155 *   FeatDefTypeLabel(sfp)
156 *   	returns a short string with the feature type
157 *       returns NULL if can't find one
158 *
159 *****************************************************************************/
160 NLM_EXTERN const char * LIBCALL FeatDefTypeLabel PROTO((SeqFeatPtr sfp));
161 
162 /*****************************************************************************
163 *
164 *   DispGroupNum()
165 *   	returns number of display groups
166 *   	returns 0 on failure
167 *       loads featdef.val if not already loaded
168 *
169 *****************************************************************************/
170 NLM_EXTERN Int2 LIBCALL DispGroupNum PROTO((void));
171 
172 /*****************************************************************************
173 *
174 *   DispGroupFindNext(curr, groupptr, groupname)
175 *     returns display groups in order
176 *     start with curr=NULL, then return current in curr until function
177 *       returns NULL
178 *     loads featdef.val if necessary
179 *     groupptr is filled in with the key for the group, used
180 *       in FeatDefFindNext() below.
181 *     groupname points to the string naming the group
182 *
183 *****************************************************************************/
184 NLM_EXTERN FeatDispGroupPtr LIBCALL DispGroupFindNext PROTO((FeatDispGroupPtr curr, Uint1Ptr groupptr, CharPtr PNTR groupname));
185 
186 /*****************************************************************************
187 *
188 *   FeatDefNum()
189 *   	returns total number of FeatDef
190 *       loads featdef.val if necessary
191 *
192 *****************************************************************************/
193 NLM_EXTERN Int2 LIBCALL FeatDefNum PROTO((void));
194 
195 
196 /*****************************************************************************
197 *
198 *   FeatDefFindNext(curr, keyptr, menulabel, group, for_display)
199 *   	returns next FeatDef within display group
200 *       if group == FEATDEF_ANY returns all
201 *       start with curr = NULL and return current in curr until function
202 *         returns NULL
203 *       keyptr is filled in with featdef-key
204 *       menulabel is filled in with menulabel
205 *       if for_display == TRUE then group must match display group
206 *         else group must match entrygroup
207 *       loads featdef.val if necessary
208 *
209 *****************************************************************************/
210 NLM_EXTERN FeatDefPtr LIBCALL FeatDefFindNext PROTO((FeatDefPtr curr, Uint1Ptr keyptr, CharPtr PNTR menulabel, Uint1 group, Boolean for_display));
211 
212 /*****************************************************************************
213 *
214 *   #defines for FeatDef types
215 *
216 *****************************************************************************/
217 
218 #define FEATDEF_BAD  0
219 #define FEATDEF_ANY  255
220 
221 #define FEATDEF_GENE  1
222 #define FEATDEF_ORG   2
223 #define FEATDEF_CDS   3
224 #define FEATDEF_PROT  4
225 #define FEATDEF_preRNA 5
226 #define FEATDEF_mRNA  6
227 #define FEATDEF_tRNA  7
228 #define FEATDEF_rRNA  8
229 #define FEATDEF_snRNA 9
230 #define FEATDEF_scRNA 10
231 #define FEATDEF_otherRNA 11
232 #define FEATDEF_PUB   12
233 #define FEATDEF_SEQ   13
234 #define FEATDEF_IMP   14
235 #define FEATDEF_allele 15
236 #define FEATDEF_attenuator 16
237 #define FEATDEF_C_region 17
238 #define FEATDEF_CAAT_signal 18
239 #define FEATDEF_Imp_CDS 19
240 #define FEATDEF_conflict 20
241 #define FEATDEF_D_loop 21
242 #define FEATDEF_D_segment 22
243 #define FEATDEF_enhancer 23
244 #define FEATDEF_exon 24
245 #define FEATDEF_GC_signal 25
246 #define FEATDEF_iDNA 26
247 #define FEATDEF_intron 27
248 #define FEATDEF_J_segment 28
249 #define FEATDEF_LTR 29
250 #define FEATDEF_mat_peptide 30
251 #define FEATDEF_misc_binding 31
252 #define FEATDEF_misc_difference 32
253 #define FEATDEF_misc_feature 33
254 #define FEATDEF_misc_recomb 34
255 #define FEATDEF_misc_RNA 35
256 #define FEATDEF_misc_signal 36
257 #define FEATDEF_misc_structure 37
258 #define FEATDEF_modified_base 38
259 #define FEATDEF_mutation 39
260 #define FEATDEF_N_region 40
261 #define FEATDEF_old_sequence 41
262 #define FEATDEF_polyA_signal 42
263 #define FEATDEF_polyA_site 43
264 #define FEATDEF_precursor_RNA 44
265 #define FEATDEF_prim_transcript 45
266 #define FEATDEF_primer_bind 46
267 #define FEATDEF_promoter 47
268 #define FEATDEF_protein_bind 48
269 #define FEATDEF_RBS 49
270 #define FEATDEF_repeat_region 50
271 #define FEATDEF_repeat_unit 51
272 #define FEATDEF_rep_origin 52
273 #define FEATDEF_S_region 53
274 #define FEATDEF_satellite 54
275 #define FEATDEF_sig_peptide 55
276 #define FEATDEF_source 56
277 #define FEATDEF_stem_loop 57
278 #define FEATDEF_STS 58
279 #define FEATDEF_TATA_signal 59
280 #define FEATDEF_terminator 60
281 #define FEATDEF_transit_peptide 61
282 #define FEATDEF_unsure 62
283 #define FEATDEF_V_region 63
284 #define FEATDEF_V_segment 64
285 #define FEATDEF_variation 65
286 #define FEATDEF_virion 66
287 #define FEATDEF_3clip 67
288 #define FEATDEF_3UTR 68
289 #define FEATDEF_5clip 69
290 #define FEATDEF_5UTR 70
291 #define FEATDEF_10_signal 71
292 #define FEATDEF_35_signal 72
293 #define FEATDEF_site_ref 73
294 #define FEATDEF_REGION 74
295 #define FEATDEF_COMMENT 75
296 #define FEATDEF_BOND 76
297 #define FEATDEF_SITE 77
298 #define FEATDEF_RSITE 78
299 #define FEATDEF_USER 79
300 #define FEATDEF_TXINIT 80
301 #define FEATDEF_NUM 81
302 #define FEATDEF_PSEC_STR 82
303 #define FEATDEF_NON_STD_RESIDUE 83
304 #define FEATDEF_HET 84
305 #define FEATDEF_BIOSRC 85
306 #define FEATDEF_preprotein 86
307 #define FEATDEF_mat_peptide_aa 87
308 #define FEATDEF_sig_peptide_aa 88
309 #define FEATDEF_transit_peptide_aa 89
310 #define FEATDEF_snoRNA 90
311 #define FEATDEF_gap 91
312 #define FEATDEF_operon 92
313 #define FEATDEF_oriT 93
314 #define FEATDEF_ncRNA 94
315 #define FEATDEF_tmRNA 95
316 #define FEATDEF_CLONEREF 96
317 #define FEATDEF_VARIATIONREF 97
318 #define FEATDEF_mobile_element 98
319 #define FEATDEF_centromere 99
320 #define FEATDEF_telomere 100
321 #define FEATDEF_assembly_gap 101
322 #define FEATDEF_regulatory 102
323 #define FEATDEF_propeptide 103
324 #define FEATDEF_propeptide_aa 104
325 
326 #define FEATDEF_MAX 105 /* size of array needed for featdef filter parameters */
327 
328 
329 #ifdef __cplusplus
330 }
331 #endif
332 
333 #undef NLM_EXTERN
334 #ifdef NLM_EXPORT
335 #define NLM_EXTERN NLM_EXPORT
336 #else
337 #define NLM_EXTERN
338 #endif
339 
340 #endif
341