1 #ifndef DYNAMITEaligngenemodelHEADERFILE
2 #define DYNAMITEaligngenemodelHEADERFILE
3 #ifdef _cplusplus
4 extern "C" {
5 #endif
6 #include "dyna.h"
7 #include "pwmdna.h"
8 #include "genestats.h"
9 
10 typedef struct align_gene_codon {
11 	char seq[3];
12 	double weight;
13 } AlignGeneCodon;
14 
15 
16 struct Wise2_NonCodingSimpleModel {
17     int dynamite_hard_link;
18 #ifdef PTHREAD
19     pthread_mutex_t dynamite_mutex;
20 #endif
21     Probability identical;
22     Probability one_off;
23     Probability two_off;
24     } ;
25 /* NonCodingSimpleModel defined */
26 #ifndef DYNAMITE_DEFINED_NonCodingSimpleModel
27 typedef struct Wise2_NonCodingSimpleModel Wise2_NonCodingSimpleModel;
28 #define NonCodingSimpleModel Wise2_NonCodingSimpleModel
29 #define DYNAMITE_DEFINED_NonCodingSimpleModel
30 #endif
31 
32 
33 struct Wise2_SpliceSiteProb {
34     int dynamite_hard_link;
35 #ifdef PTHREAD
36     pthread_mutex_t dynamite_mutex;
37 #endif
38     pwmDNA * pwm;
39     int offset;
40     } ;
41 /* SpliceSiteProb defined */
42 #ifndef DYNAMITE_DEFINED_SpliceSiteProb
43 typedef struct Wise2_SpliceSiteProb Wise2_SpliceSiteProb;
44 #define SpliceSiteProb Wise2_SpliceSiteProb
45 #define DYNAMITE_DEFINED_SpliceSiteProb
46 #endif
47 
48 
49 struct Wise2_AlignGeneColumnStore {
50     int dynamite_hard_link;
51 #ifdef PTHREAD
52     pthread_mutex_t dynamite_mutex;
53 #endif
54     AlignGeneCodon * codon;
55     int len;
56     } ;
57 /* AlignGeneColumnStore defined */
58 #ifndef DYNAMITE_DEFINED_AlignGeneColumnStore
59 typedef struct Wise2_AlignGeneColumnStore Wise2_AlignGeneColumnStore;
60 #define AlignGeneColumnStore Wise2_AlignGeneColumnStore
61 #define DYNAMITE_DEFINED_AlignGeneColumnStore
62 #endif
63 
64 
65 struct Wise2_AlignGeneModel {
66     int dynamite_hard_link;
67 #ifdef PTHREAD
68     pthread_mutex_t dynamite_mutex;
69 #endif
70     int len;
71     Probability * forward_coding;
72     Probability * reverse_coding;
73     Probability * splice5_forward;
74     Probability * splice3_forward;
75     Probability * splice5_reverse;
76     Probability * splice3_reverse;
77     SeqAlign * align;
78     Sequence * anchor;
79     double   * change_rate;
80     } ;
81 /* AlignGeneModel defined */
82 #ifndef DYNAMITE_DEFINED_AlignGeneModel
83 typedef struct Wise2_AlignGeneModel Wise2_AlignGeneModel;
84 #define AlignGeneModel Wise2_AlignGeneModel
85 #define DYNAMITE_DEFINED_AlignGeneModel
86 #endif
87 
88 
89 struct Wise2_AlignGeneModelScore {
90     int dynamite_hard_link;
91 #ifdef PTHREAD
92     pthread_mutex_t dynamite_mutex;
93 #endif
94     int len;
95     Score * forward_coding;
96     Score * reverse_coding;
97     Score * splice5_forward;
98     Score * splice3_forward;
99     Score * splice5_reverse;
100     Score * splice3_reverse;
101     SeqAlign * align;
102     Sequence * anchor;
103     } ;
104 /* AlignGeneModelScore defined */
105 #ifndef DYNAMITE_DEFINED_AlignGeneModelScore
106 typedef struct Wise2_AlignGeneModelScore Wise2_AlignGeneModelScore;
107 #define AlignGeneModelScore Wise2_AlignGeneModelScore
108 #define DYNAMITE_DEFINED_AlignGeneModelScore
109 #endif
110 
111 
112 struct Wise2_AlignGeneModelParam {
113     int dynamite_hard_link;
114 #ifdef PTHREAD
115     pthread_mutex_t dynamite_mutex;
116 #endif
117     CompProb      * protein;
118     RandomModel   * rm;
119     CodonMapper   * cm;
120     CodonTable    * ct;
121     DnaProbMatrix * dm;
122     SpliceSiteProb  * ss5;
123     SpliceSiteProb  * ss3;
124     GeneStats * gs;
125     Probability   total_weight;
126     boolean       tolerate_nonanchor_stops;
127     Probability nonanchor_stop;
128     NonCodingSimpleModel * ncsm;
129     double coding_window_thres;
130     double noncoding_window_thres;
131     double coding_window_bonus;
132     double noncoding_window_pen;
133     } ;
134 /* AlignGeneModelParam defined */
135 #ifndef DYNAMITE_DEFINED_AlignGeneModelParam
136 typedef struct Wise2_AlignGeneModelParam Wise2_AlignGeneModelParam;
137 #define AlignGeneModelParam Wise2_AlignGeneModelParam
138 #define DYNAMITE_DEFINED_AlignGeneModelParam
139 #endif
140 
141 
142 
143 
144     /***************************************************/
145     /* Callable functions                              */
146     /* These are the functions you are expected to use */
147     /***************************************************/
148 
149 
150 
151 /* Function:  hard_link_NonCodingSimpleModel(obj)
152  *
153  * Descrip:    Bumps up the reference count of the object
154  *             Meaning that multiple pointers can 'own' it
155  *
156  *
157  * Arg:        obj [UNKN ] Object to be hard linked [NonCodingSimpleModel *]
158  *
159  * Return [UNKN ]  Undocumented return value [NonCodingSimpleModel *]
160  *
161  */
162 NonCodingSimpleModel * Wise2_hard_link_NonCodingSimpleModel(NonCodingSimpleModel * obj);
163 #define hard_link_NonCodingSimpleModel Wise2_hard_link_NonCodingSimpleModel
164 
165 
166 /* Function:  NonCodingSimpleModel_alloc(void)
167  *
168  * Descrip:    Allocates structure: assigns defaults if given
169  *
170  *
171  *
172  * Return [UNKN ]  Undocumented return value [NonCodingSimpleModel *]
173  *
174  */
175 NonCodingSimpleModel * Wise2_NonCodingSimpleModel_alloc(void);
176 #define NonCodingSimpleModel_alloc Wise2_NonCodingSimpleModel_alloc
177 
178 
179 /* Function:  free_NonCodingSimpleModel(obj)
180  *
181  * Descrip:    Free Function: removes the memory held by obj
182  *             Will chain up to owned members and clear all lists
183  *
184  *
185  * Arg:        obj [UNKN ] Object that is free'd [NonCodingSimpleModel *]
186  *
187  * Return [UNKN ]  Undocumented return value [NonCodingSimpleModel *]
188  *
189  */
190 NonCodingSimpleModel * Wise2_free_NonCodingSimpleModel(NonCodingSimpleModel * obj);
191 #define free_NonCodingSimpleModel Wise2_free_NonCodingSimpleModel
192 
193 
194 /* Function:  hard_link_SpliceSiteProb(obj)
195  *
196  * Descrip:    Bumps up the reference count of the object
197  *             Meaning that multiple pointers can 'own' it
198  *
199  *
200  * Arg:        obj [UNKN ] Object to be hard linked [SpliceSiteProb *]
201  *
202  * Return [UNKN ]  Undocumented return value [SpliceSiteProb *]
203  *
204  */
205 SpliceSiteProb * Wise2_hard_link_SpliceSiteProb(SpliceSiteProb * obj);
206 #define hard_link_SpliceSiteProb Wise2_hard_link_SpliceSiteProb
207 
208 
209 /* Function:  SpliceSiteProb_alloc(void)
210  *
211  * Descrip:    Allocates structure: assigns defaults if given
212  *
213  *
214  *
215  * Return [UNKN ]  Undocumented return value [SpliceSiteProb *]
216  *
217  */
218 SpliceSiteProb * Wise2_SpliceSiteProb_alloc(void);
219 #define SpliceSiteProb_alloc Wise2_SpliceSiteProb_alloc
220 
221 
222 /* Function:  free_SpliceSiteProb(obj)
223  *
224  * Descrip:    Free Function: removes the memory held by obj
225  *             Will chain up to owned members and clear all lists
226  *
227  *
228  * Arg:        obj [UNKN ] Object that is free'd [SpliceSiteProb *]
229  *
230  * Return [UNKN ]  Undocumented return value [SpliceSiteProb *]
231  *
232  */
233 SpliceSiteProb * Wise2_free_SpliceSiteProb(SpliceSiteProb * obj);
234 #define free_SpliceSiteProb Wise2_free_SpliceSiteProb
235 
236 
237 /* Function:  hard_link_AlignGeneColumnStore(obj)
238  *
239  * Descrip:    Bumps up the reference count of the object
240  *             Meaning that multiple pointers can 'own' it
241  *
242  *
243  * Arg:        obj [UNKN ] Object to be hard linked [AlignGeneColumnStore *]
244  *
245  * Return [UNKN ]  Undocumented return value [AlignGeneColumnStore *]
246  *
247  */
248 AlignGeneColumnStore * Wise2_hard_link_AlignGeneColumnStore(AlignGeneColumnStore * obj);
249 #define hard_link_AlignGeneColumnStore Wise2_hard_link_AlignGeneColumnStore
250 
251 
252 /* Function:  AlignGeneColumnStore_alloc(void)
253  *
254  * Descrip:    Allocates structure: assigns defaults if given
255  *
256  *
257  *
258  * Return [UNKN ]  Undocumented return value [AlignGeneColumnStore *]
259  *
260  */
261 AlignGeneColumnStore * Wise2_AlignGeneColumnStore_alloc(void);
262 #define AlignGeneColumnStore_alloc Wise2_AlignGeneColumnStore_alloc
263 
264 
265 /* Function:  free_AlignGeneColumnStore(obj)
266  *
267  * Descrip:    Free Function: removes the memory held by obj
268  *             Will chain up to owned members and clear all lists
269  *
270  *
271  * Arg:        obj [UNKN ] Object that is free'd [AlignGeneColumnStore *]
272  *
273  * Return [UNKN ]  Undocumented return value [AlignGeneColumnStore *]
274  *
275  */
276 AlignGeneColumnStore * Wise2_free_AlignGeneColumnStore(AlignGeneColumnStore * obj);
277 #define free_AlignGeneColumnStore Wise2_free_AlignGeneColumnStore
278 
279 
280 /* Function:  hard_link_AlignGeneModel(obj)
281  *
282  * Descrip:    Bumps up the reference count of the object
283  *             Meaning that multiple pointers can 'own' it
284  *
285  *
286  * Arg:        obj [UNKN ] Object to be hard linked [AlignGeneModel *]
287  *
288  * Return [UNKN ]  Undocumented return value [AlignGeneModel *]
289  *
290  */
291 AlignGeneModel * Wise2_hard_link_AlignGeneModel(AlignGeneModel * obj);
292 #define hard_link_AlignGeneModel Wise2_hard_link_AlignGeneModel
293 
294 
295 /* Function:  AlignGeneModel_alloc(void)
296  *
297  * Descrip:    Allocates structure: assigns defaults if given
298  *
299  *
300  *
301  * Return [UNKN ]  Undocumented return value [AlignGeneModel *]
302  *
303  */
304 AlignGeneModel * Wise2_AlignGeneModel_alloc(void);
305 #define AlignGeneModel_alloc Wise2_AlignGeneModel_alloc
306 
307 
308 /* Function:  free_AlignGeneModel(obj)
309  *
310  * Descrip:    Free Function: removes the memory held by obj
311  *             Will chain up to owned members and clear all lists
312  *
313  *
314  * Arg:        obj [UNKN ] Object that is free'd [AlignGeneModel *]
315  *
316  * Return [UNKN ]  Undocumented return value [AlignGeneModel *]
317  *
318  */
319 AlignGeneModel * Wise2_free_AlignGeneModel(AlignGeneModel * obj);
320 #define free_AlignGeneModel Wise2_free_AlignGeneModel
321 
322 
323 /* Function:  hard_link_AlignGeneModelScore(obj)
324  *
325  * Descrip:    Bumps up the reference count of the object
326  *             Meaning that multiple pointers can 'own' it
327  *
328  *
329  * Arg:        obj [UNKN ] Object to be hard linked [AlignGeneModelScore *]
330  *
331  * Return [UNKN ]  Undocumented return value [AlignGeneModelScore *]
332  *
333  */
334 AlignGeneModelScore * Wise2_hard_link_AlignGeneModelScore(AlignGeneModelScore * obj);
335 #define hard_link_AlignGeneModelScore Wise2_hard_link_AlignGeneModelScore
336 
337 
338 /* Function:  AlignGeneModelScore_alloc(void)
339  *
340  * Descrip:    Allocates structure: assigns defaults if given
341  *
342  *
343  *
344  * Return [UNKN ]  Undocumented return value [AlignGeneModelScore *]
345  *
346  */
347 AlignGeneModelScore * Wise2_AlignGeneModelScore_alloc(void);
348 #define AlignGeneModelScore_alloc Wise2_AlignGeneModelScore_alloc
349 
350 
351 /* Function:  free_AlignGeneModelScore(obj)
352  *
353  * Descrip:    Free Function: removes the memory held by obj
354  *             Will chain up to owned members and clear all lists
355  *
356  *
357  * Arg:        obj [UNKN ] Object that is free'd [AlignGeneModelScore *]
358  *
359  * Return [UNKN ]  Undocumented return value [AlignGeneModelScore *]
360  *
361  */
362 AlignGeneModelScore * Wise2_free_AlignGeneModelScore(AlignGeneModelScore * obj);
363 #define free_AlignGeneModelScore Wise2_free_AlignGeneModelScore
364 
365 
366 /* Function:  hard_link_AlignGeneModelParam(obj)
367  *
368  * Descrip:    Bumps up the reference count of the object
369  *             Meaning that multiple pointers can 'own' it
370  *
371  *
372  * Arg:        obj [UNKN ] Object to be hard linked [AlignGeneModelParam *]
373  *
374  * Return [UNKN ]  Undocumented return value [AlignGeneModelParam *]
375  *
376  */
377 AlignGeneModelParam * Wise2_hard_link_AlignGeneModelParam(AlignGeneModelParam * obj);
378 #define hard_link_AlignGeneModelParam Wise2_hard_link_AlignGeneModelParam
379 
380 
381 /* Function:  AlignGeneModelParam_alloc(void)
382  *
383  * Descrip:    Allocates structure: assigns defaults if given
384  *
385  *
386  *
387  * Return [UNKN ]  Undocumented return value [AlignGeneModelParam *]
388  *
389  */
390 AlignGeneModelParam * Wise2_AlignGeneModelParam_alloc(void);
391 #define AlignGeneModelParam_alloc Wise2_AlignGeneModelParam_alloc
392 
393 
394 /* Function:  free_AlignGeneModelParam(obj)
395  *
396  * Descrip:    Free Function: removes the memory held by obj
397  *             Will chain up to owned members and clear all lists
398  *
399  *
400  * Arg:        obj [UNKN ] Object that is free'd [AlignGeneModelParam *]
401  *
402  * Return [UNKN ]  Undocumented return value [AlignGeneModelParam *]
403  *
404  */
405 AlignGeneModelParam * Wise2_free_AlignGeneModelParam(AlignGeneModelParam * obj);
406 #define free_AlignGeneModelParam Wise2_free_AlignGeneModelParam
407 
408 
409   /* Unplaced functions */
410   /* There has been no indication of the use of these functions */
411 Probability Wise2_weighted_coding_AlignGeneColumn(AlignGeneColumnStore * store,AlignGeneModelParam * agmp);
412 #define weighted_coding_AlignGeneColumn Wise2_weighted_coding_AlignGeneColumn
413 void Wise2_window_AlignGeneModel(SeqAlign * sal,AlignGeneModel * agm,AlignGeneModelParam * agmp);
414 #define window_AlignGeneModel Wise2_window_AlignGeneModel
415 NonCodingSimpleModel * Wise2_create_NonCodingSimpleModel(Probability change);
416 #define create_NonCodingSimpleModel Wise2_create_NonCodingSimpleModel
417 Probability Wise2_simple_non_coding_AlignGeneColumn(AlignGeneColumnStore * store,AlignGeneModelParam * agmp);
418 #define simple_non_coding_AlignGeneColumn Wise2_simple_non_coding_AlignGeneColumn
419 Probability Wise2_weighted_non_coding_AlignGeneColumn(AlignGeneColumnStore * store,AlignGeneModelParam * agmp);
420 #define weighted_non_coding_AlignGeneColumn Wise2_weighted_non_coding_AlignGeneColumn
421 Probability Wise2_weighted_simple_non_coding_AlignGeneColumn(AlignGeneColumnStore * store,AlignGeneModelParam * agmp);
422 #define weighted_simple_non_coding_AlignGeneColumn Wise2_weighted_simple_non_coding_AlignGeneColumn
423 Probability Wise2_simple_coding_AlignGeneColumn(AlignGeneColumnStore * store,AlignGeneModelParam * agmp);
424 #define simple_coding_AlignGeneColumn Wise2_simple_coding_AlignGeneColumn
425 boolean Wise2_fill_reverse_AlignGeneColumn(AlignGeneColumnStore * store,SeqAlign * sa,int forward_codon_end);
426 #define fill_reverse_AlignGeneColumn Wise2_fill_reverse_AlignGeneColumn
427 boolean Wise2_fill_forward_AlignGeneColumn(AlignGeneColumnStore * store,SeqAlign * sa,int codon_end);
428 #define fill_forward_AlignGeneColumn Wise2_fill_forward_AlignGeneColumn
429 AlignGeneColumnStore * Wise2_new_empty_AlignGeneColumnStore(int len);
430 #define new_empty_AlignGeneColumnStore Wise2_new_empty_AlignGeneColumnStore
431 AlignGeneCodon * Wise2_free_AlignGeneCodon(AlignGeneCodon * c);
432 #define free_AlignGeneCodon Wise2_free_AlignGeneCodon
433 AlignGeneModel * Wise2_new_AlignGeneModel(int len);
434 #define new_AlignGeneModel Wise2_new_AlignGeneModel
435 void Wise2_show_AlignGeneModel(AlignGeneModel * agm,SeqAlign * sal,CodonTable * ct,GenomicRegion * gr,FILE * ofp,AlignGeneModelParam * agmp);
436 #define show_AlignGeneModel Wise2_show_AlignGeneModel
437 AlignGeneModel * Wise2_create_AlignGeneModel(SeqAlign * sal,AlignGeneModelParam * agmp);
438 #define create_AlignGeneModel Wise2_create_AlignGeneModel
439 Probability Wise2_prob_SpliceSiteProb(SpliceSiteProb * ssp,Sequence * seq,int pos);
440 #define prob_SpliceSiteProb Wise2_prob_SpliceSiteProb
441 Probability Wise2_non_coding_probability_AlignGeneModel(SeqAlign * sal,int codon_end_pos,AlignGeneModelParam * agmp);
442 #define non_coding_probability_AlignGeneModel Wise2_non_coding_probability_AlignGeneModel
443 Probability Wise2_coding_probability_AlignGeneModel(SeqAlign * sal,int codon_end_pos,AlignGeneModelParam * agmp);
444 #define coding_probability_AlignGeneModel Wise2_coding_probability_AlignGeneModel
445 AlignGeneModelParam * Wise2_new_AlignGeneModelParam_from_argv(int * argc,char ** argv);
446 #define new_AlignGeneModelParam_from_argv Wise2_new_AlignGeneModelParam_from_argv
447 void Wise2_show_help_AlignGeneModelParam(FILE * ofp);
448 #define show_help_AlignGeneModelParam Wise2_show_help_AlignGeneModelParam
449 AlignGeneModelParam * Wise2_std_AlignGeneModelParam(CompProb * cp,DnaProbMatrix * dm,CodonTable * ct,GeneStats * gs,Probability change);
450 #define std_AlignGeneModelParam Wise2_std_AlignGeneModelParam
451 AlignGeneModelScore * Wise2_AlignGeneModelScore_from_AlignGeneModel(AlignGeneModel * agm);
452 #define AlignGeneModelScore_from_AlignGeneModel Wise2_AlignGeneModelScore_from_AlignGeneModel
453 Probability * Wise2_free_Probability(Probability * p);
454 #define free_Probability Wise2_free_Probability
455 Score * Wise2_free_Score(Score * p);
456 #define free_Score Wise2_free_Score
457 
458 
459     /***************************************************/
460     /* Internal functions                              */
461     /* you are not expected to have to call these      */
462     /***************************************************/
463 
464 #ifdef _cplusplus
465 }
466 #endif
467 
468 #endif
469