| 1 | /* data structure for each file format and sequences */ |
|---|
| 2 | |
|---|
| 3 | #ifndef FILEBUFFER_H |
|---|
| 4 | #include <FileBuffer.h> |
|---|
| 5 | #endif |
|---|
| 6 | |
|---|
| 7 | #define INITSEQ 6000 |
|---|
| 8 | #define RNA 0 |
|---|
| 9 | #define NONRNA 1 |
|---|
| 10 | #define EQ 1 |
|---|
| 11 | #define NONEQ 0 |
|---|
| 12 | |
|---|
| 13 | #define GENBANK 'g' |
|---|
| 14 | #define MACKE 'm' |
|---|
| 15 | #define PROTEIN 't' |
|---|
| 16 | #define PHYLIP 'y' |
|---|
| 17 | #define PHYLIP2 '2' |
|---|
| 18 | #define PAUP 'p' |
|---|
| 19 | #define EMBL 'e' |
|---|
| 20 | #define GCG 'c' |
|---|
| 21 | #define PRINTABLE 'r' |
|---|
| 22 | #define ALMA 'l' |
|---|
| 23 | #define NBRF 'n' |
|---|
| 24 | #define STADEN 's' |
|---|
| 25 | |
|---|
| 26 | #define UNKNOWN (-1) |
|---|
| 27 | #define AUTHOR 1 |
|---|
| 28 | #define JOURNAL 2 |
|---|
| 29 | #define TITLE 3 |
|---|
| 30 | #define STANDARD 4 |
|---|
| 31 | #define PROCESS 5 |
|---|
| 32 | #define REF 6 |
|---|
| 33 | #define ALL 0 |
|---|
| 34 | |
|---|
| 35 | #define SEQLINE 60 |
|---|
| 36 | /* GenBank data structure */ |
|---|
| 37 | typedef struct { |
|---|
| 38 | char *ref; |
|---|
| 39 | char *author; |
|---|
| 40 | char *title; |
|---|
| 41 | char *journal; |
|---|
| 42 | char *standard; |
|---|
| 43 | } Reference; |
|---|
| 44 | |
|---|
| 45 | typedef struct { |
|---|
| 46 | int exist; |
|---|
| 47 | char *source; |
|---|
| 48 | char *cc; |
|---|
| 49 | char *formname; |
|---|
| 50 | char *nickname; |
|---|
| 51 | char *commname; |
|---|
| 52 | char *hostorg; |
|---|
| 53 | } Oinf; |
|---|
| 54 | |
|---|
| 55 | typedef struct { |
|---|
| 56 | int exist; |
|---|
| 57 | char *RDPid; |
|---|
| 58 | char *gbkentry; |
|---|
| 59 | char *methods; |
|---|
| 60 | char comp5; /* yes or no, y/n */ |
|---|
| 61 | char comp3; /* yes or no, y/n */ |
|---|
| 62 | } Sinf; |
|---|
| 63 | |
|---|
| 64 | typedef struct { |
|---|
| 65 | Oinf orginf; |
|---|
| 66 | Sinf seqinf; |
|---|
| 67 | char *others; |
|---|
| 68 | } Comment; |
|---|
| 69 | |
|---|
| 70 | typedef struct { |
|---|
| 71 | char *locus; |
|---|
| 72 | char *definition; |
|---|
| 73 | char *accession; |
|---|
| 74 | char *keywords; |
|---|
| 75 | char *source; |
|---|
| 76 | char *organism; |
|---|
| 77 | int numofref; |
|---|
| 78 | Reference *reference; |
|---|
| 79 | Comment comments; |
|---|
| 80 | } GenBank; |
|---|
| 81 | |
|---|
| 82 | /* Macke data structure */ |
|---|
| 83 | typedef struct { |
|---|
| 84 | char *seqabbr; /* seq. abbrev. */ |
|---|
| 85 | char *name; /* seq. full name */ |
|---|
| 86 | int rna_or_dna; /* rna or dna */ |
|---|
| 87 | char *atcc; /* CC# of seq. */ |
|---|
| 88 | char *rna; /* Sequence methods, old version entry */ |
|---|
| 89 | char *date; /* date of modification */ |
|---|
| 90 | char *nbk; /* GenBank information -old version entry */ |
|---|
| 91 | char *acs; /* accession number */ |
|---|
| 92 | char *author; /* author of the first reference */ |
|---|
| 93 | char *journal; /* journal of the first reference */ |
|---|
| 94 | char *title; /* title of the first reference */ |
|---|
| 95 | char *who; /* who key in the data */ |
|---|
| 96 | char *strain; /* strain */ |
|---|
| 97 | char *subspecies; /* subspecies */ |
|---|
| 98 | int numofrem; /* num. of remarks */ |
|---|
| 99 | char **remarks; /* remarks */ |
|---|
| 100 | } Macke; |
|---|
| 101 | |
|---|
| 102 | /* Paup data structure */ |
|---|
| 103 | typedef struct { |
|---|
| 104 | int ntax; /* number of sequences */ |
|---|
| 105 | int nchar; /* max number of chars per seq. */ |
|---|
| 106 | int labelpos; /* Label start from left or right */ |
|---|
| 107 | int missing; |
|---|
| 108 | const char *equate; /* equal meaning char */ |
|---|
| 109 | int interleave; /* interleave or sequential */ |
|---|
| 110 | int datatype; /* rna in this case */ |
|---|
| 111 | char gap; /* char of gap, default is '-' */ |
|---|
| 112 | int gapmode; |
|---|
| 113 | /* if sequence data is not too large, read into memory at once */ |
|---|
| 114 | /* otherwise, read in one by one. */ |
|---|
| 115 | } Paup; |
|---|
| 116 | |
|---|
| 117 | typedef struct { |
|---|
| 118 | char *author; |
|---|
| 119 | char *title; |
|---|
| 120 | char *journal; |
|---|
| 121 | char *processing; |
|---|
| 122 | } Emblref; |
|---|
| 123 | |
|---|
| 124 | typedef struct { |
|---|
| 125 | char *id; /* entry name */ |
|---|
| 126 | char *dateu; /* date of last updated */ |
|---|
| 127 | char *datec; /* date of created */ |
|---|
| 128 | char *description; /* description line (DE) */ |
|---|
| 129 | char *os; /* Organism species */ |
|---|
| 130 | char *accession; /* accession number(s) */ |
|---|
| 131 | char *keywords; /* keyword */ |
|---|
| 132 | int numofref; /* num. of reference */ |
|---|
| 133 | Emblref *reference; |
|---|
| 134 | char *dr; /* database cross-reference */ |
|---|
| 135 | Comment comments; /* comments */ |
|---|
| 136 | } Embl; |
|---|
| 137 | |
|---|
| 138 | typedef struct { |
|---|
| 139 | char *id; |
|---|
| 140 | char *filename; |
|---|
| 141 | int format; /* could be NBRF, UWGCG, RMBL, STADEN */ |
|---|
| 142 | char defgap; |
|---|
| 143 | int num_of_sequence; /* num of sequence after merging with gaps */ |
|---|
| 144 | char *sequence; /* sequence data after mergin with gaps */ |
|---|
| 145 | } Alma; |
|---|
| 146 | |
|---|
| 147 | typedef struct { |
|---|
| 148 | char *id; /* locus */ |
|---|
| 149 | char *description; |
|---|
| 150 | } Nbrf; |
|---|
| 151 | |
|---|
| 152 | /* one sequence entry */ |
|---|
| 153 | struct global_data { |
|---|
| 154 | int numofseq; /* number of sequences */ |
|---|
| 155 | int seq_length; /* sequence length */ |
|---|
| 156 | int max; |
|---|
| 157 | char *sequence; /* sequence data */ |
|---|
| 158 | /* to read all the sequences into memory at one time */ |
|---|
| 159 | char **ids; /* array of ids. */ |
|---|
| 160 | char **seqs; /* array of sequence data */ |
|---|
| 161 | int *lengths; /* array of sequence lengths */ |
|---|
| 162 | int allocated; /* for how many sequences space has been allocated */ |
|---|
| 163 | /* PAUP, PHYLIP, GCG, and PRINTABLE */ |
|---|
| 164 | GenBank gbk; /* one GenBank entry */ |
|---|
| 165 | Macke macke; /* one Macke entry */ |
|---|
| 166 | Paup paup; /* one Paup entry */ |
|---|
| 167 | Embl embl; |
|---|
| 168 | Alma alma; |
|---|
| 169 | Nbrf nbrf; |
|---|
| 170 | }; |
|---|
| 171 | |
|---|
| 172 | extern struct global_data data; |
|---|
| 173 | |
|---|