source: branches/stable/ARB_GDE/GDE_def.h

Last change on this file was 17178, checked in by westram, 6 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1#ifndef GDE_DEF_H
2#define GDE_DEF_H
3
4#ifndef ARBDBT_H
5#include <arbdbt.h>
6#endif
7
8/* Copyright (c) 1990,1991,1992 Steven Smith at the Harvard Genome Laboratory.
9 * All rights reserved.
10 */
11
12#define gde_assert(bed) arb_assert(bed)
13
14#define GBUFSIZ        4096
15#define TEXTFIELDWIDTH 15
16
17// Definable dialog types
18#define TEXTFIELD      0x1
19#define SLIDER         0x2
20#define CHOOSER        0x3
21#define CHOICE_MENU    0x4
22#define CHOICE_LIST    0x5
23#define CHOICE_TREE    0x6
24#define CHOICE_SAI     0x7
25#define CHOICE_WEIGHTS 0x8
26#define FILE_SELECTOR  0x9
27
28// File Formats
29#define GDE         0x100
30#define GENBANK     0x101
31#define NA_FLAT     0x102
32
33// File loading methods (must be 'OR/AND' able)
34#define NONE          0x0
35#define ALL           0x10
36
37// Sequence DISPLAY Types
38#define NASEQ_ALIGN 0x201
39
40// Sequence Data Types
41#define DNA     0x300
42#define RNA     0x301
43#define TEXT    0x302
44#define MASK    0x303
45#define PROTEIN 0x304
46
47// extended sequence attributes (true/false)
48#define IS_5_TO_3         0x01                      // 5prime to 3 prime
49#define IS_3_TO_5         0x02                      // 3 prime to 5 prime
50#define IS_CIRCULAR       0x04                      // circular dna
51#define IS_PRIMARY        0x10                      // on the primary strand
52#define IS_SECONDARY      0x20                      // on the secondary strand
53#define IS_ORIG_PRIMARY   0x80                      // Original sequence was primary
54#define IS_ORIG_SECONDARY 0x100                     // Original sequence was secondary
55#define IS_ORIG_5_TO_3    0x200                     // Original sequence was 5_to_3
56#define IS_ORIG_3_TO_5    0x400                     // Original sequence was 3_to_5
57
58#define DEFAULT_X_ATTR  IS_5_TO_3+IS_PRIMARY;
59
60// Data types
61
62struct TimeStamp {
63    struct {
64        int yy;
65        int mm;
66        int dd;
67        int hr;
68        int mn;
69        int sc;
70    } origin, modify;
71};
72
73typedef unsigned char NA_Base;
74
75// sizes for fields (including terminating zero byte)
76#define SIZE_FIELD_GENBANK 80
77#define SIZE_ID            SIZE_FIELD_GENBANK
78#define SIZE_SEQ_NAME      SIZE_FIELD_GENBANK
79#define SIZE_SHORT_NAME    32
80#define SIZE_DESCRIPTION   SIZE_FIELD_GENBANK
81#define SIZE_AUTHORITY     SIZE_FIELD_GENBANK
82
83struct NA_Sequence {
84    char  id[SIZE_ID];                  // sequence id (ACCESSION)
85    char  seq_name[SIZE_SEQ_NAME];      // Sequence name (ORGANISM)
86    char  short_name[SIZE_SHORT_NAME];  // Name (LOCUS)
87    char  barcode[80];
88    char  contig[80];
89    char  membrane[80];
90    char  description[SIZE_DESCRIPTION];// Description (DEFINITION)
91    char  authority[SIZE_AUTHORITY];    // Author (or creator)
92    char *comments;                     // Stuff we can't parse
93    int   comments_len, comments_maxlen;
94
95    NA_Base      *sequence;     // List of bases
96    TimeStamp     t_stamp;      // Time stamp of origin/modification
97    int           offset;       // offset into alignment (left white) space
98    int           seqlen;       // Number of elements in sequence[]
99    int           seqmaxlen;    // Size sequence[] (for mem alloc)
100    int           attr;         // Extended attributes
101    size_t        groupid;      // group id
102    int          *col_lut;      // character to color LUT
103
104    NA_Sequence *groupb;        // Group link backward
105    NA_Sequence *groupf;        // Group link forward
106
107    int   elementtype;          // what type of data are being aligned
108    char *baggage;              // unformatted comments
109    int   baggage_len, baggage_maxlen;
110    int  *tmatrix;              // translation matrix (code->char)
111    int  *rmatrix;              // reverse translation matrix (char->code)
112
113    GBDATA  *gb_species;
114};
115
116struct NA_Alignment : virtual Noncopyable {
117    char         *id;           // Alignment ID
118    char         *description;  // Description of the alignment
119    char         *authority;    // Who generated the alignment
120    size_t        numelements;  // number of data elements
121    int           maxnumelements; // maximum number of data elements
122    int           maxlen;       // Maximum length of alignment
123    int           rel_offset;   // add this to every sequence offset to orient it back to 0
124    NA_Sequence  *element;      // alignment elements
125    size_t        numgroups;    // number of groups
126    NA_Sequence **group;        // link to array of pointers into each group
127    int           format;       // default file format
128
129    GBDATA            *gb_main;
130    char              *alignment_name;
131    GB_alignment_type  alignment_type;
132
133    NA_Alignment(GBDATA *gb_main_);
134    ~NA_Alignment();
135};
136
137inline void strcpy_truncate(char *dest, const char *source, size_t dest_size) { // @@@ move to arb_str.h?
138    // like strncpy, but always writes terminating zero byte (truncating the result if necessary).
139    // The number of copied non-zero-bytes does never exceed 'dest_size-1'.
140    //
141    // Behavior differing from standard strncpy:
142    // - 'dest_size' is overall 'dest'-buffersize (incl. zero terminator)
143    // - unused rest of dest buffer is not filled with 0 bytes
144
145    arb_assert(dest_size>1);
146
147    size_t copy_size = dest_size-1;
148    size_t i         = 0;
149
150    while (i<copy_size) {
151        if (!source[i]) break;
152        dest[i] = source[i];
153        ++i;
154    }
155
156    arb_assert(i<dest_size);
157    dest[i] = 0;
158}
159
160#else
161#error GDE_def.h included twice
162#endif // GDE_DEF_H
163
164
Note: See TracBrowser for help on using the repository browser.