1 /* $Id: thrdatd.h 103491 2007-05-04 17:18:18Z kazimird $
2 *===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name:  thrdatd.h
27 *
28 * Author:  Stephen Bryant
29 *
30 * Initial Version Creation Date: 08/16/2000
31 *
32 * $Revision: 103491 $
33 *
34 * File Description: threader
35 */
36 
37 /* atd.h - structure and function declarations for adaptive threading  */
38 			/* Steve Bryant, 6/93 */
39 
40 #if !defined(THRDATD_H)
41 #define THRDATD_H
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /* Argument data structures */
48 
49 typedef struct _Fld_Mtf {		/* Folding motif data structure */
50   int	n;		/* Number of residues in the structure */
51   struct {		/* Residue-residue contact list */
52     int	*r1;	/* Index of first residue of in a pair */
53     int	*r2;	/* Index second residue in a pair */
54     int	*d;	/* Distance interval in a pair */
55     int	n; 	/* Number of contact pairs */
56 		} rrc;
57   struct  {		/* Residue-peptide contact list */
58     int	*r1;	/* Index of side-chain residue in a pair */
59     int	*p2;	/* Index of the peptide group in a pair */
60     int	*d;	/* Distance interval of a contact pair */
61     int	n; 	/* Number of contact pairs */
62 		} rpc;
63   int **mll;		/* Minimum loop lengths by residue pair */
64 } Fld_Mtf;
65 
66 
67 typedef struct _Cor_Def {	/* Core definition data structure */
68   struct {		/* Core segment location limits */
69     int	*rfpt;	/* Index of central reference residue */
70     int	*nomn;	/* Minimun offset of core segment N-termini */
71     int	*nomx;	/* Maxixmum offset of core segment N-termini */
72     int	*comn;	/* Minimun offset of core segment C-termini */
73     int	*comx;	/* Maxixmum offset of core segment C-termini */
74     int	n;	/* Number of core segments */
75 		} sll;
76   struct { 		/* Loop length limits */
77     int	*llmn;	/* Minimum lengths, including tails */
78     int	*llmx;	/* Maximum lengths, including tails */
79     int	*lrfs;	/* Maximun number of residues in ref. state */
80     int	n;	/* Number of loops, one more than core segs */
81 		} lll;
82   struct {		/* Fixed-sequence segment locations */
83     int	*nt;	/* Fixed segment N-termini */
84     int	*ct;	/* Fixed segment C-termini */
85     int	*sq;	/* Motif sequence containing fixed segs */
86     int	n;	/* Number of fixed segments */
87 		} fll;
88 } Cor_Def;
89 
90 
91 typedef struct _Qry_Seq { 		/* Query sequence data structure */
92   int 	*sq;		/* The sequence as an integer array */
93   int	n;		/* Number of residues in that sequence */
94   struct {		/* Alignment contstraints for this sequence */
95     int	*mn;	/* Minimum and maximum query sequence indices */
96     int	*mx;	/* to be aligned with each core segment */
97     int	n;	/* Number of constraints */
98 		} sac;
99 } Qry_Seq;
100 
101 
102 typedef struct _Rcx_Ptl {		/* Pairwise contact potential */
103   int	***rre;		/* Pair energies by type and distance */
104   int	**re;		/* Hydrophobic energies by type and distance */
105   int	***rrt;		/* Sum of pair plus hydrophobic energies */
106   int	nrt;		/* Number or residue types */
107   int	ndi;		/* Number of distance intervals */
108   int	ppi;		/* Index of the peptide group */
109 } Rcx_Ptl;
110 
111 
112 typedef struct _Gib_Scd { 		/* Gibbs schedule parameters */
113   int ntp;    /* number of trajectory points */
114   int	nrs;		/* Number of random starts */
115   int	nts;		/* Number of temperature steps */
116   int	crs;		/* Number of starts before convergence test */
117   int	cfm;		/* Top thread frequency convergence criterion */
118   int	csm;		/* Top thread start convergence criterion */
119   int	cet;		/* Temperature for convergence test ensemble */
120   int	cef;		/* Percent of ensemble defining top threads */
121   int	isl;		/* Code for choice of starting locations */
122   int	iso;		/* Code for choice of segment sample order */
123   int	ito;		/* Code for choice of terminus sample order */
124   int	rsd;		/* Seeds for random number generator */
125   int	als;		/* Code for choice of alignment record style */
126   int	trg;		/* Code for choice of trajectory record */
127   int	*nti;		/* Number of iterations per tempeature step */
128   int	*nac;		/* Number of alignment cycles per iteration */
129   int	*nlc;		/* Number of location cycles per iteration */
130   int	*tma;		/* Temperature steps for alignment sampling */
131   int	*tml;		/* Temperature steps for location sampling */
132   int	*lms;		/* Iterations before local minimum test */
133   int	*lmw;		/* Iterations in local min test interval */
134   int	*lmf;		/* Percent of top score indicating local min */
135 } Gib_Scd;
136 
137 
138 typedef struct _Thd_Tbl {		/* Thread table data structure */
139   float	*tg;		/* Energy of this thread  */
140   float	*ps;		/* Potential energy */
141   float	*ms;		/* Motif energy */
142   float   *cs;		/* Conservation energy */
143   float	*lps;		/* Loopout energy */
144   float   *zsc;           /* Z-score */
145   float   *g0;		/* Average total energy of shuffled seq */
146   float   *m0;		/* Average motif score of shuffled seq */
147   float   *errm;		/* Standard error of random motif scores */
148   float   *errp;		/* Standard error of random contact scores */
149   int	*tf;		/* Frequency of this thread in sampling */
150   int	*ts;		/* Number of starts in which it was found */
151   int	*ls;		/* Last start in which this thread was found */
152   int	**al;		/* Alignment of query to each core segment */
153   int	**no;		/* N-terminal offset of each core segment */
154   int	**co;		/* C-terminal offset of each core segment */
155   int	*pr;		/* Index of next-higher energy thread */
156   int	*nx;		/* Index of next-lower energy thread */
157   int	mx;		/* Index of lowest energy thread in list */
158   int	mn;		/* Index of highest energy thread in list */
159   int	n;		/* Maximum number of threads in linked list */
160   int	nsc;	/* Number of core segments */
161 } Thd_Tbl;
162 
163 
164 typedef struct _Thd_Tst {		/* Storage for local min and convergence test */
165   float   *bw;            /* Boltzmann weight of this thread */
166   int	nw;		/* Number of Boltzmann weight values */
167   float	*ib;		/* Best energy found for each iteration */
168   int	nb;		/* Number of best energy values */
169   float	gb;		/* Best energy across iterations */
170   int	lm;		/* Flag for local minimum */
171   int	tf;		/* Top-thread best alignment frequency */
172   int	ts;		/* Top-thread best random start count */
173 } Thd_Tst;
174 
175 
176 /* Tracking data structures for Gibb's sampling */
177 
178 typedef struct _Cur_Loc {		/* Location of core segments in motif */
179   int	*no;		/* N-terminus offset from reference point */
180   int	*co;		/* C-terminus offset from reference point */
181   int	nsc;		/* Number of core segments */
182   int	*lp;		/* Minimum loop length derived from motif */
183   int	nlp;		/* Number of loops */
184   int	*cr;		/* Core segment index by residue position */
185   int	nmt;		/* Number of residue positions in motif */
186 } Cur_Loc;
187 
188 
189 typedef struct _Cur_Aln {		/* Aligment of query sequence with core */
190   int	*al;		/* Query sequence index aligned with rfpt  */
191   int	nsc;		/* Number of core segments */
192   int	*sq;		/* Residue types currently assigned to motif */
193   int	*cf;		/* Core segment indices at maximun extent */
194   int	nmt;		/* Number of residue positions in motif */
195 } Cur_Aln;
196 
197 
198 typedef struct _Seg_Nsm {		/* Number of contacts by segment pair */
199   int	***nrr;		/* Res-res counts by seg by seg by dis */
200   int	*srr;		/* Total res-res counts by distance interval */
201   int	***nrp;		/* Res-pep counts by seg by seg by dis */
202   int	*srp;		/* Total res-pep counts by distance interval */
203   int	***nrf;		/* Res-fixed contacts by seg by type by dis */
204   int	**frf;		/* Total res-fixed contacts by type by dis */
205   int	*srf;		/* Total res-fixed contacts by dis */
206   int	trf;		/* Total res-fixed contacts */
207   int	nsc;		/* Number of core segments */
208   int	ndi;		/* Number of distance intervals */
209   int	nrt;		/* Number of residue types */
210 } Seg_Nsm;
211 
212 
213 typedef struct _Seg_Cmp {		/* Segment pair amino acid composition */
214   int	**srt;		/* Residue type counts by core segment */
215   int	nsc;		/* Number of core segments */
216   int	nrt;		/* Number of residue types */
217   int	**lrt;		/* Residue type counts by loop segment */
218   int	nlp;		/* Number of loop segments */
219   int	*rt;		/* Total residue type counts */
220   int	*rto;		/* Residue type counts from previous thread */
221 } Seg_Cmp;
222 
223 
224 typedef struct _Seg_Gsm {                /* Current contact energies by segmenmt pair */
225   int     **gss;          /* Potential energies by core segment pair */
226   int     *gs;            /* Potential energies by core segment */
227   int     *ms;		/* Motif energies by core segment */
228   int	*cs;		/* Conservation energies by core segment */
229   int	*ls;		/* Loopout energies by by core segment */
230   int     *s0;		/* Expected motif energies by core segment */
231   int     nsc;            /* The number of segments */
232 } Seg_Gsm;
233 
234 
235 typedef struct _Thd_Cxe {		/* Expected energy of pairwise contacts */
236   float	*rp;		/* Residue frequencies, from type counts */
237   float	**rrp;		/* Mass action residue pair probabilities */
238   int	nrt;		/* Number of residue types */
239   float	*rre;		/* Expected energy of a res-res contact */
240   float	*rpe;		/* Expected energy of a res-pep contact */
241   float	*rfe;		/* Expected energy of a res-fix contact */
242   int	ndi;		/* Number of distance intervals */
243 } Thd_Cxe;
244 
245 
246 typedef struct _Thd_Gsm {		/* Total thread energy */
247   int	g;		/* G(r|m), sum of potentials */
248   float	g0;		/* G0(r|m), reference state energy for potential */
249   float	dg;		/* Overall thread energy */
250   float	ps;		/* G(r|m)-G0(r|m)-overall potential energy */
251   float	ms;		/* Overall motif energy */
252   float m0;   /* Average motif score for random assignment*/
253   float	cs;		/* Overall conservation energy */
254   float	ls;		/* Overall loopout energy */
255 } Thd_Gsm;
256 
257 
258 typedef struct _Cxl_Als {		/* Contacts by segment for alignment sampling */
259   struct {		/* Residue-residue contact list */
260     int	*r1;	/* Index of first residue in a pair */
261     int	*r2;	/* Index second residue in a pair */
262     int	***e;	/* Energy of each type pair at these pos. */
263     int	n; 	/* Number of contact pairs */
264 		} rr;
265   struct {		/* Residue-hfo/pep/fix contact list */
266     int	*r;	/* Index of a position with contacts */
267     int	**e;	/* Energy of each residue type at this pos. */
268     int	n; 	/* Number of residue-peptide contact terms */
269 		} r;
270 } Cxl_Als;
271 
272 
273 typedef struct _Cxl_Los {		/* Contacts by segment for extent sampling */
274   struct {		/* Residue-residue contact list */
275     int	*r1;	/* Index of first residue in a pair */
276     int	*r2;	/* Index second residue in a pair */
277     int	*d;	/* Contact distance interval */
278     int	*e;	/* Energy of a contact at these positions */
279     int	n; 	/* Number of contact pairs */
280 		} rr;
281   struct {		/* Residue-peptide contact list */
282     int	*r1;	/* Index of first residue in a pair */
283     int	*p2;	/* Index second residue in a pair */
284     int	*d;	/* Contact distance interval */
285     int	*e;	/* Energy of the pair, given alignment */
286     int	n; 	/* Number of contact pairs */
287 		} rp;
288   struct  {		/* Residue-fixed environment contact list */
289     int	*r1;	/* Index of a position with contacts */
290     int	*t2;	/* Type of second residue in the pair */
291     int	*d;	/* Contact distance interval */
292     int	*e;	/* Energy of the pair, given alignment */
293     int	n; 	/* Number of residue-peptide contact terms */
294 		} rf;
295 } Cxl_Los;
296 
297 
298 typedef struct _Seg_Ord {		/* Sampling order for core segments */
299   int	*si;		/* Indices of variables for sampling */
300   int	*so;		/* Sample order for variables */
301   int	*to;		/* Flags first terminus for extent sampling */
302   int	nsc;		/* Number of core segments */
303 } Seg_Ord;
304 
305 
306 typedef struct _Rnd_Smp {		/* Random-sampling and permutation parameters */
307   int	n;		/* Number of values a variable may adopt */
308   float	*p;		/* Probabilitites associated with each value */
309   float	*e;		/* Energies associated with each value */
310   int     *lsg;		/* Start/stop sites of loop segments in structure */
311   int     *aqi;		/* Indeces of the residues to be shuffled */
312   int     *r,*o;		/* Shuffled values and order permutation */
313   int     *sq;		/* Permuted sequence */
314 } Rnd_Smp;
315 
316 
317 typedef struct _Seq_Mtf {		/* Sequence motif parameters */
318   int	**ww;	        /* Weights */
319   int **freqs;      /* residue frequencies */
320   int	n;		        /* Number of residues in structure */
321   int AlphabetSize; /* Number of letters in alphabet */
322   float ww0;        /* Expected energy of template profile term */
323 } Seq_Mtf;
324 
325 
326 /*----------------------------------------------------------------------------*/
327 /* Constants                                                                  */
328 /*----------------------------------------------------------------------------*/
329 #define BIGNEG -1000000000.
330 #define NERZRO .000001
331 #undef	ATD_DEBUG
332 #undef	SLO0_DEBUG
333 #define SGI
334 #undef	SUN
335 
336 #ifdef __cplusplus
337 }
338 #endif
339 
340 #endif
341