ARB
GDE_def.h
Go to the documentation of this file.
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 
62 struct 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 
73 typedef 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 
83 struct 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
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
110  int *tmatrix; // translation matrix (code->char)
111  int *rmatrix; // reverse translation matrix (char->code)
112 
114 };
115 
116 struct 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 
132 
133  NA_Alignment(GBDATA *gb_main_);
134  ~NA_Alignment();
135 };
136 
137 inline 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 
#define arb_assert(cond)
Definition: arb_assert.h:245
int sc
Definition: GDE_def.h:69
char short_name[SIZE_SHORT_NAME]
Definition: GDE_def.h:86
GBDATA * gb_main
Definition: GDE_def.h:129
int elementtype
Definition: GDE_def.h:107
int seqmaxlen
Definition: GDE_def.h:99
char seq_name[SIZE_SEQ_NAME]
Definition: GDE_def.h:85
int baggage_len
Definition: GDE_def.h:109
TimeStamp t_stamp
Definition: GDE_def.h:96
#define SIZE_AUTHORITY
Definition: GDE_def.h:81
int seqlen
Definition: GDE_def.h:98
char * id
Definition: GDE_def.h:117
int format
Definition: GDE_def.h:127
NA_Sequence * element
Definition: GDE_def.h:124
struct TimeStamp::@1 modify
int * col_lut
Definition: GDE_def.h:102
int attr
Definition: GDE_def.h:100
int yy
Definition: GDE_def.h:64
NA_Sequence * groupb
Definition: GDE_def.h:104
int * rmatrix
Definition: GDE_def.h:111
char contig[80]
Definition: GDE_def.h:88
char * authority
Definition: GDE_def.h:119
NA_Alignment(GBDATA *gb_main_)
Definition: GDE_event.cxx:203
NA_Base * sequence
Definition: GDE_def.h:95
void strcpy_truncate(char *dest, const char *source, size_t dest_size)
Definition: GDE_def.h:137
int dd
Definition: GDE_def.h:66
char * description
Definition: GDE_def.h:118
char * alignment_name
Definition: GDE_def.h:130
#define SIZE_ID
Definition: GDE_def.h:77
struct TimeStamp::@1 origin
#define SIZE_SHORT_NAME
Definition: GDE_def.h:79
NA_Sequence ** group
Definition: GDE_def.h:126
size_t groupid
Definition: GDE_def.h:101
char * baggage
Definition: GDE_def.h:108
GB_alignment_type alignment_type
Definition: GDE_def.h:131
#define SIZE_SEQ_NAME
Definition: GDE_def.h:78
int comments_len
Definition: GDE_def.h:93
int maxnumelements
Definition: GDE_def.h:121
GB_alignment_type
Definition: arbdb_base.h:61
char membrane[80]
Definition: GDE_def.h:89
int comments_maxlen
Definition: GDE_def.h:93
unsigned char NA_Base
Definition: GDE_def.h:73
int mm
Definition: GDE_def.h:65
int mn
Definition: GDE_def.h:68
int offset
Definition: GDE_def.h:97
int * tmatrix
Definition: GDE_def.h:110
char barcode[80]
Definition: GDE_def.h:87
size_t numelements
Definition: GDE_def.h:120
NA_Sequence * groupf
Definition: GDE_def.h:105
GBDATA * gb_species
Definition: GDE_def.h:113
int maxlen
Definition: GDE_def.h:122
#define SIZE_DESCRIPTION
Definition: GDE_def.h:80
int rel_offset
Definition: GDE_def.h:123
char description[SIZE_DESCRIPTION]
Definition: GDE_def.h:90
int baggage_maxlen
Definition: GDE_def.h:109
int hr
Definition: GDE_def.h:67
char authority[SIZE_AUTHORITY]
Definition: GDE_def.h:91
size_t numgroups
Definition: GDE_def.h:125
char * comments
Definition: GDE_def.h:92