1 #ifndef DYNAMITEgeneloop6HEADERFILE 2 #define DYNAMITEgeneloop6HEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 #include "dyna.h" 7 #include "geneparser4.h" 8 #include "genewisemodel.h" 9 #include "genewisemodeldb.h" 10 11 12 struct Wise2_GeneLoop6 { 13 int dynamite_hard_link; 14 #ifdef PTHREAD 15 pthread_mutex_t dynamite_mutex; 16 #endif 17 BaseMatrix * basematrix; 18 ShatterMatrix * shatter; 19 int leni; 20 int lenj; 21 GeneWiseScore* query; 22 ComplexSequence* target; 23 GeneParser4Score * gp; 24 } ; 25 /* GeneLoop6 defined */ 26 #ifndef DYNAMITE_DEFINED_GeneLoop6 27 typedef struct Wise2_GeneLoop6 Wise2_GeneLoop6; 28 #define GeneLoop6 Wise2_GeneLoop6 29 #define DYNAMITE_DEFINED_GeneLoop6 30 #endif 31 32 33 #ifdef PTHREAD 34 struct thread_pool_holder_GeneLoop6 { 35 GeneWiseScore* query; /* Query object placeholder */ 36 GeneWiseDB* querydb;/* Query database object */ 37 boolean query_init; 38 ComplexSequence* target;/* Target object placeholder */ 39 GenomicDB* targetdb;/* Target database object */ 40 boolean target_init; 41 GeneParser4Score * gp; 42 pthread_mutex_t input_lock; 43 pthread_mutex_t output_lock; 44 Hscore * out; 45 pthread_t * pool; 46 int number_of_threads; 47 boolean search_has_ended; 48 DBSearchImpl * dbsi; 49 } ; 50 #endif /* PTHREAD */ 51 struct Wise2_GeneLoop6_access_func_holder { 52 int dynamite_hard_link; 53 #ifdef PTHREAD 54 pthread_mutex_t dynamite_mutex; 55 #endif 56 int (*access_main)(GeneLoop6*,int,int,int); 57 int (*access_special)(GeneLoop6*,int,int,int); 58 } ; 59 /* GeneLoop6_access_func_holder defined */ 60 #ifndef DYNAMITE_DEFINED_GeneLoop6_access_func_holder 61 typedef struct Wise2_GeneLoop6_access_func_holder Wise2_GeneLoop6_access_func_holder; 62 #define GeneLoop6_access_func_holder Wise2_GeneLoop6_access_func_holder 63 #define DYNAMITE_DEFINED_GeneLoop6_access_func_holder 64 #endif 65 66 67 68 69 /***************************************************/ 70 /* Callable functions */ 71 /* These are the functions you are expected to use */ 72 /***************************************************/ 73 74 75 76 /* Function: PackAln_read_Shatter_GeneLoop6(mat) 77 * 78 * Descrip: Reads off PackAln from shatter matrix structure 79 * 80 * 81 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 82 * 83 * Return [UNKN ] Undocumented return value [PackAln *] 84 * 85 */ 86 PackAln * Wise2_PackAln_read_Shatter_GeneLoop6(GeneLoop6 * mat); 87 #define PackAln_read_Shatter_GeneLoop6 Wise2_PackAln_read_Shatter_GeneLoop6 88 89 90 /* Function: calculate_shatter_GeneLoop6(mat,dpenv) 91 * 92 * Descrip: This function calculates the GeneLoop6 matrix when in shatter mode 93 * 94 * 95 * Arg: mat [UNKN ] (null) [GeneLoop6 *] 96 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 97 * 98 * Return [UNKN ] Undocumented return value [boolean] 99 * 100 */ 101 boolean Wise2_calculate_shatter_GeneLoop6(GeneLoop6 * mat,DPEnvelope * dpenv); 102 #define calculate_shatter_GeneLoop6 Wise2_calculate_shatter_GeneLoop6 103 104 105 /* Function: search_GeneLoop6(dbsi,out,querydb,targetdb,gp) 106 * 107 * Descrip: This function makes a database search of GeneLoop6 108 * It uses the dbsi structure to choose which implementation 109 * to use of the database searching. This way at run time you 110 * can switch between single threaded/multi-threaded or hardware 111 * 112 * 113 * Arg: dbsi [UNKN ] Undocumented argument [DBSearchImpl *] 114 * Arg: out [UNKN ] Undocumented argument [Hscore *] 115 * Arg: querydb [UNKN ] Undocumented argument [GeneWiseDB*] 116 * Arg: targetdb [UNKN ] Undocumented argument [GenomicDB*] 117 * Arg: gp [UNKN ] Undocumented argument [GeneParser4Score *] 118 * 119 * Return [UNKN ] Undocumented return value [Search_Return_Type] 120 * 121 */ 122 Search_Return_Type Wise2_search_GeneLoop6(DBSearchImpl * dbsi,Hscore * out,GeneWiseDB* querydb,GenomicDB* targetdb ,GeneParser4Score * gp); 123 #define search_GeneLoop6 Wise2_search_GeneLoop6 124 125 126 /* Function: serial_search_GeneLoop6(out,querydb,targetdb,gp) 127 * 128 * Descrip: This function makes a database search of GeneLoop6 129 * It is a single processor implementation 130 * 131 * 132 * Arg: out [UNKN ] Undocumented argument [Hscore *] 133 * Arg: querydb [UNKN ] Undocumented argument [GeneWiseDB*] 134 * Arg: targetdb [UNKN ] Undocumented argument [GenomicDB*] 135 * Arg: gp [UNKN ] Undocumented argument [GeneParser4Score *] 136 * 137 * Return [UNKN ] Undocumented return value [Search_Return_Type] 138 * 139 */ 140 Search_Return_Type Wise2_serial_search_GeneLoop6(Hscore * out,GeneWiseDB* querydb,GenomicDB* targetdb ,GeneParser4Score * gp); 141 #define serial_search_GeneLoop6 Wise2_serial_search_GeneLoop6 142 143 144 /* Function: PackAln_bestmemory_GeneLoop6(query,target,gp,dpenv,dpri) 145 * 146 * Descrip: This function chooses the best memory set-up for the alignment 147 * using calls to basematrix, and then implements either a large 148 * or small memory model. 149 * 150 * It is the best function to use if you just want an alignment 151 * 152 * If you want a label alignment, you will need 153 * /convert_PackAln_to_AlnBlock_GeneLoop6 154 * 155 * 156 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 157 * Arg: target [UNKN ] target data structure [ComplexSequence*] 158 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 159 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 160 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 161 * 162 * Return [UNKN ] Undocumented return value [PackAln *] 163 * 164 */ 165 PackAln * Wise2_PackAln_bestmemory_GeneLoop6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp,DPEnvelope * dpenv,DPRunImpl * dpri); 166 #define PackAln_bestmemory_GeneLoop6 Wise2_PackAln_bestmemory_GeneLoop6 167 168 169 /* Function: allocate_Expl_GeneLoop6(query,target,gp,dpri) 170 * 171 * Descrip: This function allocates the GeneLoop6 structure 172 * and the basematrix area for explicit memory implementations 173 * It calls /allocate_GeneLoop6_only 174 * 175 * 176 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 177 * Arg: target [UNKN ] target data structure [ComplexSequence*] 178 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 179 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 180 * 181 * Return [UNKN ] Undocumented return value [GeneLoop6 *] 182 * 183 */ 184 GeneLoop6 * Wise2_allocate_Expl_GeneLoop6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp,DPRunImpl * dpri); 185 #define allocate_Expl_GeneLoop6 Wise2_allocate_Expl_GeneLoop6 186 187 188 /* Function: recalculate_PackAln_GeneLoop6(pal,mat) 189 * 190 * Descrip: This function recalculates the PackAln structure produced by GeneLoop6 191 * For example, in linear space methods this is used to score them 192 * 193 * 194 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 195 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 196 * 197 */ 198 void Wise2_recalculate_PackAln_GeneLoop6(PackAln * pal,GeneLoop6 * mat); 199 #define recalculate_PackAln_GeneLoop6 Wise2_recalculate_PackAln_GeneLoop6 200 201 202 /* Function: allocate_Small_GeneLoop6(query,target,gp) 203 * 204 * Descrip: This function allocates the GeneLoop6 structure 205 * and the basematrix area for a small memory implementations 206 * It calls /allocate_GeneLoop6_only 207 * 208 * 209 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 210 * Arg: target [UNKN ] target data structure [ComplexSequence*] 211 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 212 * 213 * Return [UNKN ] Undocumented return value [GeneLoop6 *] 214 * 215 */ 216 GeneLoop6 * Wise2_allocate_Small_GeneLoop6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 217 #define allocate_Small_GeneLoop6 Wise2_allocate_Small_GeneLoop6 218 219 220 /* Function: PackAln_calculate_Small_GeneLoop6(mat,dpenv) 221 * 222 * Descrip: This function calculates an alignment for GeneLoop6 structure in linear space 223 * If you want only the start/end points 224 * use /AlnRangeSet_calculate_Small_GeneLoop6 225 * 226 * The function basically 227 * finds start/end points 228 * foreach start/end point 229 * calls /full_dc_GeneLoop6 230 * 231 * 232 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 233 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 234 * 235 * Return [UNKN ] Undocumented return value [PackAln *] 236 * 237 */ 238 PackAln * Wise2_PackAln_calculate_Small_GeneLoop6(GeneLoop6 * mat,DPEnvelope * dpenv); 239 #define PackAln_calculate_Small_GeneLoop6 Wise2_PackAln_calculate_Small_GeneLoop6 240 241 242 /* Function: AlnRangeSet_calculate_Small_GeneLoop6(mat) 243 * 244 * Descrip: This function calculates an alignment for GeneLoop6 structure in linear space 245 * If you want the full alignment, use /PackAln_calculate_Small_GeneLoop6 246 * If you have already got the full alignment, but want the range set, use /AlnRangeSet_from_PackAln_GeneLoop6 247 * If you have got the small matrix but not the alignment, use /AlnRangeSet_from_GeneLoop6 248 * 249 * 250 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 251 * 252 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 253 * 254 */ 255 AlnRangeSet * Wise2_AlnRangeSet_calculate_Small_GeneLoop6(GeneLoop6 * mat); 256 #define AlnRangeSet_calculate_Small_GeneLoop6 Wise2_AlnRangeSet_calculate_Small_GeneLoop6 257 258 259 /* Function: AlnRangeSet_from_GeneLoop6(mat) 260 * 261 * Descrip: This function reads off a start/end structure 262 * for GeneLoop6 structure in linear space 263 * If you want the full alignment use 264 * /PackAln_calculate_Small_GeneLoop6 265 * If you have not calculated the matrix use 266 * /AlnRange_calculate_Small_GeneLoop6 267 * 268 * 269 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 270 * 271 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 272 * 273 */ 274 AlnRangeSet * Wise2_AlnRangeSet_from_GeneLoop6(GeneLoop6 * mat); 275 #define AlnRangeSet_from_GeneLoop6 Wise2_AlnRangeSet_from_GeneLoop6 276 277 278 /* Function: convert_PackAln_to_AlnBlock_GeneLoop6(pal) 279 * 280 * Descrip: Converts a path alignment to a label alignment 281 * The label alignment is probably much more useful than the path 282 * 283 * 284 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 285 * 286 * Return [UNKN ] Undocumented return value [AlnBlock *] 287 * 288 */ 289 AlnBlock * Wise2_convert_PackAln_to_AlnBlock_GeneLoop6(PackAln * pal); 290 #define convert_PackAln_to_AlnBlock_GeneLoop6 Wise2_convert_PackAln_to_AlnBlock_GeneLoop6 291 292 293 /* Function: PackAln_read_Expl_GeneLoop6(mat) 294 * 295 * Descrip: Reads off PackAln from explicit matrix structure 296 * 297 * 298 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 299 * 300 * Return [UNKN ] Undocumented return value [PackAln *] 301 * 302 */ 303 PackAln * Wise2_PackAln_read_Expl_GeneLoop6(GeneLoop6 * mat); 304 #define PackAln_read_Expl_GeneLoop6 Wise2_PackAln_read_Expl_GeneLoop6 305 306 307 /* Function: PackAln_read_generic_GeneLoop6(mat,h) 308 * 309 * Descrip: Reads off PackAln from explicit matrix structure 310 * 311 * 312 * Arg: mat [UNKN ] Undocumented argument [GeneLoop6 *] 313 * Arg: h [UNKN ] Undocumented argument [GeneLoop6_access_func_holder] 314 * 315 * Return [UNKN ] Undocumented return value [PackAln *] 316 * 317 */ 318 PackAln * Wise2_PackAln_read_generic_GeneLoop6(GeneLoop6 * mat,GeneLoop6_access_func_holder h); 319 #define PackAln_read_generic_GeneLoop6 Wise2_PackAln_read_generic_GeneLoop6 320 321 322 /* Function: calculate_GeneLoop6(mat) 323 * 324 * Descrip: This function calculates the GeneLoop6 matrix when in explicit mode 325 * To allocate the matrix use /allocate_Expl_GeneLoop6 326 * 327 * 328 * Arg: mat [UNKN ] GeneLoop6 which contains explicit basematrix memory [GeneLoop6 *] 329 * 330 * Return [UNKN ] Undocumented return value [boolean] 331 * 332 */ 333 boolean Wise2_calculate_GeneLoop6(GeneLoop6 * mat); 334 #define calculate_GeneLoop6 Wise2_calculate_GeneLoop6 335 336 337 /* Function: calculate_dpenv_GeneLoop6(mat,dpenv) 338 * 339 * Descrip: This function calculates the GeneLoop6 matrix when in explicit mode, subject to the envelope 340 * 341 * 342 * Arg: mat [UNKN ] GeneLoop6 which contains explicit basematrix memory [GeneLoop6 *] 343 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 344 * 345 * Return [UNKN ] Undocumented return value [boolean] 346 * 347 */ 348 boolean Wise2_calculate_dpenv_GeneLoop6(GeneLoop6 * mat,DPEnvelope * dpenv); 349 #define calculate_dpenv_GeneLoop6 Wise2_calculate_dpenv_GeneLoop6 350 351 352 /* Function: GeneLoop6_alloc(void) 353 * 354 * Descrip: Allocates structure: assigns defaults if given 355 * 356 * 357 * 358 * Return [UNKN ] Undocumented return value [GeneLoop6 *] 359 * 360 */ 361 GeneLoop6 * Wise2_GeneLoop6_alloc(void); 362 #define GeneLoop6_alloc Wise2_GeneLoop6_alloc 363 364 365 /* Function: free_GeneLoop6(obj) 366 * 367 * Descrip: Free Function: removes the memory held by obj 368 * Will chain up to owned members and clear all lists 369 * 370 * 371 * Arg: obj [UNKN ] Object that is free'd [GeneLoop6 *] 372 * 373 * Return [UNKN ] Undocumented return value [GeneLoop6 *] 374 * 375 */ 376 GeneLoop6 * Wise2_free_GeneLoop6(GeneLoop6 * obj); 377 #define free_GeneLoop6 Wise2_free_GeneLoop6 378 379 380 /* Unplaced functions */ 381 /* There has been no indication of the use of these functions */ 382 383 384 /***************************************************/ 385 /* Internal functions */ 386 /* you are not expected to have to call these */ 387 /***************************************************/ 388 int Wise2_GeneLoop6_shatter_access_main(GeneLoop6 * mat,int i,int j,int state); 389 #define GeneLoop6_shatter_access_main Wise2_GeneLoop6_shatter_access_main 390 int Wise2_GeneLoop6_shatter_access_special(GeneLoop6 * mat,int i,int j,int state); 391 #define GeneLoop6_shatter_access_special Wise2_GeneLoop6_shatter_access_special 392 void * Wise2_thread_loop_GeneLoop6(void * ptr); 393 #define thread_loop_GeneLoop6 Wise2_thread_loop_GeneLoop6 394 int Wise2_score_only_GeneLoop6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 395 #define score_only_GeneLoop6 Wise2_score_only_GeneLoop6 396 GeneLoop6 * Wise2_allocate_GeneLoop6_only(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 397 #define allocate_GeneLoop6_only Wise2_allocate_GeneLoop6_only 398 void Wise2_init_GeneLoop6(GeneLoop6 * mat); 399 #define init_GeneLoop6 Wise2_init_GeneLoop6 400 AlnRange * Wise2_AlnRange_build_GeneLoop6(GeneLoop6 * mat,int stopj,int stopspecstate,int * startj,int * startspecstate); 401 #define AlnRange_build_GeneLoop6 Wise2_AlnRange_build_GeneLoop6 402 boolean Wise2_read_hidden_GeneLoop6(GeneLoop6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out); 403 #define read_hidden_GeneLoop6 Wise2_read_hidden_GeneLoop6 404 int Wise2_max_hidden_GeneLoop6(GeneLoop6 * mat,int hiddenj,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 405 #define max_hidden_GeneLoop6 Wise2_max_hidden_GeneLoop6 406 boolean Wise2_read_special_strip_GeneLoop6(GeneLoop6 * mat,int stopi,int stopj,int stopstate,int * startj,int * startstate,PackAln * out); 407 #define read_special_strip_GeneLoop6 Wise2_read_special_strip_GeneLoop6 408 int Wise2_max_special_strip_GeneLoop6(GeneLoop6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 409 #define max_special_strip_GeneLoop6 Wise2_max_special_strip_GeneLoop6 410 int Wise2_max_matrix_to_special_GeneLoop6(GeneLoop6 * mat,int i,int j,int state,int cscore,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 411 #define max_matrix_to_special_GeneLoop6 Wise2_max_matrix_to_special_GeneLoop6 412 void Wise2_calculate_hidden_GeneLoop6(GeneLoop6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv); 413 #define calculate_hidden_GeneLoop6 Wise2_calculate_hidden_GeneLoop6 414 void Wise2_init_hidden_GeneLoop6(GeneLoop6 * mat,int starti,int startj,int stopi,int stopj); 415 #define init_hidden_GeneLoop6 Wise2_init_hidden_GeneLoop6 416 boolean Wise2_full_dc_GeneLoop6(GeneLoop6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out,int * donej,int totalj,DPEnvelope * dpenv); 417 #define full_dc_GeneLoop6 Wise2_full_dc_GeneLoop6 418 boolean Wise2_do_dc_single_pass_GeneLoop6(GeneLoop6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv,int perc_done); 419 #define do_dc_single_pass_GeneLoop6 Wise2_do_dc_single_pass_GeneLoop6 420 void Wise2_push_dc_at_merge_GeneLoop6(GeneLoop6 * mat,int starti,int stopi,int startj,int * stopj,DPEnvelope * dpenv); 421 #define push_dc_at_merge_GeneLoop6 Wise2_push_dc_at_merge_GeneLoop6 422 void Wise2_follow_on_dc_GeneLoop6(GeneLoop6 * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 423 #define follow_on_dc_GeneLoop6 Wise2_follow_on_dc_GeneLoop6 424 void Wise2_run_up_dc_GeneLoop6(GeneLoop6 * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 425 #define run_up_dc_GeneLoop6 Wise2_run_up_dc_GeneLoop6 426 void Wise2_init_dc_GeneLoop6(GeneLoop6 * mat); 427 #define init_dc_GeneLoop6 Wise2_init_dc_GeneLoop6 428 int Wise2_start_end_find_end_GeneLoop6(GeneLoop6 * mat,int * endj); 429 #define start_end_find_end_GeneLoop6 Wise2_start_end_find_end_GeneLoop6 430 boolean Wise2_dc_optimised_start_end_calc_GeneLoop6(GeneLoop6 *mat,DPEnvelope * dpenv); 431 #define dc_optimised_start_end_calc_GeneLoop6 Wise2_dc_optimised_start_end_calc_GeneLoop6 432 void Wise2_init_start_end_linear_GeneLoop6(GeneLoop6 * mat); 433 #define init_start_end_linear_GeneLoop6 Wise2_init_start_end_linear_GeneLoop6 434 AlnConvertSet * Wise2_AlnConvertSet_GeneLoop6(void); 435 #define AlnConvertSet_GeneLoop6 Wise2_AlnConvertSet_GeneLoop6 436 int Wise2_GeneLoop6_explicit_access_main(GeneLoop6 * mat,int i,int j,int state); 437 #define GeneLoop6_explicit_access_main Wise2_GeneLoop6_explicit_access_main 438 int Wise2_GeneLoop6_explicit_access_special(GeneLoop6 * mat,int i,int j,int state); 439 #define GeneLoop6_explicit_access_special Wise2_GeneLoop6_explicit_access_special 440 int Wise2_find_end_GeneLoop6(GeneLoop6 * mat,int * ri,int * rj,int * state,boolean * isspecial,GeneLoop6_access_func_holder h); 441 #define find_end_GeneLoop6 Wise2_find_end_GeneLoop6 442 void Wise2_GeneLoop6_debug_show_matrix(GeneLoop6 * mat,int starti,int stopi,int startj,int stopj,FILE * ofp); 443 #define GeneLoop6_debug_show_matrix Wise2_GeneLoop6_debug_show_matrix 444 int Wise2_max_calc_GeneLoop6(GeneLoop6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,GeneLoop6_access_func_holder h); 445 #define max_calc_GeneLoop6 Wise2_max_calc_GeneLoop6 446 int Wise2_max_calc_special_GeneLoop6(GeneLoop6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,GeneLoop6_access_func_holder h); 447 #define max_calc_special_GeneLoop6 Wise2_max_calc_special_GeneLoop6 448 449 #ifdef _cplusplus 450 } 451 #endif 452 453 #endif 454