JPRED-2 Add sources of all binaries (except alscript) to Git
[jpred.git] / sources / seg / genwin.h
1
2 /*****************************************************************************/
3 /***   (genwin.h)                                                          ***/
4 /*****************************************************************************/
5
6 /*--------------------------------------------------------------(includes)---*/
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <fcntl.h>
11 #include <ctype.h>
12 #include <math.h>
13
14 /*--------------------------------------------------------------(typedefs)---*/
15
16 typedef int Bool;
17
18 /*---------------------------------------------------------------(defines)---*/
19 #ifndef TRUE
20 #define TRUE 1
21 #define FALSE 0
22 #endif
23 /*---------------------------------------------------------------(structs)---*/
24
25 struct Database
26   {
27    char *filename;
28    FILE *fp;
29    char *indexname;
30    long int filepos;
31   };
32
33 struct Sequence
34   {
35    struct Database *db;
36
37    char *id;
38    char *name;
39    char *organism;
40    char *header;
41
42    char *seq;
43    int start;                     /* for windows */
44    int length;
45    struct Alphabet *alphabet;
46
47    struct Sequence *parent;       /* for windows */
48    struct Sequence *root;         /* for subwindows */
49    struct Sequence **children;    /* only the floaters? */
50
51    Bool bogus;
52    Bool punctuation;
53    Bool rubberwin;             /* for windows */
54    Bool floatwin;              /* for subwindows */
55    Bool seedwin;
56
57    int *state;
58    double entropy;
59    int *composition;
60    Bool *comptst;
61    int  *compindex;
62
63    char *classvec;               /* from ClaVec[aa] */
64    struct Alphabet *clalphabet;
65    double *scorevec;             /* from ScoVec[aa] or ScoFun(pos) */
66    double score;                 /* from ScoFun(win) */
67                           /* union, for integer scores? */
68    struct PerScoreVec *foo;
69    int *bar;
70   };
71
72 struct Configuration
73   {
74    char *iseq;
75    int ilength;
76
77    int printper;
78   };
79
80 struct Matrix
81   {
82    struct Sequence *parent;
83
84    char **seq;
85    int start;
86    int period;
87    int length;
88
89    int **rowcomp;
90    int **colcomp;
91   };
92
93 /*------------------------------------------------------(alphabet structs)---*/
94
95 struct Alphabet
96   {
97    char *name;
98    int size;
99
100    int *index[128];
101    char *chars;       /*  [size]  */
102    char **charnames;  /*  [size]  */
103
104    Bool caseinvariant;
105   };
106
107 struct TransVector
108   {
109    struct Alphabet *from;
110    struct Alphabet *to;
111
112    int *index;     /*  [from->size]  */
113   };
114
115 struct ScoreVector
116   {
117    struct Alphabet *from;
118
119    double *score;   /*  [from->size]  */
120    char *units;
121   };
122
123 struct ScoreMatrix
124   {
125    struct Alphabet *from1;
126    struct Alphabet *from2;
127
128    double **score;  /*  [from1->size][from2->size]  */
129    char *units;
130   };
131
132 /*---------------------------------------------------------(bogus structs)---*/
133
134 struct PerScoreVec
135   {
136    int hits;
137    int tot;
138    double pct;
139    double std;
140    double prob;
141   };
142
143 /*----------------------------------------------------------------(protos)---*/
144
145 extern struct Database *opendbase();
146 extern closedbase();
147
148 extern struct Sequence *openseq(), *firstseq(), *nextseq();
149 extern closeseq();
150
151 extern struct Sequence *openwin(), *nextwin();
152 extern shiftwin(), closewin();
153
154 extern compon(), stateon(), enton();
155 extern double entropy();
156
157 extern struct Matrix *openmat();
158 extern closemat();
159
160 extern upper(), lower(), findchar();
161
162 /*----------------------------------------------------------------(macros)---*/
163
164 /***   #define bogus(A) (aaindex[A]>=20)   ***/
165
166 /*---------------------------------------------------------------(globals)---*/
167
168 extern int aaindex[];
169 extern char aachar[];
170
171 /*---------------------------------------------------------------------------*/