1 #ifndef DYNAMITEgenewisemodelHEADERFILE 2 #define DYNAMITEgenewisemodelHEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 #include "geneparser21.h" 7 #include "geneparameter.h" 8 #include "threestatemodel.h" 9 #include "codonmapper.h" 10 #include "cdparser.h" 11 #include "genefrequency.h" 12 #include "geneutil.h" 13 14 #define GeneWiseScoreLISTLENGTH 128 15 #define GeneWiseLISTLENGTH 128 16 #define MAX_PROTEIN_GENEWISE 4096 17 18 enum GeneWiseTransition { 19 GW_MATCH2MATCH, 20 GW_MATCH2INSERT, 21 GW_MATCH2DELETE, 22 GW_MATCH2END, 23 GW_INSERT2MATCH, 24 GW_INSERT2INSERT, 25 GW_INSERT2DELETE, 26 GW_INSERT2END, 27 GW_DELETE2MATCH, 28 GW_DELETE2INSERT, 29 GW_DELETE2DELETE, 30 GW_DELETE2END, 31 GW_START2MATCH, 32 GW_START2INSERT, 33 GW_START2DELETE, 34 GW_MATCH_BALANCE_5SS, 35 GW_INSERT_BALANCE_5SS, 36 GW_MATCH_BALANCE_3SS, 37 GW_INSERT_BALANCE_3SS, 38 GW_TRANSITION_LEN 39 }; 40 41 #define GW_EMISSION_LEN 126 42 43 44 45 46 /* Object GeneWiseSegment 47 * 48 * Descrip: This is a particular HMM node, with 49 * match and insert emissions in the codon space 50 * and the transitions 51 * 52 * intron/frameshifting transitions are stored 53 * in a different datastructure, as they are 54 * not position dependent 55 * 56 * 57 */ 58 struct Wise2_GeneWiseSegment { 59 int dynamite_hard_link; 60 #ifdef PTHREAD 61 pthread_mutex_t dynamite_mutex; 62 #endif 63 Probability match[GW_EMISSION_LEN]; 64 Probability insert[GW_EMISSION_LEN]; 65 Probability transition[GW_TRANSITION_LEN]; 66 } ; 67 /* GeneWiseSegment defined */ 68 #ifndef DYNAMITE_DEFINED_GeneWiseSegment 69 typedef struct Wise2_GeneWiseSegment Wise2_GeneWiseSegment; 70 #define GeneWiseSegment Wise2_GeneWiseSegment 71 #define DYNAMITE_DEFINED_GeneWiseSegment 72 #endif 73 74 75 /* Object GeneWise 76 * 77 * Descrip: This is an expand HMM for codon 78 * matching, suitable for genewise and 79 * estwise type algorithms. It is simple 80 * a list of nodes 81 * 82 * 83 */ 84 struct Wise2_GeneWise { 85 int dynamite_hard_link; 86 #ifdef PTHREAD 87 pthread_mutex_t dynamite_mutex; 88 #endif 89 GeneWiseSegment ** seg; 90 int len;/* len for above seg */ 91 int maxlen; /* maxlen for above seg */ 92 char * name; 93 } ; 94 /* GeneWise defined */ 95 #ifndef DYNAMITE_DEFINED_GeneWise 96 typedef struct Wise2_GeneWise Wise2_GeneWise; 97 #define GeneWise Wise2_GeneWise 98 #define DYNAMITE_DEFINED_GeneWise 99 #endif 100 101 102 /* Object GeneWiseScoreSegment 103 * 104 * Descrip: This is the log space equivalent 105 * of GeneWiseSegment 106 * 107 * 108 */ 109 struct Wise2_GeneWiseScoreSegment { 110 int dynamite_hard_link; 111 #ifdef PTHREAD 112 pthread_mutex_t dynamite_mutex; 113 #endif 114 Score match[GW_EMISSION_LEN]; 115 Score insert[GW_EMISSION_LEN]; 116 Score transition[GW_TRANSITION_LEN]; 117 } ; 118 /* GeneWiseScoreSegment defined */ 119 #ifndef DYNAMITE_DEFINED_GeneWiseScoreSegment 120 typedef struct Wise2_GeneWiseScoreSegment Wise2_GeneWiseScoreSegment; 121 #define GeneWiseScoreSegment Wise2_GeneWiseScoreSegment 122 #define DYNAMITE_DEFINED_GeneWiseScoreSegment 123 #endif 124 125 126 /* Object GeneWiseScore 127 * 128 * Descrip: This is the log space equivalent 129 * of the GeneWise 130 * 131 * 132 */ 133 struct Wise2_GeneWiseScore { 134 int dynamite_hard_link; 135 #ifdef PTHREAD 136 pthread_mutex_t dynamite_mutex; 137 #endif 138 GeneWiseScoreSegment ** seg; 139 int len;/* len for above seg */ 140 int maxlen; /* maxlen for above seg */ 141 char * name; 142 } ; 143 /* GeneWiseScore defined */ 144 #ifndef DYNAMITE_DEFINED_GeneWiseScore 145 typedef struct Wise2_GeneWiseScore Wise2_GeneWiseScore; 146 #define GeneWiseScore Wise2_GeneWiseScore 147 #define DYNAMITE_DEFINED_GeneWiseScore 148 #endif 149 150 151 /* Object GeneWiseScoreFlat 152 * 153 * Descrip: This is a specialised datastructure 154 * which is equivalent to the GeneWiseScore 155 * object, but layed out more efficiently 156 * for memory lookup. The actual code is 157 * usually 10% faster. If you have a really 158 * large model however it might barf! 159 * 160 * 161 */ 162 struct Wise2_GeneWiseScoreFlat { 163 int dynamite_hard_link; 164 #ifdef PTHREAD 165 pthread_mutex_t dynamite_mutex; 166 #endif 167 GeneWiseScoreSegment * seg; 168 int len; 169 } ; 170 /* GeneWiseScoreFlat defined */ 171 #ifndef DYNAMITE_DEFINED_GeneWiseScoreFlat 172 typedef struct Wise2_GeneWiseScoreFlat Wise2_GeneWiseScoreFlat; 173 #define GeneWiseScoreFlat Wise2_GeneWiseScoreFlat 174 #define DYNAMITE_DEFINED_GeneWiseScoreFlat 175 #endif 176 177 178 179 180 /***************************************************/ 181 /* Callable functions */ 182 /* These are the functions you are expected to use */ 183 /***************************************************/ 184 185 186 187 /* Function: pack_GeneWiseScore(gws) 188 * 189 * Descrip: Packing up the GeneWise model into a byte structure 190 * 191 * 192 * Arg: gws [UNKN ] Undocumented argument [GeneWiseScore *] 193 * 194 * Return [UNKN ] Undocumented return value [char *] 195 * 196 */ 197 char * Wise2_pack_GeneWiseScore(GeneWiseScore * gws); 198 #define pack_GeneWiseScore Wise2_pack_GeneWiseScore 199 200 201 /* Function: GeneWiseScoreFlat_from_GeneWiseScore(gws) 202 * 203 * Descrip: This produces a flattened GeneWiseSegment structure 204 * for use in quick implementations (memory lookup 205 * is much better due to everything being a single 206 * piece of memory). 207 * 208 * 209 * Arg: gws [UNKN ] Undocumented argument [GeneWiseScore *] 210 * 211 * Return [UNKN ] Undocumented return value [GeneWiseScoreFlat *] 212 * 213 */ 214 GeneWiseScoreFlat * Wise2_GeneWiseScoreFlat_from_GeneWiseScore(GeneWiseScore * gws); 215 #define GeneWiseScoreFlat_from_GeneWiseScore Wise2_GeneWiseScoreFlat_from_GeneWiseScore 216 217 218 /* Function: free_GeneWiseScoreFlat(obj) 219 * 220 * Descrip: Frees the GeneWiseScoreFlat datastructure 221 * 222 * overrides the usual deconstructor 223 * 224 * 225 * Arg: obj [UNKN ] Undocumented argument [GeneWiseScoreFlat *] 226 * 227 * Return [UNKN ] Undocumented return value [GeneWiseScoreFlat *] 228 * 229 */ 230 GeneWiseScoreFlat * Wise2_free_GeneWiseScoreFlat(GeneWiseScoreFlat * obj); 231 #define free_GeneWiseScoreFlat Wise2_free_GeneWiseScoreFlat 232 233 234 /* Function: map_phase0_codons_AlnBlock_GeneWise(alb,gws,cseq) 235 * 236 * Descrip: This function does something very 237 * sinister. 238 * 239 * It maps the phase 0 introns which 240 * have three base pairs added on the 241 * end. 242 * 243 * It actually changes the AlnBlock structure 244 * 245 * 246 * Arg: alb [UNKN ] Undocumented argument [AlnBlock *] 247 * Arg: gws [UNKN ] Undocumented argument [GeneWiseScore *] 248 * Arg: cseq [UNKN ] Undocumented argument [ComplexSequence *] 249 * 250 */ 251 void Wise2_map_phase0_codons_AlnBlock_GeneWise(AlnBlock * alb,GeneWiseScore * gws,ComplexSequence * cseq); 252 #define map_phase0_codons_AlnBlock_GeneWise Wise2_map_phase0_codons_AlnBlock_GeneWise 253 254 255 /* Function: flatten_balance_scores_GeneWise(gw) 256 * 257 * Descrip: This function is make all the balance scores 0 (hence prob-ratio to 1). 258 * 259 * Used when you are using naive models 260 * 261 * 262 * Arg: gw [UNKN ] genewise model to flatten [GeneWise *] 263 * 264 */ 265 void Wise2_flatten_balance_scores_GeneWise(GeneWise * gw); 266 #define flatten_balance_scores_GeneWise Wise2_flatten_balance_scores_GeneWise 267 268 269 /* Function: GeneWise_from_ThreeStateModel_cdna(tsm,cp,cm,allN) 270 * 271 * Descrip: This function makes a 272 * GeneWise model for the estwise 273 * type algorithms 274 * 275 * 276 * Arg: tsm [UNKN ] Undocumented argument [ThreeStateModel *] 277 * Arg: cp [UNKN ] Undocumented argument [cDNAParser *] 278 * Arg: cm [UNKN ] Undocumented argument [CodonMapper *] 279 * Arg: allN [UNKN ] Undocumented argument [Probability] 280 * 281 * Return [UNKN ] Undocumented return value [GeneWise *] 282 * 283 */ 284 GeneWise * Wise2_GeneWise_from_ThreeStateModel_cdna(ThreeStateModel * tsm,cDNAParser * cp,CodonMapper * cm,Probability allN); 285 #define GeneWise_from_ThreeStateModel_cdna Wise2_GeneWise_from_ThreeStateModel_cdna 286 287 288 /* Function: GeneWise_from_ThreeStateModel_setfactor(tsm,factor,cm,allN) 289 * 290 * Descrip: This function makes a 291 * GeneWise model for the estwise 292 * type algorithms 293 * 294 * 295 * Arg: tsm [UNKN ] Undocumented argument [ThreeStateModel *] 296 * Arg: factor [UNKN ] Undocumented argument [Probability] 297 * Arg: cm [UNKN ] Undocumented argument [CodonMapper *] 298 * Arg: allN [UNKN ] Undocumented argument [Probability] 299 * 300 * Return [UNKN ] Undocumented return value [GeneWise *] 301 * 302 */ 303 GeneWise * Wise2_GeneWise_from_ThreeStateModel_setfactor(ThreeStateModel * tsm,Probability factor,CodonMapper * cm,Probability allN); 304 #define GeneWise_from_ThreeStateModel_setfactor Wise2_GeneWise_from_ThreeStateModel_setfactor 305 306 307 /* Function: GeneWise_from_ThreeStateModel(tsm,gp,cm,allN,gwcm) 308 * 309 * Descrip: This makes a genewise model from a 310 * threestatemodel for the genewise type 311 * algorithms. 312 * 313 * Notice you have to provide the gene parameters 314 * being used 315 * 316 * Stop is now not used 317 * 318 * 319 * Arg: tsm [UNKN ] Undocumented argument [ThreeStateModel *] 320 * Arg: gp [UNKN ] Undocumented argument [GeneParser21 *] 321 * Arg: cm [UNKN ] Undocumented argument [CodonMapper *] 322 * Arg: allN [UNKN ] Undocumented argument [Probability] 323 * Arg: gwcm [UNKN ] Undocumented argument [GeneWiseCodonModel *] 324 * 325 * Return [UNKN ] Undocumented return value [GeneWise *] 326 * 327 */ 328 GeneWise * Wise2_GeneWise_from_ThreeStateModel(ThreeStateModel * tsm,GeneParser21 * gp,CodonMapper * cm,Probability allN,GeneWiseCodonModel * gwcm); 329 #define GeneWise_from_ThreeStateModel Wise2_GeneWise_from_ThreeStateModel 330 331 332 /* Function: GeneWise_fold_in_synchronised_RandomModel(gw,rm,cm,*ct,stop_codon_background) 333 * 334 * Descrip: This function places 'log-odd' scores of the 335 * genewise model assumming that the random model 336 * is a protein model with the codon mapper system 337 * added in, *and* that the path of the random model 338 * is synchronous with the query model. 339 * 340 * It fudges stop codons with the stop score given 341 * as a probability. 342 * 343 * In other words, this should give bits scores as 344 * if it was a protein, even though it is DNA 345 * 346 * 347 * Arg: gw [UNKN ] Undocumented argument [GeneWise *] 348 * Arg: rm [UNKN ] Undocumented argument [RandomModel *] 349 * Arg: cm [UNKN ] Undocumented argument [CodonMapper *] 350 * Arg: *ct [UNKN ] Undocumented argument [CodonTable] 351 * Arg: stop_codon_background [UNKN ] Undocumented argument [Probability] 352 * 353 */ 354 void Wise2_GeneWise_fold_in_synchronised_RandomModel(GeneWise * gw,RandomModel * rm,CodonMapper * cm,CodonTable *ct,Probability stop_codon_background); 355 #define GeneWise_fold_in_synchronised_RandomModel Wise2_GeneWise_fold_in_synchronised_RandomModel 356 357 358 /* Function: check_flat_insert(gw,should_force,should_warn,ct) 359 * 360 * Descrip: This function checks that the insert model is bang on 361 * zero, forcing it to zero 362 * 363 * Potentially it warns for non zeros as well 364 * 365 * 366 * Arg: gw [UNKN ] Undocumented argument [GeneWise *] 367 * Arg: should_force [UNKN ] Undocumented argument [boolean] 368 * Arg: should_warn [UNKN ] Undocumented argument [boolean] 369 * Arg: ct [UNKN ] Undocumented argument [CodonTable *] 370 * 371 * Return [UNKN ] Undocumented return value [boolean] 372 * 373 */ 374 boolean Wise2_check_flat_insert(GeneWise * gw,boolean should_force,boolean should_warn,CodonTable * ct); 375 #define check_flat_insert Wise2_check_flat_insert 376 377 378 /* Function: GeneWise_fold_in_RandomModelDNA(gw,rmd) 379 * 380 * Descrip: This function folds in a simple random model 381 * (single base position) into a genewise model 382 * 383 * 384 * Arg: gw [UNKN ] Undocumented argument [GeneWise *] 385 * Arg: rmd [UNKN ] Undocumented argument [RandomModelDNA *] 386 * 387 */ 388 void Wise2_GeneWise_fold_in_RandomModelDNA(GeneWise * gw,RandomModelDNA * rmd); 389 #define GeneWise_fold_in_RandomModelDNA Wise2_GeneWise_fold_in_RandomModelDNA 390 391 392 /* Function: Protein_from_GeneWise_AlnColumn(dna,is_random_AlnColumn,col,position_in_aln,last_column,ct) 393 * 394 * Descrip: Produces a protein object from a genewise/estwise 395 * style label set, setting the last retrieved column 396 * 397 * 398 * Arg: dna [UNKN ] Undocumented argument [Sequence *] 399 * Arg: is_random_AlnColumn [UNKN ] Undocumented argument [NullString] 400 * Arg: col [UNKN ] Undocumented argument [AlnColumn *] 401 * Arg: position_in_aln [UNKN ] Undocumented argument [int] 402 * Arg: last_column [UNKN ] Undocumented argument [AlnColumn **] 403 * Arg: ct [UNKN ] Undocumented argument [CodonTable *] 404 * 405 * Return [UNKN ] Undocumented return value [Protein *] 406 * 407 */ 408 Protein * Wise2_Protein_from_GeneWise_AlnColumn(Sequence * dna,AlnColumn * col,int position_in_aln,AlnColumn ** last_column,CodonTable * ct,boolean (*is_random_AlnColumn)(const AlnColumn *)); 409 #define Protein_from_GeneWise_AlnColumn Wise2_Protein_from_GeneWise_AlnColumn 410 411 412 /* Function: GeneWiseScore_from_GeneWise(gw) 413 * 414 * Descrip: Makes a Score (log based) object from 415 * a probability based object 416 * 417 * 418 * Arg: gw [UNKN ] Undocumented argument [GeneWise *] 419 * 420 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 421 * 422 */ 423 GeneWiseScore * Wise2_GeneWiseScore_from_GeneWise(GeneWise * gw); 424 #define GeneWiseScore_from_GeneWise Wise2_GeneWiseScore_from_GeneWise 425 426 427 /* Function: hard_link_GeneWiseSegment(obj) 428 * 429 * Descrip: Bumps up the reference count of the object 430 * Meaning that multiple pointers can 'own' it 431 * 432 * 433 * Arg: obj [UNKN ] Object to be hard linked [GeneWiseSegment *] 434 * 435 * Return [UNKN ] Undocumented return value [GeneWiseSegment *] 436 * 437 */ 438 GeneWiseSegment * Wise2_hard_link_GeneWiseSegment(GeneWiseSegment * obj); 439 #define hard_link_GeneWiseSegment Wise2_hard_link_GeneWiseSegment 440 441 442 /* Function: GeneWiseSegment_alloc(void) 443 * 444 * Descrip: Allocates structure: assigns defaults if given 445 * 446 * 447 * 448 * Return [UNKN ] Undocumented return value [GeneWiseSegment *] 449 * 450 */ 451 GeneWiseSegment * Wise2_GeneWiseSegment_alloc(void); 452 #define GeneWiseSegment_alloc Wise2_GeneWiseSegment_alloc 453 454 455 /* Function: free_GeneWiseSegment(obj) 456 * 457 * Descrip: Free Function: removes the memory held by obj 458 * Will chain up to owned members and clear all lists 459 * 460 * 461 * Arg: obj [UNKN ] Object that is free'd [GeneWiseSegment *] 462 * 463 * Return [UNKN ] Undocumented return value [GeneWiseSegment *] 464 * 465 */ 466 GeneWiseSegment * Wise2_free_GeneWiseSegment(GeneWiseSegment * obj); 467 #define free_GeneWiseSegment Wise2_free_GeneWiseSegment 468 469 470 /* Function: add_GeneWise(obj,add) 471 * 472 * Descrip: Adds another object to the list. It will expand the list if necessary 473 * 474 * 475 * Arg: obj [UNKN ] Object which contains the list [GeneWise *] 476 * Arg: add [OWNER] Object to add to the list [GeneWiseSegment *] 477 * 478 * Return [UNKN ] Undocumented return value [boolean] 479 * 480 */ 481 boolean Wise2_add_GeneWise(GeneWise * obj,GeneWiseSegment * add); 482 #define add_GeneWise Wise2_add_GeneWise 483 484 485 /* Function: flush_GeneWise(obj) 486 * 487 * Descrip: Frees the list elements, sets length to 0 488 * If you want to save some elements, use hard_link_xxx 489 * to protect them from being actually destroyed in the free 490 * 491 * 492 * Arg: obj [UNKN ] Object which contains the list [GeneWise *] 493 * 494 * Return [UNKN ] Undocumented return value [int] 495 * 496 */ 497 int Wise2_flush_GeneWise(GeneWise * obj); 498 #define flush_GeneWise Wise2_flush_GeneWise 499 500 501 /* Function: GeneWise_alloc_std(void) 502 * 503 * Descrip: Equivalent to GeneWise_alloc_len(GeneWiseLISTLENGTH) 504 * 505 * 506 * 507 * Return [UNKN ] Undocumented return value [GeneWise *] 508 * 509 */ 510 GeneWise * Wise2_GeneWise_alloc_std(void); 511 #define GeneWise_alloc_std Wise2_GeneWise_alloc_std 512 513 514 /* Function: GeneWise_alloc_len(len) 515 * 516 * Descrip: Allocates len length to all lists 517 * 518 * 519 * Arg: len [UNKN ] Length of lists to allocate [int] 520 * 521 * Return [UNKN ] Undocumented return value [GeneWise *] 522 * 523 */ 524 GeneWise * Wise2_GeneWise_alloc_len(int len); 525 #define GeneWise_alloc_len Wise2_GeneWise_alloc_len 526 527 528 /* Function: hard_link_GeneWise(obj) 529 * 530 * Descrip: Bumps up the reference count of the object 531 * Meaning that multiple pointers can 'own' it 532 * 533 * 534 * Arg: obj [UNKN ] Object to be hard linked [GeneWise *] 535 * 536 * Return [UNKN ] Undocumented return value [GeneWise *] 537 * 538 */ 539 GeneWise * Wise2_hard_link_GeneWise(GeneWise * obj); 540 #define hard_link_GeneWise Wise2_hard_link_GeneWise 541 542 543 /* Function: GeneWise_alloc(void) 544 * 545 * Descrip: Allocates structure: assigns defaults if given 546 * 547 * 548 * 549 * Return [UNKN ] Undocumented return value [GeneWise *] 550 * 551 */ 552 GeneWise * Wise2_GeneWise_alloc(void); 553 #define GeneWise_alloc Wise2_GeneWise_alloc 554 555 556 /* Function: free_GeneWise(obj) 557 * 558 * Descrip: Free Function: removes the memory held by obj 559 * Will chain up to owned members and clear all lists 560 * 561 * 562 * Arg: obj [UNKN ] Object that is free'd [GeneWise *] 563 * 564 * Return [UNKN ] Undocumented return value [GeneWise *] 565 * 566 */ 567 GeneWise * Wise2_free_GeneWise(GeneWise * obj); 568 #define free_GeneWise Wise2_free_GeneWise 569 570 571 /* Function: hard_link_GeneWiseScoreSegment(obj) 572 * 573 * Descrip: Bumps up the reference count of the object 574 * Meaning that multiple pointers can 'own' it 575 * 576 * 577 * Arg: obj [UNKN ] Object to be hard linked [GeneWiseScoreSegment *] 578 * 579 * Return [UNKN ] Undocumented return value [GeneWiseScoreSegment *] 580 * 581 */ 582 GeneWiseScoreSegment * Wise2_hard_link_GeneWiseScoreSegment(GeneWiseScoreSegment * obj); 583 #define hard_link_GeneWiseScoreSegment Wise2_hard_link_GeneWiseScoreSegment 584 585 586 /* Function: GeneWiseScoreSegment_alloc(void) 587 * 588 * Descrip: Allocates structure: assigns defaults if given 589 * 590 * 591 * 592 * Return [UNKN ] Undocumented return value [GeneWiseScoreSegment *] 593 * 594 */ 595 GeneWiseScoreSegment * Wise2_GeneWiseScoreSegment_alloc(void); 596 #define GeneWiseScoreSegment_alloc Wise2_GeneWiseScoreSegment_alloc 597 598 599 /* Function: free_GeneWiseScoreSegment(obj) 600 * 601 * Descrip: Free Function: removes the memory held by obj 602 * Will chain up to owned members and clear all lists 603 * 604 * 605 * Arg: obj [UNKN ] Object that is free'd [GeneWiseScoreSegment *] 606 * 607 * Return [UNKN ] Undocumented return value [GeneWiseScoreSegment *] 608 * 609 */ 610 GeneWiseScoreSegment * Wise2_free_GeneWiseScoreSegment(GeneWiseScoreSegment * obj); 611 #define free_GeneWiseScoreSegment Wise2_free_GeneWiseScoreSegment 612 613 614 /* Function: add_GeneWiseScore(obj,add) 615 * 616 * Descrip: Adds another object to the list. It will expand the list if necessary 617 * 618 * 619 * Arg: obj [UNKN ] Object which contains the list [GeneWiseScore *] 620 * Arg: add [OWNER] Object to add to the list [GeneWiseScoreSegment *] 621 * 622 * Return [UNKN ] Undocumented return value [boolean] 623 * 624 */ 625 boolean Wise2_add_GeneWiseScore(GeneWiseScore * obj,GeneWiseScoreSegment * add); 626 #define add_GeneWiseScore Wise2_add_GeneWiseScore 627 628 629 /* Function: flush_GeneWiseScore(obj) 630 * 631 * Descrip: Frees the list elements, sets length to 0 632 * If you want to save some elements, use hard_link_xxx 633 * to protect them from being actually destroyed in the free 634 * 635 * 636 * Arg: obj [UNKN ] Object which contains the list [GeneWiseScore *] 637 * 638 * Return [UNKN ] Undocumented return value [int] 639 * 640 */ 641 int Wise2_flush_GeneWiseScore(GeneWiseScore * obj); 642 #define flush_GeneWiseScore Wise2_flush_GeneWiseScore 643 644 645 /* Function: GeneWiseScore_alloc_std(void) 646 * 647 * Descrip: Equivalent to GeneWiseScore_alloc_len(GeneWiseScoreLISTLENGTH) 648 * 649 * 650 * 651 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 652 * 653 */ 654 GeneWiseScore * Wise2_GeneWiseScore_alloc_std(void); 655 #define GeneWiseScore_alloc_std Wise2_GeneWiseScore_alloc_std 656 657 658 /* Function: GeneWiseScore_alloc_len(len) 659 * 660 * Descrip: Allocates len length to all lists 661 * 662 * 663 * Arg: len [UNKN ] Length of lists to allocate [int] 664 * 665 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 666 * 667 */ 668 GeneWiseScore * Wise2_GeneWiseScore_alloc_len(int len); 669 #define GeneWiseScore_alloc_len Wise2_GeneWiseScore_alloc_len 670 671 672 /* Function: hard_link_GeneWiseScore(obj) 673 * 674 * Descrip: Bumps up the reference count of the object 675 * Meaning that multiple pointers can 'own' it 676 * 677 * 678 * Arg: obj [UNKN ] Object to be hard linked [GeneWiseScore *] 679 * 680 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 681 * 682 */ 683 GeneWiseScore * Wise2_hard_link_GeneWiseScore(GeneWiseScore * obj); 684 #define hard_link_GeneWiseScore Wise2_hard_link_GeneWiseScore 685 686 687 /* Function: GeneWiseScore_alloc(void) 688 * 689 * Descrip: Allocates structure: assigns defaults if given 690 * 691 * 692 * 693 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 694 * 695 */ 696 GeneWiseScore * Wise2_GeneWiseScore_alloc(void); 697 #define GeneWiseScore_alloc Wise2_GeneWiseScore_alloc 698 699 700 /* Function: free_GeneWiseScore(obj) 701 * 702 * Descrip: Free Function: removes the memory held by obj 703 * Will chain up to owned members and clear all lists 704 * 705 * 706 * Arg: obj [UNKN ] Object that is free'd [GeneWiseScore *] 707 * 708 * Return [UNKN ] Undocumented return value [GeneWiseScore *] 709 * 710 */ 711 GeneWiseScore * Wise2_free_GeneWiseScore(GeneWiseScore * obj); 712 #define free_GeneWiseScore Wise2_free_GeneWiseScore 713 714 715 /* Function: hard_link_GeneWiseScoreFlat(obj) 716 * 717 * Descrip: Bumps up the reference count of the object 718 * Meaning that multiple pointers can 'own' it 719 * 720 * 721 * Arg: obj [UNKN ] Object to be hard linked [GeneWiseScoreFlat *] 722 * 723 * Return [UNKN ] Undocumented return value [GeneWiseScoreFlat *] 724 * 725 */ 726 GeneWiseScoreFlat * Wise2_hard_link_GeneWiseScoreFlat(GeneWiseScoreFlat * obj); 727 #define hard_link_GeneWiseScoreFlat Wise2_hard_link_GeneWiseScoreFlat 728 729 730 /* Function: GeneWiseScoreFlat_alloc(void) 731 * 732 * Descrip: Allocates structure: assigns defaults if given 733 * 734 * 735 * 736 * Return [UNKN ] Undocumented return value [GeneWiseScoreFlat *] 737 * 738 */ 739 GeneWiseScoreFlat * Wise2_GeneWiseScoreFlat_alloc(void); 740 #define GeneWiseScoreFlat_alloc Wise2_GeneWiseScoreFlat_alloc 741 742 743 /* Unplaced functions */ 744 /* There has been no indication of the use of these functions */ 745 746 747 /***************************************************/ 748 /* Internal functions */ 749 /* you are not expected to have to call these */ 750 /***************************************************/ 751 Probability Wise2_probability_of_this_codon(int codon,RandomModelDNA * rmd); 752 #define probability_of_this_codon Wise2_probability_of_this_codon 753 void Wise2_show_GeneWise(GeneWise * gw,FILE * ofp); 754 #define show_GeneWise Wise2_show_GeneWise 755 void Wise2_show_GeneWiseSegment(GeneWiseSegment * seg,FILE * ofp); 756 #define show_GeneWiseSegment Wise2_show_GeneWiseSegment 757 GeneWiseSegment * Wise2_GeneWiseSegment_from_ThreeStateUnit(ThreeStateUnit * tsu,Probability factor,CodonMapper * cm,GeneWiseCodonModel * gwcm,Probability allN); 758 #define GeneWiseSegment_from_ThreeStateUnit Wise2_GeneWiseSegment_from_ThreeStateUnit 759 Probability Wise2_Probability_of_codon(int codon,CodonTable * ct,Probability * aminoacid_26_array,Probability stop); 760 #define Probability_of_codon Wise2_Probability_of_codon 761 GeneWiseScoreSegment * Wise2_GeneWiseScoreSegment_from_GeneWiseSegment(GeneWiseSegment * prev,GeneWiseSegment * seg); 762 #define GeneWiseScoreSegment_from_GeneWiseSegment Wise2_GeneWiseScoreSegment_from_GeneWiseSegment 763 void Wise2_swap_GeneWise(GeneWiseSegment ** list,int i,int j) ; 764 #define swap_GeneWise Wise2_swap_GeneWise 765 void Wise2_qsort_GeneWise(GeneWiseSegment ** list,int left,int right,int (*comp)(GeneWiseSegment * ,GeneWiseSegment * )); 766 #define qsort_GeneWise Wise2_qsort_GeneWise 767 void Wise2_sort_GeneWise(GeneWise * obj,int (*comp)(GeneWiseSegment *, GeneWiseSegment *)); 768 #define sort_GeneWise Wise2_sort_GeneWise 769 boolean Wise2_expand_GeneWise(GeneWise * obj,int len); 770 #define expand_GeneWise Wise2_expand_GeneWise 771 void Wise2_swap_GeneWiseScore(GeneWiseScoreSegment ** list,int i,int j) ; 772 #define swap_GeneWiseScore Wise2_swap_GeneWiseScore 773 void Wise2_qsort_GeneWiseScore(GeneWiseScoreSegment ** list,int left,int right,int (*comp)(GeneWiseScoreSegment * ,GeneWiseScoreSegment * )); 774 #define qsort_GeneWiseScore Wise2_qsort_GeneWiseScore 775 void Wise2_sort_GeneWiseScore(GeneWiseScore * obj,int (*comp)(GeneWiseScoreSegment *, GeneWiseScoreSegment *)); 776 #define sort_GeneWiseScore Wise2_sort_GeneWiseScore 777 boolean Wise2_expand_GeneWiseScore(GeneWiseScore * obj,int len); 778 #define expand_GeneWiseScore Wise2_expand_GeneWiseScore 779 780 #ifdef _cplusplus 781 } 782 #endif 783 784 #endif 785