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 TRUTH 1 |
---|
15 | #define JUSTICE 2 |
---|
16 | #define BEAUTY 3 |
---|
17 | |
---|
18 | // Cursor directions |
---|
19 | #define RIGHT 1 |
---|
20 | #define LEFT 0 |
---|
21 | #define UP 0 |
---|
22 | #define DOWN 1 |
---|
23 | |
---|
24 | #ifndef TRUE |
---|
25 | #define TRUE 1 |
---|
26 | #define FALSE 0 |
---|
27 | #endif |
---|
28 | |
---|
29 | #define GBUFSIZ 4096 |
---|
30 | #define MAX_NA_DISPLAY_WIDTH 1024 |
---|
31 | #define MAX_NA_DISPLAY_HEIGHT 1024 |
---|
32 | #define MAX_STARTUP_CANVAS_HEIGHT 512 |
---|
33 | #define grey_height 8 |
---|
34 | #define grey_width 8 |
---|
35 | |
---|
36 | #define TEXTFIELDWIDTH 15 |
---|
37 | |
---|
38 | // Definable dialog types |
---|
39 | #define TEXTFIELD 0x1 |
---|
40 | #define SLIDER 0x2 |
---|
41 | #define CHOOSER 0x3 |
---|
42 | #define CHOICE_MENU 0x4 |
---|
43 | #define CHOICE_LIST 0x5 |
---|
44 | #define CHOICE_TREE 0x6 |
---|
45 | #define CHOICE_SAI 0x7 |
---|
46 | #define CHOICE_WEIGHTS 0x8 |
---|
47 | #define FILE_SELECTOR 0x9 |
---|
48 | |
---|
49 | // File Formats |
---|
50 | #define GDE 0x100 |
---|
51 | #define GENBANK 0x101 |
---|
52 | #define NA_FLAT 0x102 |
---|
53 | |
---|
54 | // Protection bits |
---|
55 | #define PROT_BASE_CHANGES 0x1 // Allow base changes |
---|
56 | #define PROT_GREY_SPACE 0x2 // Allow greyspace modification |
---|
57 | #define PROT_WHITE_SPACE 0x4 // Allow whitespace modification |
---|
58 | #define PROT_TRANSLATION 0x8 // Allow translation |
---|
59 | #define PROT_REORIENTATION 0x10 // Allow reorientation |
---|
60 | |
---|
61 | |
---|
62 | // File loading methods (must be 'OR/AND' able) |
---|
63 | #define NONE 0x0 |
---|
64 | #define DESTROY 0x1 |
---|
65 | #define LOAD 0x2 |
---|
66 | #define SAVE 0x4 |
---|
67 | #define ALL 0x10 |
---|
68 | |
---|
69 | // Sequence DISPLAY Types |
---|
70 | #define NASEQ_ALIGN 0x201 |
---|
71 | #define NASEQ 0x202 |
---|
72 | |
---|
73 | // Sequence Data Types |
---|
74 | #define DNA 0x300 |
---|
75 | #define RNA 0x301 |
---|
76 | #define TEXT 0x302 |
---|
77 | #define MASK 0x303 |
---|
78 | #define PROTEIN 0x304 |
---|
79 | |
---|
80 | // extended sequence attributes (true/false) |
---|
81 | #define IS_5_TO_3 0x01 // 5prime to 3 prime |
---|
82 | #define IS_3_TO_5 0x02 // 3 prime to 5 prime |
---|
83 | #define IS_CIRCULAR 0x04 // circular dna |
---|
84 | #define IS_PRIMARY 0x10 // on the primary strand |
---|
85 | #define IS_SECONDARY 0x20 // on the secondary strand |
---|
86 | #define IS_MODIFIED 0x40 // modification flag |
---|
87 | #define IS_ORIG_PRIMARY 0x80 // Original sequence was primary |
---|
88 | #define IS_ORIG_SECONDARY 0x100 // Original sequence was secondary |
---|
89 | #define IS_ORIG_5_TO_3 0x200 // Original sequence was 5_to_3 |
---|
90 | #define IS_ORIG_3_TO_5 0x400 // Original sequence was 3_to_5 |
---|
91 | |
---|
92 | #ifdef HGL |
---|
93 | #define DEFAULT_X_ATTR 0 |
---|
94 | #else |
---|
95 | #define DEFAULT_X_ATTR IS_5_TO_3+IS_PRIMARY; |
---|
96 | #endif |
---|
97 | |
---|
98 | // Other display attributed |
---|
99 | #define INVERTED 1 |
---|
100 | #define VSCROLL_LOCK 2 |
---|
101 | #define KEYCLICKS 4 |
---|
102 | #define GDE_MESSAGE_PANEL 8 |
---|
103 | |
---|
104 | // Coloring Methods |
---|
105 | #define COLOR_MONO 0x40 // no color, simple black and white |
---|
106 | #define COLOR_LOOKUP 0x41 // Use a simple value->color lookup |
---|
107 | #define COLOR_ALN_MASK 0x42 /* The alignment has a column by column color |
---|
108 | mask associated with it */ |
---|
109 | #define COLOR_SEQ_MASK 0x43 // Each sequence has a color mask |
---|
110 | #define COLOR_STRAND 0x44 // Color based on original strandedness |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | // Data types |
---|
115 | |
---|
116 | struct NumList { |
---|
117 | int *valu; |
---|
118 | }; |
---|
119 | |
---|
120 | |
---|
121 | struct TimeStamp { |
---|
122 | struct { |
---|
123 | int yy; |
---|
124 | int mm; |
---|
125 | int dd; |
---|
126 | int hr; |
---|
127 | int mn; |
---|
128 | int sc; |
---|
129 | } origin, modify; |
---|
130 | }; |
---|
131 | |
---|
132 | typedef unsigned char NA_Base; |
---|
133 | |
---|
134 | struct GMask { |
---|
135 | char *name; |
---|
136 | int type; |
---|
137 | NumList *list; |
---|
138 | int listlen; |
---|
139 | int maxlen; |
---|
140 | }; |
---|
141 | |
---|
142 | |
---|
143 | // sizes for fields (including terminating zero byte) |
---|
144 | #define SIZE_FIELD_GENBANK 80 |
---|
145 | #define SIZE_ID SIZE_FIELD_GENBANK |
---|
146 | #define SIZE_SEQ_NAME SIZE_FIELD_GENBANK |
---|
147 | #define SIZE_SHORT_NAME 32 |
---|
148 | #define SIZE_DESCRIPTION SIZE_FIELD_GENBANK |
---|
149 | #define SIZE_AUTHORITY SIZE_FIELD_GENBANK |
---|
150 | |
---|
151 | struct NA_Sequence { |
---|
152 | char id[SIZE_ID]; // sequence id (ACCESSION) |
---|
153 | char seq_name[SIZE_SEQ_NAME]; // Sequence name (ORGANISM) |
---|
154 | char short_name[SIZE_SHORT_NAME]; // Name (LOCUS) |
---|
155 | char barcode[80]; |
---|
156 | char contig[80]; |
---|
157 | char membrane[80]; |
---|
158 | char description[SIZE_DESCRIPTION];// Description (DEFINITION) |
---|
159 | char authority[SIZE_AUTHORITY]; // Author (or creator) |
---|
160 | char *comments; // Stuff we can't parse |
---|
161 | int comments_len, comments_maxlen; |
---|
162 | |
---|
163 | NA_Base *sequence; // List of bases |
---|
164 | TimeStamp t_stamp; // Time stamp of origin/modification |
---|
165 | GMask *mask; // List of masks(analysis/display) |
---|
166 | int offset; // offset into alignment (left white) space |
---|
167 | int seqlen; // Number of elements in sequence[] |
---|
168 | int seqmaxlen; // Size sequence[] (for mem alloc) |
---|
169 | unsigned int protect; // Protection mask |
---|
170 | int attr; // Extended attributes |
---|
171 | size_t groupid; // group id |
---|
172 | int *col_lut; // character to color LUT |
---|
173 | |
---|
174 | NA_Sequence *groupb; // Group link backward |
---|
175 | NA_Sequence *groupf; // Group link forward |
---|
176 | |
---|
177 | int *cmask; // color mask |
---|
178 | int format; // default file format |
---|
179 | int elementtype; // what type of data are being aligned |
---|
180 | char *baggage; // unformatted comments |
---|
181 | int baggage_len, baggage_maxlen; |
---|
182 | int *tmatrix; // translation matrix (code->char) |
---|
183 | int *rmatrix; // reverse translation matrix (char->code) |
---|
184 | |
---|
185 | GBDATA *gb_species; |
---|
186 | }; |
---|
187 | |
---|
188 | struct NA_Alignment { |
---|
189 | char *id; // Alignment ID |
---|
190 | char *description; // Description of the alignment |
---|
191 | char *authority; // Who generated the alignment |
---|
192 | int *cmask; // color mask |
---|
193 | int cmask_offset; // color mask offset |
---|
194 | int cmask_len; // color mask length |
---|
195 | int ref; // reference sequence |
---|
196 | size_t numelements; // number of data elements |
---|
197 | int maxnumelements; // maximum number of data elements |
---|
198 | int nummasks; // number of masks |
---|
199 | int maxlen; // Maximum length of alignment |
---|
200 | int rel_offset; // add this to every sequence offset |
---|
201 | // to orient it back to 0 |
---|
202 | GMask *mask; // masks |
---|
203 | NA_Sequence *element; // alignment elements |
---|
204 | size_t numgroups; // number of groups |
---|
205 | NA_Sequence **group; /* link to array of pointers into |
---|
206 | each group */ |
---|
207 | char *na_ddata; // display data |
---|
208 | int format; // default file format |
---|
209 | char *selection_mask; // Sub sequence selection mask |
---|
210 | int selection_mask_len; // Sub selection mask length |
---|
211 | int min_subselect; // Leftmost coord of selection mask |
---|
212 | |
---|
213 | GBDATA *gb_main; |
---|
214 | char *alignment_name; |
---|
215 | }; |
---|
216 | |
---|
217 | extern NA_Alignment *DataSet; |
---|
218 | |
---|
219 | #define getcmask(a, b) (b < ((a)->offset)) ? 0 : ((a)->cmask[(b-(a)->offset)]) |
---|
220 | |
---|
221 | inline void strncpy_terminate(char *dest, const char *source, size_t dest_size) { |
---|
222 | // like strncpy, but also writes terminating zero byte |
---|
223 | // 'dest_size' is overall 'dest'-buffersize (incl. zero terminator) |
---|
224 | strncpy(dest, source, dest_size-1); |
---|
225 | dest[dest_size-1] = 0; |
---|
226 | } |
---|
227 | |
---|
228 | #else |
---|
229 | #error GDE_def.h included twice |
---|
230 | #endif // GDE_DEF_H |
---|