1 #ifndef DYNAMITEgenewise6HEADERFILE 2 #define DYNAMITEgenewise6HEADERFILE 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 struct Wise2_GeneWise6 { 12 int dynamite_hard_link; 13 #ifdef PTHREAD 14 pthread_mutex_t dynamite_mutex; 15 #endif 16 BaseMatrix * basematrix; 17 ShatterMatrix * shatter; 18 int leni; 19 int lenj; 20 GeneWiseScore* query; 21 ComplexSequence* target; 22 GeneParser4Score * gp; 23 } ; 24 /* GeneWise6 defined */ 25 #ifndef DYNAMITE_DEFINED_GeneWise6 26 typedef struct Wise2_GeneWise6 Wise2_GeneWise6; 27 #define GeneWise6 Wise2_GeneWise6 28 #define DYNAMITE_DEFINED_GeneWise6 29 #endif 30 31 32 #ifdef PTHREAD 33 struct thread_pool_holder_GeneWise6 { 34 GeneWiseScore* query; /* Query object placeholder */ 35 GeneWiseDB* querydb;/* Query database object */ 36 boolean query_init; 37 ComplexSequence* target;/* Target object placeholder */ 38 GenomicDB* targetdb;/* Target database object */ 39 boolean target_init; 40 GeneParser4Score * gp; 41 pthread_mutex_t input_lock; 42 pthread_mutex_t output_lock; 43 Hscore * out; 44 pthread_t * pool; 45 int number_of_threads; 46 boolean search_has_ended; 47 DBSearchImpl * dbsi; 48 } ; 49 #endif /* PTHREAD */ 50 struct Wise2_GeneWise6_access_func_holder { 51 int dynamite_hard_link; 52 #ifdef PTHREAD 53 pthread_mutex_t dynamite_mutex; 54 #endif 55 int (*access_main)(GeneWise6*,int,int,int); 56 int (*access_special)(GeneWise6*,int,int,int); 57 } ; 58 /* GeneWise6_access_func_holder defined */ 59 #ifndef DYNAMITE_DEFINED_GeneWise6_access_func_holder 60 typedef struct Wise2_GeneWise6_access_func_holder Wise2_GeneWise6_access_func_holder; 61 #define GeneWise6_access_func_holder Wise2_GeneWise6_access_func_holder 62 #define DYNAMITE_DEFINED_GeneWise6_access_func_holder 63 #endif 64 65 66 67 68 /***************************************************/ 69 /* Callable functions */ 70 /* These are the functions you are expected to use */ 71 /***************************************************/ 72 73 74 75 /* Function: PackAln_read_Shatter_GeneWise6(mat) 76 * 77 * Descrip: Reads off PackAln from shatter matrix structure 78 * 79 * 80 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 81 * 82 * Return [UNKN ] Undocumented return value [PackAln *] 83 * 84 */ 85 PackAln * Wise2_PackAln_read_Shatter_GeneWise6(GeneWise6 * mat); 86 #define PackAln_read_Shatter_GeneWise6 Wise2_PackAln_read_Shatter_GeneWise6 87 88 89 /* Function: calculate_shatter_GeneWise6(mat,dpenv) 90 * 91 * Descrip: This function calculates the GeneWise6 matrix when in shatter mode 92 * 93 * 94 * Arg: mat [UNKN ] (null) [GeneWise6 *] 95 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 96 * 97 * Return [UNKN ] Undocumented return value [boolean] 98 * 99 */ 100 boolean Wise2_calculate_shatter_GeneWise6(GeneWise6 * mat,DPEnvelope * dpenv); 101 #define calculate_shatter_GeneWise6 Wise2_calculate_shatter_GeneWise6 102 103 104 /* Function: search_GeneWise6(dbsi,out,querydb,targetdb,gp) 105 * 106 * Descrip: This function makes a database search of GeneWise6 107 * It uses the dbsi structure to choose which implementation 108 * to use of the database searching. This way at run time you 109 * can switch between single threaded/multi-threaded or hardware 110 * 111 * 112 * Arg: dbsi [UNKN ] Undocumented argument [DBSearchImpl *] 113 * Arg: out [UNKN ] Undocumented argument [Hscore *] 114 * Arg: querydb [UNKN ] Undocumented argument [GeneWiseDB*] 115 * Arg: targetdb [UNKN ] Undocumented argument [GenomicDB*] 116 * Arg: gp [UNKN ] Undocumented argument [GeneParser4Score *] 117 * 118 * Return [UNKN ] Undocumented return value [Search_Return_Type] 119 * 120 */ 121 Search_Return_Type Wise2_search_GeneWise6(DBSearchImpl * dbsi,Hscore * out,GeneWiseDB* querydb,GenomicDB* targetdb ,GeneParser4Score * gp); 122 #define search_GeneWise6 Wise2_search_GeneWise6 123 124 125 /* Function: serial_search_GeneWise6(out,querydb,targetdb,gp) 126 * 127 * Descrip: This function makes a database search of GeneWise6 128 * It is a single processor implementation 129 * 130 * 131 * Arg: out [UNKN ] Undocumented argument [Hscore *] 132 * Arg: querydb [UNKN ] Undocumented argument [GeneWiseDB*] 133 * Arg: targetdb [UNKN ] Undocumented argument [GenomicDB*] 134 * Arg: gp [UNKN ] Undocumented argument [GeneParser4Score *] 135 * 136 * Return [UNKN ] Undocumented return value [Search_Return_Type] 137 * 138 */ 139 Search_Return_Type Wise2_serial_search_GeneWise6(Hscore * out,GeneWiseDB* querydb,GenomicDB* targetdb ,GeneParser4Score * gp); 140 #define serial_search_GeneWise6 Wise2_serial_search_GeneWise6 141 142 143 /* Function: PackAln_bestmemory_GeneWise6(query,target,gp,dpenv,dpri) 144 * 145 * Descrip: This function chooses the best memory set-up for the alignment 146 * using calls to basematrix, and then implements either a large 147 * or small memory model. 148 * 149 * It is the best function to use if you just want an alignment 150 * 151 * If you want a label alignment, you will need 152 * /convert_PackAln_to_AlnBlock_GeneWise6 153 * 154 * 155 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 156 * Arg: target [UNKN ] target data structure [ComplexSequence*] 157 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 158 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 159 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 160 * 161 * Return [UNKN ] Undocumented return value [PackAln *] 162 * 163 */ 164 PackAln * Wise2_PackAln_bestmemory_GeneWise6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp,DPEnvelope * dpenv,DPRunImpl * dpri); 165 #define PackAln_bestmemory_GeneWise6 Wise2_PackAln_bestmemory_GeneWise6 166 167 168 /* Function: allocate_Expl_GeneWise6(query,target,gp,dpri) 169 * 170 * Descrip: This function allocates the GeneWise6 structure 171 * and the basematrix area for explicit memory implementations 172 * It calls /allocate_GeneWise6_only 173 * 174 * 175 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 176 * Arg: target [UNKN ] target data structure [ComplexSequence*] 177 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 178 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 179 * 180 * Return [UNKN ] Undocumented return value [GeneWise6 *] 181 * 182 */ 183 GeneWise6 * Wise2_allocate_Expl_GeneWise6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp,DPRunImpl * dpri); 184 #define allocate_Expl_GeneWise6 Wise2_allocate_Expl_GeneWise6 185 186 187 /* Function: recalculate_PackAln_GeneWise6(pal,mat) 188 * 189 * Descrip: This function recalculates the PackAln structure produced by GeneWise6 190 * For example, in linear space methods this is used to score them 191 * 192 * 193 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 194 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 195 * 196 */ 197 void Wise2_recalculate_PackAln_GeneWise6(PackAln * pal,GeneWise6 * mat); 198 #define recalculate_PackAln_GeneWise6 Wise2_recalculate_PackAln_GeneWise6 199 200 201 /* Function: allocate_Small_GeneWise6(query,target,gp) 202 * 203 * Descrip: This function allocates the GeneWise6 structure 204 * and the basematrix area for a small memory implementations 205 * It calls /allocate_GeneWise6_only 206 * 207 * 208 * Arg: query [UNKN ] query data structure [GeneWiseScore*] 209 * Arg: target [UNKN ] target data structure [ComplexSequence*] 210 * Arg: gp [UNKN ] Resource [GeneParser4Score *] 211 * 212 * Return [UNKN ] Undocumented return value [GeneWise6 *] 213 * 214 */ 215 GeneWise6 * Wise2_allocate_Small_GeneWise6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 216 #define allocate_Small_GeneWise6 Wise2_allocate_Small_GeneWise6 217 218 219 /* Function: PackAln_calculate_Small_GeneWise6(mat,dpenv) 220 * 221 * Descrip: This function calculates an alignment for GeneWise6 structure in linear space 222 * If you want only the start/end points 223 * use /AlnRangeSet_calculate_Small_GeneWise6 224 * 225 * The function basically 226 * finds start/end points 227 * foreach start/end point 228 * calls /full_dc_GeneWise6 229 * 230 * 231 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 232 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 233 * 234 * Return [UNKN ] Undocumented return value [PackAln *] 235 * 236 */ 237 PackAln * Wise2_PackAln_calculate_Small_GeneWise6(GeneWise6 * mat,DPEnvelope * dpenv); 238 #define PackAln_calculate_Small_GeneWise6 Wise2_PackAln_calculate_Small_GeneWise6 239 240 241 /* Function: AlnRangeSet_calculate_Small_GeneWise6(mat) 242 * 243 * Descrip: This function calculates an alignment for GeneWise6 structure in linear space 244 * If you want the full alignment, use /PackAln_calculate_Small_GeneWise6 245 * If you have already got the full alignment, but want the range set, use /AlnRangeSet_from_PackAln_GeneWise6 246 * If you have got the small matrix but not the alignment, use /AlnRangeSet_from_GeneWise6 247 * 248 * 249 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 250 * 251 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 252 * 253 */ 254 AlnRangeSet * Wise2_AlnRangeSet_calculate_Small_GeneWise6(GeneWise6 * mat); 255 #define AlnRangeSet_calculate_Small_GeneWise6 Wise2_AlnRangeSet_calculate_Small_GeneWise6 256 257 258 /* Function: AlnRangeSet_from_GeneWise6(mat) 259 * 260 * Descrip: This function reads off a start/end structure 261 * for GeneWise6 structure in linear space 262 * If you want the full alignment use 263 * /PackAln_calculate_Small_GeneWise6 264 * If you have not calculated the matrix use 265 * /AlnRange_calculate_Small_GeneWise6 266 * 267 * 268 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 269 * 270 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 271 * 272 */ 273 AlnRangeSet * Wise2_AlnRangeSet_from_GeneWise6(GeneWise6 * mat); 274 #define AlnRangeSet_from_GeneWise6 Wise2_AlnRangeSet_from_GeneWise6 275 276 277 /* Function: convert_PackAln_to_AlnBlock_GeneWise6(pal) 278 * 279 * Descrip: Converts a path alignment to a label alignment 280 * The label alignment is probably much more useful than the path 281 * 282 * 283 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 284 * 285 * Return [UNKN ] Undocumented return value [AlnBlock *] 286 * 287 */ 288 AlnBlock * Wise2_convert_PackAln_to_AlnBlock_GeneWise6(PackAln * pal); 289 #define convert_PackAln_to_AlnBlock_GeneWise6 Wise2_convert_PackAln_to_AlnBlock_GeneWise6 290 291 292 /* Function: PackAln_read_Expl_GeneWise6(mat) 293 * 294 * Descrip: Reads off PackAln from explicit matrix structure 295 * 296 * 297 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 298 * 299 * Return [UNKN ] Undocumented return value [PackAln *] 300 * 301 */ 302 PackAln * Wise2_PackAln_read_Expl_GeneWise6(GeneWise6 * mat); 303 #define PackAln_read_Expl_GeneWise6 Wise2_PackAln_read_Expl_GeneWise6 304 305 306 /* Function: PackAln_read_generic_GeneWise6(mat,h) 307 * 308 * Descrip: Reads off PackAln from explicit matrix structure 309 * 310 * 311 * Arg: mat [UNKN ] Undocumented argument [GeneWise6 *] 312 * Arg: h [UNKN ] Undocumented argument [GeneWise6_access_func_holder] 313 * 314 * Return [UNKN ] Undocumented return value [PackAln *] 315 * 316 */ 317 PackAln * Wise2_PackAln_read_generic_GeneWise6(GeneWise6 * mat,GeneWise6_access_func_holder h); 318 #define PackAln_read_generic_GeneWise6 Wise2_PackAln_read_generic_GeneWise6 319 320 321 /* Function: calculate_GeneWise6(mat) 322 * 323 * Descrip: This function calculates the GeneWise6 matrix when in explicit mode 324 * To allocate the matrix use /allocate_Expl_GeneWise6 325 * 326 * 327 * Arg: mat [UNKN ] GeneWise6 which contains explicit basematrix memory [GeneWise6 *] 328 * 329 * Return [UNKN ] Undocumented return value [boolean] 330 * 331 */ 332 boolean Wise2_calculate_GeneWise6(GeneWise6 * mat); 333 #define calculate_GeneWise6 Wise2_calculate_GeneWise6 334 335 336 /* Function: calculate_dpenv_GeneWise6(mat,dpenv) 337 * 338 * Descrip: This function calculates the GeneWise6 matrix when in explicit mode, subject to the envelope 339 * 340 * 341 * Arg: mat [UNKN ] GeneWise6 which contains explicit basematrix memory [GeneWise6 *] 342 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 343 * 344 * Return [UNKN ] Undocumented return value [boolean] 345 * 346 */ 347 boolean Wise2_calculate_dpenv_GeneWise6(GeneWise6 * mat,DPEnvelope * dpenv); 348 #define calculate_dpenv_GeneWise6 Wise2_calculate_dpenv_GeneWise6 349 350 351 /* Function: GeneWise6_alloc(void) 352 * 353 * Descrip: Allocates structure: assigns defaults if given 354 * 355 * 356 * 357 * Return [UNKN ] Undocumented return value [GeneWise6 *] 358 * 359 */ 360 GeneWise6 * Wise2_GeneWise6_alloc(void); 361 #define GeneWise6_alloc Wise2_GeneWise6_alloc 362 363 364 /* Function: free_GeneWise6(obj) 365 * 366 * Descrip: Free Function: removes the memory held by obj 367 * Will chain up to owned members and clear all lists 368 * 369 * 370 * Arg: obj [UNKN ] Object that is free'd [GeneWise6 *] 371 * 372 * Return [UNKN ] Undocumented return value [GeneWise6 *] 373 * 374 */ 375 GeneWise6 * Wise2_free_GeneWise6(GeneWise6 * obj); 376 #define free_GeneWise6 Wise2_free_GeneWise6 377 378 379 /* Unplaced functions */ 380 /* There has been no indication of the use of these functions */ 381 382 383 /***************************************************/ 384 /* Internal functions */ 385 /* you are not expected to have to call these */ 386 /***************************************************/ 387 int Wise2_GeneWise6_shatter_access_main(GeneWise6 * mat,int i,int j,int state); 388 #define GeneWise6_shatter_access_main Wise2_GeneWise6_shatter_access_main 389 int Wise2_GeneWise6_shatter_access_special(GeneWise6 * mat,int i,int j,int state); 390 #define GeneWise6_shatter_access_special Wise2_GeneWise6_shatter_access_special 391 void * Wise2_thread_loop_GeneWise6(void * ptr); 392 #define thread_loop_GeneWise6 Wise2_thread_loop_GeneWise6 393 int Wise2_score_only_GeneWise6(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 394 #define score_only_GeneWise6 Wise2_score_only_GeneWise6 395 GeneWise6 * Wise2_allocate_GeneWise6_only(GeneWiseScore* query,ComplexSequence* target ,GeneParser4Score * gp); 396 #define allocate_GeneWise6_only Wise2_allocate_GeneWise6_only 397 void Wise2_init_GeneWise6(GeneWise6 * mat); 398 #define init_GeneWise6 Wise2_init_GeneWise6 399 AlnRange * Wise2_AlnRange_build_GeneWise6(GeneWise6 * mat,int stopj,int stopspecstate,int * startj,int * startspecstate); 400 #define AlnRange_build_GeneWise6 Wise2_AlnRange_build_GeneWise6 401 boolean Wise2_read_hidden_GeneWise6(GeneWise6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out); 402 #define read_hidden_GeneWise6 Wise2_read_hidden_GeneWise6 403 int Wise2_max_hidden_GeneWise6(GeneWise6 * mat,int hiddenj,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 404 #define max_hidden_GeneWise6 Wise2_max_hidden_GeneWise6 405 boolean Wise2_read_special_strip_GeneWise6(GeneWise6 * mat,int stopi,int stopj,int stopstate,int * startj,int * startstate,PackAln * out); 406 #define read_special_strip_GeneWise6 Wise2_read_special_strip_GeneWise6 407 int Wise2_max_special_strip_GeneWise6(GeneWise6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 408 #define max_special_strip_GeneWise6 Wise2_max_special_strip_GeneWise6 409 int Wise2_max_matrix_to_special_GeneWise6(GeneWise6 * mat,int i,int j,int state,int cscore,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 410 #define max_matrix_to_special_GeneWise6 Wise2_max_matrix_to_special_GeneWise6 411 void Wise2_calculate_hidden_GeneWise6(GeneWise6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv); 412 #define calculate_hidden_GeneWise6 Wise2_calculate_hidden_GeneWise6 413 void Wise2_init_hidden_GeneWise6(GeneWise6 * mat,int starti,int startj,int stopi,int stopj); 414 #define init_hidden_GeneWise6 Wise2_init_hidden_GeneWise6 415 boolean Wise2_full_dc_GeneWise6(GeneWise6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out,int * donej,int totalj,DPEnvelope * dpenv); 416 #define full_dc_GeneWise6 Wise2_full_dc_GeneWise6 417 boolean Wise2_do_dc_single_pass_GeneWise6(GeneWise6 * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv,int perc_done); 418 #define do_dc_single_pass_GeneWise6 Wise2_do_dc_single_pass_GeneWise6 419 void Wise2_push_dc_at_merge_GeneWise6(GeneWise6 * mat,int starti,int stopi,int startj,int * stopj,DPEnvelope * dpenv); 420 #define push_dc_at_merge_GeneWise6 Wise2_push_dc_at_merge_GeneWise6 421 void Wise2_follow_on_dc_GeneWise6(GeneWise6 * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 422 #define follow_on_dc_GeneWise6 Wise2_follow_on_dc_GeneWise6 423 void Wise2_run_up_dc_GeneWise6(GeneWise6 * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 424 #define run_up_dc_GeneWise6 Wise2_run_up_dc_GeneWise6 425 void Wise2_init_dc_GeneWise6(GeneWise6 * mat); 426 #define init_dc_GeneWise6 Wise2_init_dc_GeneWise6 427 int Wise2_start_end_find_end_GeneWise6(GeneWise6 * mat,int * endj); 428 #define start_end_find_end_GeneWise6 Wise2_start_end_find_end_GeneWise6 429 boolean Wise2_dc_optimised_start_end_calc_GeneWise6(GeneWise6 *mat,DPEnvelope * dpenv); 430 #define dc_optimised_start_end_calc_GeneWise6 Wise2_dc_optimised_start_end_calc_GeneWise6 431 void Wise2_init_start_end_linear_GeneWise6(GeneWise6 * mat); 432 #define init_start_end_linear_GeneWise6 Wise2_init_start_end_linear_GeneWise6 433 AlnConvertSet * Wise2_AlnConvertSet_GeneWise6(void); 434 #define AlnConvertSet_GeneWise6 Wise2_AlnConvertSet_GeneWise6 435 int Wise2_GeneWise6_explicit_access_main(GeneWise6 * mat,int i,int j,int state); 436 #define GeneWise6_explicit_access_main Wise2_GeneWise6_explicit_access_main 437 int Wise2_GeneWise6_explicit_access_special(GeneWise6 * mat,int i,int j,int state); 438 #define GeneWise6_explicit_access_special Wise2_GeneWise6_explicit_access_special 439 int Wise2_find_end_GeneWise6(GeneWise6 * mat,int * ri,int * rj,int * state,boolean * isspecial,GeneWise6_access_func_holder h); 440 #define find_end_GeneWise6 Wise2_find_end_GeneWise6 441 void Wise2_GeneWise6_debug_show_matrix(GeneWise6 * mat,int starti,int stopi,int startj,int stopj,FILE * ofp); 442 #define GeneWise6_debug_show_matrix Wise2_GeneWise6_debug_show_matrix 443 int Wise2_max_calc_GeneWise6(GeneWise6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,GeneWise6_access_func_holder h); 444 #define max_calc_GeneWise6 Wise2_max_calc_GeneWise6 445 int Wise2_max_calc_special_GeneWise6(GeneWise6 * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,GeneWise6_access_func_holder h); 446 #define max_calc_special_GeneWise6 Wise2_max_calc_special_GeneWise6 447 448 #ifdef _cplusplus 449 } 450 #endif 451 452 #endif 453