~ubuntu-branches/ubuntu/warty/ncbi-tools6/warty

« back to all changes in this revision

Viewing changes to object/objloc.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2002-04-04 22:13:09 UTC
  • Revision ID: james.westby@ubuntu.com-20020404221309-vfze028rfnlrldct
Tags: upstream-6.1.20011220a
ImportĀ upstreamĀ versionĀ 6.1.20011220a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  objloc.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 loclic 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:  objloc.h
 
27
*
 
28
* Author:  James Ostell
 
29
*   
 
30
* Version Creation Date: 4/1/91
 
31
*
 
32
* $Revision: 6.3 $
 
33
*
 
34
* File Description:  Object manager interface for module NCBI-Seqloc
 
35
*
 
36
* Modifications:  
 
37
* --------------------------------------------------------------------------
 
38
* Date     Name        Description of modification
 
39
* -------  ----------  -----------------------------------------------------
 
40
*
 
41
*
 
42
* $Log: objloc.h,v $
 
43
* Revision 6.3  2001/08/06 20:07:26  ostell
 
44
* added SEQID_TPG, TPE, TPD types
 
45
*
 
46
* Revision 6.2  2001/01/31 15:24:20  kans
 
47
* PatentSeqId.seqid is now an Int4 (JO)
 
48
*
 
49
* Revision 6.1  2000/04/05 18:11:41  dondosha
 
50
* Moved SeqIdSetDup from mblast.h
 
51
*
 
52
* Revision 6.0  1997/08/25 18:50:07  madden
 
53
* Revision changed to 6.0
 
54
*
 
55
* Revision 4.1  1997/06/19 18:41:32  vakatov
 
56
* [WIN32,MSVC++]  Adopted for the "NCBIOBJ.LIB" DLL'ization
 
57
*
 
58
* Revision 4.0  1995/07/26 13:48:06  ostell
 
59
* force revision to 4.0
 
60
*
 
61
 * Revision 3.3  1995/05/09  18:04:44  ostell
 
62
 * added NUM_SEGID to define how many SeqId classes there are
 
63
 *
 
64
*
 
65
*
 
66
* ==========================================================================
 
67
*/
 
68
 
 
69
#ifndef _NCBI_Seqloc_
 
70
#define _NCBI_Seqloc_
 
71
 
 
72
#ifndef _ASNTOOL_
 
73
#include <asn.h>
 
74
#endif
 
75
#ifndef _NCBI_General_
 
76
#include <objgen.h>
 
77
#endif
 
78
#ifndef _NCBI_Biblio_
 
79
#include <objbibli.h>
 
80
#endif
 
81
 
 
82
typedef ValNode SeqId, FAR *SeqIdPtr;
 
83
typedef ValNode SeqLoc, FAR *SeqLocPtr;
 
84
 
 
85
#ifndef _NCBI_Seqfeat_
 
86
#include <objfeat.h>      /* after Seqloc to avoid cycles */
 
87
#endif
 
88
 
 
89
#undef NLM_EXTERN
 
90
#ifdef NLM_IMPORT
 
91
#define NLM_EXTERN NLM_IMPORT
 
92
#else
 
93
#define NLM_EXTERN extern
 
94
#endif
 
95
 
 
96
#ifdef __cplusplus
 
97
extern "C" {
 
98
#endif
 
99
 
 
100
/*****************************************************************************
 
101
*
 
102
*   Seqloc loader
 
103
*
 
104
*****************************************************************************/
 
105
NLM_EXTERN Boolean      LIBCALL SeqLocAsnLoad PROTO((void));
 
106
 
 
107
/*****************************************************************************
 
108
*
 
109
*   internal structures for NCBI-Seqloc objects
 
110
*
 
111
*****************************************************************************/
 
112
 
 
113
/*****************************************************************************
 
114
*
 
115
*   SeqId is a choice using an ValNode, most types in data.ptrvalue
 
116
*      except integers, in data.intvalue
 
117
*   choice:
 
118
*   0 = not set
 
119
    1 = local Object-id ,      -- local use
 
120
    2 = gibbsq INTEGER ,         -- Geninfo backbone seqid
 
121
    3 = gibbmt INTEGER ,         -- Geninfo backbone moltype
 
122
    4 = giim Giimport-id ,       -- Geninfo import id
 
123
    5 = genbank Textseq-id ,
 
124
    6 = embl Textseq-id ,
 
125
    7 = pir Textseq-id ,
 
126
    8 = swissprot Textseq-id ,
 
127
    9 = patent Patent-seq-id ,
 
128
    10 = other Textseq-id ,       -- catch all
 
129
    11 = general Dbtag          -- for other databases
 
130
    12 = gi  INTEGER          -- GenInfo Integrated Database
 
131
    13 = ddbj Textseq-id
 
132
        14 = prf Textseq-id ,         -- PRF SEQDB
 
133
        15 = pdb PDB-seq-id          -- PDB sequence
 
134
    16 = tpg Textseq-id ,         -- Third Party Annot/Seq Genbank
 
135
    17 = tpe Textseq-id ,         -- Third Party Annot/Seq EMBL
 
136
    18 = tpd Textseq-id }         -- Third Party Annot/Seq DDBJ
 
137
 
 
138
 
 
139
        WARNING: Some routines in sequtil.c (e.g. SeqIdPrint, SeqIdParse)
 
140
        and tofasta.c  use
 
141
        arrays of size NUM_SEQID to set certain behaviors. They should be changed
 
142
        when SeqIds are added or changed.
 
143
*
 
144
*****************************************************************************/
 
145
 
 
146
#define NUM_SEQID 19     /* total number of SeqId types */
 
147
 
 
148
#define SEQID_NOT_SET ( (Uint1)0)
 
149
#define SEQID_LOCAL ( (Uint1)1)
 
150
#define SEQID_GIBBSQ ( (Uint1)2)
 
151
#define SEQID_GIBBMT ( (Uint1)3)
 
152
#define SEQID_GIIM ( (Uint1)4)
 
153
 
 
154
#define SEQID_GENBANK ( (Uint1)5)
 
155
#define SEQID_EMBL ( (Uint1)6)
 
156
#define SEQID_PIR ( (Uint1)7)
 
157
#define SEQID_SWISSPROT ( (Uint1)8)
 
158
 
 
159
 
 
160
#define SEQID_PATENT ( (Uint1)9)
 
161
#define SEQID_OTHER ( (Uint1)10)
 
162
#define SEQID_GENERAL ( (Uint1)11)
 
163
#define SEQID_GI ( (Uint1)12)
 
164
#define SEQID_DDBJ ((Uint1)13)
 
165
#define SEQID_PRF ((Uint1)14)
 
166
#define SEQID_PDB ((Uint1)15)
 
167
 
 
168
#define SEQID_TPG ((Uint1)16)
 
169
#define SEQID_TPE ((Uint1)17)
 
170
#define SEQID_TPD ((Uint1)18)
 
171
 
 
172
NLM_EXTERN Boolean       LIBCALL SeqIdAsnWrite PROTO((SeqIdPtr anp, AsnIoPtr aip, AsnTypePtr atp));
 
173
NLM_EXTERN SeqIdPtr LIBCALL SeqIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
174
NLM_EXTERN SeqIdPtr LIBCALL SeqIdFree PROTO((SeqIdPtr anp));
 
175
NLM_EXTERN SeqIdPtr LIBCALL SeqIdDup PROTO((SeqIdPtr oldid));
 
176
NLM_EXTERN SeqIdPtr LIBCALL SeqIdSetDup PROTO((SeqIdPtr seqid));
 
177
NLM_EXTERN Int2 LIBCALL SeqIdLabel PROTO(( SeqIdPtr sip, CharPtr buffer, Int2 buflen, Uint1 content));
 
178
 
 
179
/*****************************************************************************
 
180
*
 
181
*   These routines process sets or sequences of SeqId's
 
182
*
 
183
*****************************************************************************/
 
184
NLM_EXTERN Boolean  LIBCALL SeqIdSetAsnWrite PROTO((SeqIdPtr anp, AsnIoPtr aip, AsnTypePtr settype, AsnTypePtr elementtype));
 
185
NLM_EXTERN SeqIdPtr LIBCALL SeqIdSetAsnRead PROTO((AsnIoPtr aip, AsnTypePtr settype, AsnTypePtr elementtype));
 
186
NLM_EXTERN SeqIdPtr LIBCALL SeqIdSetFree PROTO((SeqIdPtr anp));
 
187
 
 
188
 
 
189
/*****************************************************************************
 
190
*
 
191
*   PatentSeqId
 
192
*
 
193
*****************************************************************************/
 
194
typedef struct patentseqid {
 
195
    Int4 seqid;
 
196
    IdPatPtr cit;
 
197
} PatentSeqId, PNTR PatentSeqIdPtr;
 
198
 
 
199
NLM_EXTERN PatentSeqIdPtr LIBCALL PatentSeqIdNew PROTO((void));
 
200
NLM_EXTERN Boolean        LIBCALL PatentSeqIdAsnWrite PROTO((PatentSeqIdPtr psip, AsnIoPtr aip, AsnTypePtr atp));
 
201
NLM_EXTERN PatentSeqIdPtr LIBCALL PatentSeqIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
202
NLM_EXTERN PatentSeqIdPtr LIBCALL PatentSeqIdFree PROTO((PatentSeqIdPtr psip));
 
203
 
 
204
/*****************************************************************************
 
205
*
 
206
*   TextSeqId
 
207
*
 
208
*****************************************************************************/
 
209
typedef struct textseqid {
 
210
    CharPtr name,
 
211
        accession,
 
212
        release;
 
213
        Int2 version;             /* INT2_MIN (ncbilcl.h) = not set */
 
214
} TextSeqId, PNTR TextSeqIdPtr;
 
215
 
 
216
NLM_EXTERN TextSeqIdPtr LIBCALL TextSeqIdNew PROTO((void));
 
217
NLM_EXTERN Boolean      LIBCALL TextSeqIdAsnWrite PROTO((TextSeqIdPtr tsip, AsnIoPtr aip, AsnTypePtr atp));
 
218
NLM_EXTERN TextSeqIdPtr LIBCALL TextSeqIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
219
NLM_EXTERN TextSeqIdPtr LIBCALL TextSeqIdFree PROTO((TextSeqIdPtr tsip));
 
220
 
 
221
/*****************************************************************************
 
222
*
 
223
*   Giim
 
224
*
 
225
*****************************************************************************/
 
226
typedef struct giim {
 
227
    Int4 id;
 
228
    CharPtr db,
 
229
        release;
 
230
} Giim, PNTR GiimPtr;
 
231
 
 
232
NLM_EXTERN GiimPtr LIBCALL GiimNew PROTO((void));
 
233
NLM_EXTERN Boolean LIBCALL GiimAsnWrite PROTO((GiimPtr gip, AsnIoPtr aip, AsnTypePtr atp));
 
234
NLM_EXTERN GiimPtr LIBCALL GiimAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
235
NLM_EXTERN GiimPtr LIBCALL GiimFree PROTO((GiimPtr gip));
 
236
 
 
237
 
 
238
/*****************************************************************************
 
239
*
 
240
*   PDBSeqId
 
241
*
 
242
*****************************************************************************/
 
243
typedef struct pdbseqid {
 
244
    CharPtr mol;
 
245
        Uint1 chain;        /* 0 = no chain set.  default = 32 */
 
246
        DatePtr rel;
 
247
} PDBSeqId, PNTR PDBSeqIdPtr;
 
248
 
 
249
NLM_EXTERN PDBSeqIdPtr LIBCALL PDBSeqIdNew PROTO((void));
 
250
NLM_EXTERN Boolean     LIBCALL PDBSeqIdAsnWrite PROTO((PDBSeqIdPtr tsip, AsnIoPtr aip, AsnTypePtr atp));
 
251
NLM_EXTERN PDBSeqIdPtr LIBCALL PDBSeqIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
252
NLM_EXTERN PDBSeqIdPtr LIBCALL PDBSeqIdFree PROTO((PDBSeqIdPtr tsip));
 
253
 
 
254
/*****************************************************************************
 
255
*
 
256
*   SeqLoc
 
257
*   SeqLoc is a choice using an ValNode, most types in data.ptrvalue
 
258
*      except integers, in data.intvalue
 
259
*   choice:
 
260
    1 = null NULL ,           -- not placed
 
261
    2 = empty Seq-id ,        -- to NULL one Seq-id in a collection
 
262
    3 = whole Seq-id ,        -- whole sequence
 
263
    4 = int Seq-interval ,    -- from to
 
264
    5 = packed-int Packed-seqint ,
 
265
    6 = pnt Seq-point ,
 
266
    7 = packed-pnt Packed-seqpnt ,
 
267
    8 = mix SEQUENCE OF Seq-loc ,
 
268
    9 = equiv SET OF Seq-loc ,  -- equivalent sets of locations
 
269
    10 = bond Seq-bond
 
270
    11 = feat Feat-id    -- indirect through a feature
 
271
*
 
272
*****************************************************************************/
 
273
#define SEQLOC_NULL ( (Uint1)1)
 
274
#define SEQLOC_EMPTY ( (Uint1)2)
 
275
#define SEQLOC_WHOLE ( (Uint1)3)
 
276
#define SEQLOC_INT ( (Uint1)4)
 
277
#define SEQLOC_PACKED_INT ( (Uint1)5)
 
278
#define SEQLOC_PNT ( (Uint1)6)
 
279
#define SEQLOC_PACKED_PNT ( (Uint1)7)
 
280
#define SEQLOC_MIX ( (Uint1)8)
 
281
#define SEQLOC_EQUIV ( (Uint1)9)
 
282
#define SEQLOC_BOND ( (Uint1)10)
 
283
#define SEQLOC_FEAT ( (Uint1)11)
 
284
 
 
285
NLM_EXTERN Boolean   LIBCALL SeqLocAsnWrite PROTO((SeqLocPtr anp, AsnIoPtr aip, AsnTypePtr atp));
 
286
NLM_EXTERN SeqLocPtr LIBCALL SeqLocAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
287
NLM_EXTERN SeqLocPtr LIBCALL SeqLocFree PROTO((SeqLocPtr anp));
 
288
NLM_EXTERN Int2 LIBCALL SeqLocLabel PROTO((SeqLocPtr slp, CharPtr buffer, Int2 buflen, Uint1 content));
 
289
 
 
290
/*****************************************************************************
 
291
*
 
292
*   these routines work on set/seq of SeqLoc
 
293
*
 
294
*****************************************************************************/
 
295
NLM_EXTERN Boolean   LIBCALL SeqLocSetAsnWrite PROTO((SeqLocPtr anp, AsnIoPtr aip, AsnTypePtr set, AsnTypePtr element));
 
296
NLM_EXTERN SeqLocPtr LIBCALL SeqLocSetAsnRead PROTO((AsnIoPtr aip, AsnTypePtr orig, AsnTypePtr element));
 
297
NLM_EXTERN SeqLocPtr LIBCALL SeqLocSetFree PROTO((SeqLocPtr anp));
 
298
 
 
299
/*****************************************************************************
 
300
*
 
301
*   SeqInt
 
302
*
 
303
*****************************************************************************/
 
304
typedef struct seqint {
 
305
    Int4 from,
 
306
        to;
 
307
    Uint1 strand;
 
308
    SeqIdPtr id;    /* seq-id */
 
309
    IntFuzzPtr if_from,
 
310
               if_to;
 
311
} SeqInt, PNTR SeqIntPtr;
 
312
 
 
313
NLM_EXTERN SeqIntPtr LIBCALL SeqIntNew PROTO((void));
 
314
NLM_EXTERN Boolean   LIBCALL SeqIntAsnWrite PROTO((SeqIntPtr sip, AsnIoPtr aip, AsnTypePtr atp));
 
315
NLM_EXTERN SeqIntPtr LIBCALL SeqIntAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
316
NLM_EXTERN SeqIntPtr LIBCALL SeqIntFree PROTO((SeqIntPtr sip));
 
317
 
 
318
/*****************************************************************************
 
319
*
 
320
*   Packed-int
 
321
*
 
322
*****************************************************************************/
 
323
 
 
324
NLM_EXTERN Boolean   LIBCALL PackSeqIntAsnWrite PROTO((SeqLocPtr sip, AsnIoPtr aip, AsnTypePtr atp));
 
325
NLM_EXTERN SeqLocPtr LIBCALL PackSeqIntAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
326
 
 
327
/*****************************************************************************
 
328
*
 
329
*   SeqLocMix
 
330
*
 
331
*****************************************************************************/
 
332
 
 
333
NLM_EXTERN Boolean   LIBCALL SeqLocMixAsnWrite PROTO((SeqLocPtr anp, AsnIoPtr aip, AsnTypePtr atp));
 
334
NLM_EXTERN SeqLocPtr LIBCALL SeqLocMixAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
335
 
 
336
/*****************************************************************************
 
337
*
 
338
*   SeqLocEquiv
 
339
*
 
340
*****************************************************************************/
 
341
 
 
342
NLM_EXTERN Boolean   LIBCALL SeqLocEquivAsnWrite PROTO((SeqLocPtr anp, AsnIoPtr aip, AsnTypePtr atp));
 
343
NLM_EXTERN SeqLocPtr LIBCALL SeqLocEquivAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
344
 
 
345
/*****************************************************************************
 
346
*
 
347
*   SeqPnt
 
348
*
 
349
*****************************************************************************/
 
350
typedef struct seqpoint {
 
351
    Int4 point;
 
352
    Uint1 strand;
 
353
    SeqIdPtr id;    /* seq-id */
 
354
    IntFuzzPtr fuzz;
 
355
} SeqPnt, PNTR SeqPntPtr;
 
356
 
 
357
NLM_EXTERN SeqPntPtr LIBCALL SeqPntNew PROTO((void));
 
358
NLM_EXTERN Boolean   LIBCALL SeqPntAsnWrite PROTO((SeqPntPtr spp, AsnIoPtr aip, AsnTypePtr atp));
 
359
NLM_EXTERN SeqPntPtr LIBCALL SeqPntAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
360
NLM_EXTERN SeqPntPtr LIBCALL SeqPntFree PROTO((SeqPntPtr spp));
 
361
 
 
362
/*****************************************************************************
 
363
*
 
364
*   PackSeqPnt
 
365
*
 
366
*****************************************************************************/
 
367
#define PACK_PNT_NUM 100     /* number of points per block */
 
368
 
 
369
typedef struct packseqpnt {
 
370
    SeqIdPtr id;    /* seq-id */
 
371
    IntFuzzPtr fuzz;
 
372
    Uint1 strand,
 
373
          used;       /* number of pnts used */
 
374
    Int4 pnts[PACK_PNT_NUM];
 
375
    struct packseqpnt PNTR next;   /* builds up chain of points */
 
376
} PackSeqPnt, PNTR PackSeqPntPtr;
 
377
 
 
378
NLM_EXTERN PackSeqPntPtr LIBCALL PackSeqPntNew PROTO((void));
 
379
NLM_EXTERN Boolean       LIBCALL PackSeqPntAsnWrite PROTO((PackSeqPntPtr pspp, AsnIoPtr aip, AsnTypePtr atp));
 
380
NLM_EXTERN PackSeqPntPtr LIBCALL PackSeqPntAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
381
NLM_EXTERN PackSeqPntPtr LIBCALL PackSeqPntFree PROTO((PackSeqPntPtr pspp));
 
382
NLM_EXTERN Int4          LIBCALL PackSeqPntGet PROTO((PackSeqPntPtr pspp, Int4 index));
 
383
NLM_EXTERN Boolean       LIBCALL PackSeqPntPut PROTO((PackSeqPntPtr pspp, Int4 point));
 
384
NLM_EXTERN Int4          LIBCALL PackSeqPntNum PROTO((PackSeqPntPtr pspp));
 
385
 
 
386
/*****************************************************************************
 
387
*
 
388
*   SeqBond
 
389
*
 
390
*****************************************************************************/
 
391
typedef struct seqbond {
 
392
    SeqPntPtr a,
 
393
                b;
 
394
} SeqBond, PNTR SeqBondPtr;
 
395
 
 
396
NLM_EXTERN SeqBondPtr LIBCALL SeqBondNew PROTO((void));
 
397
NLM_EXTERN Boolean    LIBCALL SeqBondAsnWrite PROTO((SeqBondPtr sbp, AsnIoPtr aip, AsnTypePtr atp));
 
398
NLM_EXTERN SeqBondPtr LIBCALL SeqBondAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
 
399
NLM_EXTERN SeqBondPtr LIBCALL SeqBondFree PROTO((SeqBondPtr sbp));
 
400
 
 
401
 
 
402
/*****************************************************************************
 
403
*
 
404
*   strand types
 
405
*
 
406
*****************************************************************************/
 
407
#define Seq_strand_unknown 0
 
408
#define Seq_strand_plus 1
 
409
#define Seq_strand_minus 2
 
410
#define Seq_strand_both 3
 
411
#define Seq_strand_both_rev 4
 
412
#define Seq_strand_other 255
 
413
 
 
414
#ifdef __cplusplus
 
415
}
 
416
#endif
 
417
 
 
418
#undef NLM_EXTERN
 
419
#ifdef NLM_EXPORT
 
420
#define NLM_EXTERN NLM_EXPORT
 
421
#else
 
422
#define NLM_EXTERN
 
423
#endif
 
424
 
 
425
#endif