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