1 #ifndef DYNAMITEgwlitemodelHEADERFILE 2 #define DYNAMITEgwlitemodelHEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 #include "dyna.h" 7 #include "genewisemodel.h" 8 9 #define GwLiteScoreLISTLENGTH 128 10 #define GwLiteLISTLENGTH 128 11 12 13 enum GwLiteTransition { 14 GWL_MATCH2MATCH, 15 GWL_MATCH2INSERT, 16 GWL_MATCH2DELETE, 17 GWL_MATCH2END, 18 GWL_INSERT2MATCH, 19 GWL_INSERT2INSERT, 20 GWL_INSERT2DELETE, 21 GWL_INSERT2END, 22 GWL_DELETE2MATCH, 23 GWL_DELETE2INSERT, 24 GWL_DELETE2DELETE, 25 GWL_DELETE2END, 26 GWL_START2MATCH, 27 GWL_START2INSERT, 28 GWL_START2DELETE, 29 GWL_TRANSITION_LEN 30 }; 31 32 #define GWL_EMISSION_LEN 65 33 34 /* Object GwLiteSegment 35 * 36 * Descrip: This is a particular HMM node, with 37 * match and insert emissions in the codon space 38 * and the transitions for the genewise light model 39 * 40 * 41 */ 42 struct Wise2_GwLiteSegment { 43 int dynamite_hard_link; 44 #ifdef PTHREAD 45 pthread_mutex_t dynamite_mutex; 46 #endif 47 Probability match[GWL_EMISSION_LEN]; 48 Probability insert[GWL_EMISSION_LEN]; 49 Probability transition[GWL_TRANSITION_LEN]; 50 } ; 51 /* GwLiteSegment defined */ 52 #ifndef DYNAMITE_DEFINED_GwLiteSegment 53 typedef struct Wise2_GwLiteSegment Wise2_GwLiteSegment; 54 #define GwLiteSegment Wise2_GwLiteSegment 55 #define DYNAMITE_DEFINED_GwLiteSegment 56 #endif 57 58 59 /* Object GwLite 60 * 61 * Descrip: This is the lightweight version 62 * of GeneWise designed for faster executation 63 * and better portability to hardware environments 64 * 65 * 66 */ 67 struct Wise2_GwLite { 68 int dynamite_hard_link; 69 #ifdef PTHREAD 70 pthread_mutex_t dynamite_mutex; 71 #endif 72 GwLiteSegment ** seg; 73 int len;/* len for above seg */ 74 int maxlen; /* maxlen for above seg */ 75 char * name; 76 } ; 77 /* GwLite defined */ 78 #ifndef DYNAMITE_DEFINED_GwLite 79 typedef struct Wise2_GwLite Wise2_GwLite; 80 #define GwLite Wise2_GwLite 81 #define DYNAMITE_DEFINED_GwLite 82 #endif 83 84 85 /* Object GwLiteSegmentScore 86 * 87 * Descrip: This is the genewise lite scoring 88 * data structure 89 * 90 * 91 */ 92 struct Wise2_GwLiteSegmentScore { 93 int dynamite_hard_link; 94 #ifdef PTHREAD 95 pthread_mutex_t dynamite_mutex; 96 #endif 97 Score match[GWL_EMISSION_LEN]; 98 Score insert[GWL_EMISSION_LEN]; 99 Score transition[GWL_TRANSITION_LEN]; 100 } ; 101 /* GwLiteSegmentScore defined */ 102 #ifndef DYNAMITE_DEFINED_GwLiteSegmentScore 103 typedef struct Wise2_GwLiteSegmentScore Wise2_GwLiteSegmentScore; 104 #define GwLiteSegmentScore Wise2_GwLiteSegmentScore 105 #define DYNAMITE_DEFINED_GwLiteSegmentScore 106 #endif 107 108 109 /* Object GwLiteScore 110 * 111 * Descrip: This is the lightweight version 112 * of GeneWise designed for faster executation 113 * and better portability to hardware environments 114 * 115 * 116 */ 117 struct Wise2_GwLiteScore { 118 int dynamite_hard_link; 119 #ifdef PTHREAD 120 pthread_mutex_t dynamite_mutex; 121 #endif 122 GwLiteSegmentScore ** seg; 123 int len;/* len for above seg */ 124 int maxlen; /* maxlen for above seg */ 125 char * name; 126 } ; 127 /* GwLiteScore defined */ 128 #ifndef DYNAMITE_DEFINED_GwLiteScore 129 typedef struct Wise2_GwLiteScore Wise2_GwLiteScore; 130 #define GwLiteScore Wise2_GwLiteScore 131 #define DYNAMITE_DEFINED_GwLiteScore 132 #endif 133 134 135 136 137 /***************************************************/ 138 /* Callable functions */ 139 /* These are the functions you are expected to use */ 140 /***************************************************/ 141 142 143 144 /* Function: GwLite_AlnBlock_surgery(alb) 145 * 146 * Descrip: A pretty weird function. Takes an AlnBlock made by GwLite and 147 * performs the necessary surgery at the 3SS to make it look like 148 * the AlnBlocks produced by the other genewise models. This means 149 * it has to eat into the intron by 3 residues 150 * 151 * 152 * Arg: alb [UNKN ] Undocumented argument [AlnBlock *] 153 * 154 */ 155 void Wise2_GwLite_AlnBlock_surgery(AlnBlock * alb); 156 #define GwLite_AlnBlock_surgery Wise2_GwLite_AlnBlock_surgery 157 158 159 /* Function: GwLite_from_GeneWise(gwm) 160 * 161 * Descrip: Builds a GwLite model from the GeneWise model 162 * 163 * 164 * Arg: gwm [UNKN ] Undocumented argument [GeneWise *] 165 * 166 * Return [UNKN ] Undocumented return value [GwLite *] 167 * 168 */ 169 GwLite * Wise2_GwLite_from_GeneWise(GeneWise * gwm); 170 #define GwLite_from_GeneWise Wise2_GwLite_from_GeneWise 171 172 173 /* Function: GwLiteScore_from_GwLite(gwl) 174 * 175 * Descrip: Makes a lite score from a lite probability basis 176 * 177 * 178 * Arg: gwl [UNKN ] Undocumented argument [GwLite *] 179 * 180 * Return [UNKN ] Undocumented return value [GwLiteScore *] 181 * 182 */ 183 GwLiteScore * Wise2_GwLiteScore_from_GwLite(GwLite * gwl); 184 #define GwLiteScore_from_GwLite Wise2_GwLiteScore_from_GwLite 185 186 187 /* Function: hard_link_GwLiteSegment(obj) 188 * 189 * Descrip: Bumps up the reference count of the object 190 * Meaning that multiple pointers can 'own' it 191 * 192 * 193 * Arg: obj [UNKN ] Object to be hard linked [GwLiteSegment *] 194 * 195 * Return [UNKN ] Undocumented return value [GwLiteSegment *] 196 * 197 */ 198 GwLiteSegment * Wise2_hard_link_GwLiteSegment(GwLiteSegment * obj); 199 #define hard_link_GwLiteSegment Wise2_hard_link_GwLiteSegment 200 201 202 /* Function: GwLiteSegment_alloc(void) 203 * 204 * Descrip: Allocates structure: assigns defaults if given 205 * 206 * 207 * 208 * Return [UNKN ] Undocumented return value [GwLiteSegment *] 209 * 210 */ 211 GwLiteSegment * Wise2_GwLiteSegment_alloc(void); 212 #define GwLiteSegment_alloc Wise2_GwLiteSegment_alloc 213 214 215 /* Function: free_GwLiteSegment(obj) 216 * 217 * Descrip: Free Function: removes the memory held by obj 218 * Will chain up to owned members and clear all lists 219 * 220 * 221 * Arg: obj [UNKN ] Object that is free'd [GwLiteSegment *] 222 * 223 * Return [UNKN ] Undocumented return value [GwLiteSegment *] 224 * 225 */ 226 GwLiteSegment * Wise2_free_GwLiteSegment(GwLiteSegment * obj); 227 #define free_GwLiteSegment Wise2_free_GwLiteSegment 228 229 230 /* Function: add_GwLite(obj,add) 231 * 232 * Descrip: Adds another object to the list. It will expand the list if necessary 233 * 234 * 235 * Arg: obj [UNKN ] Object which contains the list [GwLite *] 236 * Arg: add [OWNER] Object to add to the list [GwLiteSegment *] 237 * 238 * Return [UNKN ] Undocumented return value [boolean] 239 * 240 */ 241 boolean Wise2_add_GwLite(GwLite * obj,GwLiteSegment * add); 242 #define add_GwLite Wise2_add_GwLite 243 244 245 /* Function: flush_GwLite(obj) 246 * 247 * Descrip: Frees the list elements, sets length to 0 248 * If you want to save some elements, use hard_link_xxx 249 * to protect them from being actually destroyed in the free 250 * 251 * 252 * Arg: obj [UNKN ] Object which contains the list [GwLite *] 253 * 254 * Return [UNKN ] Undocumented return value [int] 255 * 256 */ 257 int Wise2_flush_GwLite(GwLite * obj); 258 #define flush_GwLite Wise2_flush_GwLite 259 260 261 /* Function: GwLite_alloc_std(void) 262 * 263 * Descrip: Equivalent to GwLite_alloc_len(GwLiteLISTLENGTH) 264 * 265 * 266 * 267 * Return [UNKN ] Undocumented return value [GwLite *] 268 * 269 */ 270 GwLite * Wise2_GwLite_alloc_std(void); 271 #define GwLite_alloc_std Wise2_GwLite_alloc_std 272 273 274 /* Function: GwLite_alloc_len(len) 275 * 276 * Descrip: Allocates len length to all lists 277 * 278 * 279 * Arg: len [UNKN ] Length of lists to allocate [int] 280 * 281 * Return [UNKN ] Undocumented return value [GwLite *] 282 * 283 */ 284 GwLite * Wise2_GwLite_alloc_len(int len); 285 #define GwLite_alloc_len Wise2_GwLite_alloc_len 286 287 288 /* Function: hard_link_GwLite(obj) 289 * 290 * Descrip: Bumps up the reference count of the object 291 * Meaning that multiple pointers can 'own' it 292 * 293 * 294 * Arg: obj [UNKN ] Object to be hard linked [GwLite *] 295 * 296 * Return [UNKN ] Undocumented return value [GwLite *] 297 * 298 */ 299 GwLite * Wise2_hard_link_GwLite(GwLite * obj); 300 #define hard_link_GwLite Wise2_hard_link_GwLite 301 302 303 /* Function: GwLite_alloc(void) 304 * 305 * Descrip: Allocates structure: assigns defaults if given 306 * 307 * 308 * 309 * Return [UNKN ] Undocumented return value [GwLite *] 310 * 311 */ 312 GwLite * Wise2_GwLite_alloc(void); 313 #define GwLite_alloc Wise2_GwLite_alloc 314 315 316 /* Function: free_GwLite(obj) 317 * 318 * Descrip: Free Function: removes the memory held by obj 319 * Will chain up to owned members and clear all lists 320 * 321 * 322 * Arg: obj [UNKN ] Object that is free'd [GwLite *] 323 * 324 * Return [UNKN ] Undocumented return value [GwLite *] 325 * 326 */ 327 GwLite * Wise2_free_GwLite(GwLite * obj); 328 #define free_GwLite Wise2_free_GwLite 329 330 331 /* Function: hard_link_GwLiteSegmentScore(obj) 332 * 333 * Descrip: Bumps up the reference count of the object 334 * Meaning that multiple pointers can 'own' it 335 * 336 * 337 * Arg: obj [UNKN ] Object to be hard linked [GwLiteSegmentScore *] 338 * 339 * Return [UNKN ] Undocumented return value [GwLiteSegmentScore *] 340 * 341 */ 342 GwLiteSegmentScore * Wise2_hard_link_GwLiteSegmentScore(GwLiteSegmentScore * obj); 343 #define hard_link_GwLiteSegmentScore Wise2_hard_link_GwLiteSegmentScore 344 345 346 /* Function: GwLiteSegmentScore_alloc(void) 347 * 348 * Descrip: Allocates structure: assigns defaults if given 349 * 350 * 351 * 352 * Return [UNKN ] Undocumented return value [GwLiteSegmentScore *] 353 * 354 */ 355 GwLiteSegmentScore * Wise2_GwLiteSegmentScore_alloc(void); 356 #define GwLiteSegmentScore_alloc Wise2_GwLiteSegmentScore_alloc 357 358 359 /* Function: free_GwLiteSegmentScore(obj) 360 * 361 * Descrip: Free Function: removes the memory held by obj 362 * Will chain up to owned members and clear all lists 363 * 364 * 365 * Arg: obj [UNKN ] Object that is free'd [GwLiteSegmentScore *] 366 * 367 * Return [UNKN ] Undocumented return value [GwLiteSegmentScore *] 368 * 369 */ 370 GwLiteSegmentScore * Wise2_free_GwLiteSegmentScore(GwLiteSegmentScore * obj); 371 #define free_GwLiteSegmentScore Wise2_free_GwLiteSegmentScore 372 373 374 /* Function: add_GwLiteScore(obj,add) 375 * 376 * Descrip: Adds another object to the list. It will expand the list if necessary 377 * 378 * 379 * Arg: obj [UNKN ] Object which contains the list [GwLiteScore *] 380 * Arg: add [OWNER] Object to add to the list [GwLiteSegmentScore *] 381 * 382 * Return [UNKN ] Undocumented return value [boolean] 383 * 384 */ 385 boolean Wise2_add_GwLiteScore(GwLiteScore * obj,GwLiteSegmentScore * add); 386 #define add_GwLiteScore Wise2_add_GwLiteScore 387 388 389 /* Function: flush_GwLiteScore(obj) 390 * 391 * Descrip: Frees the list elements, sets length to 0 392 * If you want to save some elements, use hard_link_xxx 393 * to protect them from being actually destroyed in the free 394 * 395 * 396 * Arg: obj [UNKN ] Object which contains the list [GwLiteScore *] 397 * 398 * Return [UNKN ] Undocumented return value [int] 399 * 400 */ 401 int Wise2_flush_GwLiteScore(GwLiteScore * obj); 402 #define flush_GwLiteScore Wise2_flush_GwLiteScore 403 404 405 /* Function: GwLiteScore_alloc_std(void) 406 * 407 * Descrip: Equivalent to GwLiteScore_alloc_len(GwLiteScoreLISTLENGTH) 408 * 409 * 410 * 411 * Return [UNKN ] Undocumented return value [GwLiteScore *] 412 * 413 */ 414 GwLiteScore * Wise2_GwLiteScore_alloc_std(void); 415 #define GwLiteScore_alloc_std Wise2_GwLiteScore_alloc_std 416 417 418 /* Function: GwLiteScore_alloc_len(len) 419 * 420 * Descrip: Allocates len length to all lists 421 * 422 * 423 * Arg: len [UNKN ] Length of lists to allocate [int] 424 * 425 * Return [UNKN ] Undocumented return value [GwLiteScore *] 426 * 427 */ 428 GwLiteScore * Wise2_GwLiteScore_alloc_len(int len); 429 #define GwLiteScore_alloc_len Wise2_GwLiteScore_alloc_len 430 431 432 /* Function: hard_link_GwLiteScore(obj) 433 * 434 * Descrip: Bumps up the reference count of the object 435 * Meaning that multiple pointers can 'own' it 436 * 437 * 438 * Arg: obj [UNKN ] Object to be hard linked [GwLiteScore *] 439 * 440 * Return [UNKN ] Undocumented return value [GwLiteScore *] 441 * 442 */ 443 GwLiteScore * Wise2_hard_link_GwLiteScore(GwLiteScore * obj); 444 #define hard_link_GwLiteScore Wise2_hard_link_GwLiteScore 445 446 447 /* Function: GwLiteScore_alloc(void) 448 * 449 * Descrip: Allocates structure: assigns defaults if given 450 * 451 * 452 * 453 * Return [UNKN ] Undocumented return value [GwLiteScore *] 454 * 455 */ 456 GwLiteScore * Wise2_GwLiteScore_alloc(void); 457 #define GwLiteScore_alloc Wise2_GwLiteScore_alloc 458 459 460 /* Function: free_GwLiteScore(obj) 461 * 462 * Descrip: Free Function: removes the memory held by obj 463 * Will chain up to owned members and clear all lists 464 * 465 * 466 * Arg: obj [UNKN ] Object that is free'd [GwLiteScore *] 467 * 468 * Return [UNKN ] Undocumented return value [GwLiteScore *] 469 * 470 */ 471 GwLiteScore * Wise2_free_GwLiteScore(GwLiteScore * obj); 472 #define free_GwLiteScore Wise2_free_GwLiteScore 473 474 475 /* Unplaced functions */ 476 /* There has been no indication of the use of these functions */ 477 GwLiteSegmentScore * Wise2_GwLiteSegmentScore_from_GwLiteSegment(GwLiteSegment *prev,GwLiteSegment * seg); 478 #define GwLiteSegmentScore_from_GwLiteSegment Wise2_GwLiteSegmentScore_from_GwLiteSegment 479 480 481 /***************************************************/ 482 /* Internal functions */ 483 /* you are not expected to have to call these */ 484 /***************************************************/ 485 void Wise2_swap_GwLite(GwLiteSegment ** list,int i,int j) ; 486 #define swap_GwLite Wise2_swap_GwLite 487 void Wise2_qsort_GwLite(GwLiteSegment ** list,int left,int right,int (*comp)(GwLiteSegment * ,GwLiteSegment * )); 488 #define qsort_GwLite Wise2_qsort_GwLite 489 void Wise2_sort_GwLite(GwLite * obj,int (*comp)(GwLiteSegment *, GwLiteSegment *)); 490 #define sort_GwLite Wise2_sort_GwLite 491 boolean Wise2_expand_GwLite(GwLite * obj,int len); 492 #define expand_GwLite Wise2_expand_GwLite 493 void Wise2_swap_GwLiteScore(GwLiteSegmentScore ** list,int i,int j) ; 494 #define swap_GwLiteScore Wise2_swap_GwLiteScore 495 void Wise2_qsort_GwLiteScore(GwLiteSegmentScore ** list,int left,int right,int (*comp)(GwLiteSegmentScore * ,GwLiteSegmentScore * )); 496 #define qsort_GwLiteScore Wise2_qsort_GwLiteScore 497 void Wise2_sort_GwLiteScore(GwLiteScore * obj,int (*comp)(GwLiteSegmentScore *, GwLiteSegmentScore *)); 498 #define sort_GwLiteScore Wise2_sort_GwLiteScore 499 boolean Wise2_expand_GwLiteScore(GwLiteScore * obj,int len); 500 #define expand_GwLiteScore Wise2_expand_GwLiteScore 501 502 #ifdef _cplusplus 503 } 504 #endif 505 506 #endif 507