1 #ifndef DYNAMITEthreestatedpHEADERFILE 2 #define DYNAMITEthreestatedpHEADERFILE 3 #ifdef _cplusplus 4 extern "C" { 5 #endif 6 #include "threestatemodel.h" 7 8 9 struct Wise2_ThreeStateProtein { 10 int dynamite_hard_link; 11 #ifdef PTHREAD 12 pthread_mutex_t dynamite_mutex; 13 #endif 14 BaseMatrix * basematrix; 15 ShatterMatrix * shatter; 16 int leni; 17 int lenj; 18 ThreeStateScore* query; 19 ComplexSequence* target; 20 } ; 21 /* ThreeStateProtein defined */ 22 #ifndef DYNAMITE_DEFINED_ThreeStateProtein 23 typedef struct Wise2_ThreeStateProtein Wise2_ThreeStateProtein; 24 #define ThreeStateProtein Wise2_ThreeStateProtein 25 #define DYNAMITE_DEFINED_ThreeStateProtein 26 #endif 27 28 29 #ifdef PTHREAD 30 struct thread_pool_holder_ThreeStateProtein { 31 ThreeStateScore* query; /* Static query data: never free'd */ 32 ComplexSequence* target;/* Target object placeholder */ 33 ProteinDB* targetdb;/* Target database object */ 34 boolean target_init; 35 pthread_mutex_t input_lock; 36 pthread_mutex_t output_lock; 37 Hscore * out; 38 pthread_t * pool; 39 int number_of_threads; 40 boolean search_has_ended; 41 DBSearchImpl * dbsi; 42 } ; 43 #endif /* PTHREAD */ 44 struct Wise2_ThreeStateProtein_access_func_holder { 45 int dynamite_hard_link; 46 #ifdef PTHREAD 47 pthread_mutex_t dynamite_mutex; 48 #endif 49 int (*access_main)(ThreeStateProtein*,int,int,int); 50 int (*access_special)(ThreeStateProtein*,int,int,int); 51 } ; 52 /* ThreeStateProtein_access_func_holder defined */ 53 #ifndef DYNAMITE_DEFINED_ThreeStateProtein_access_func_holder 54 typedef struct Wise2_ThreeStateProtein_access_func_holder Wise2_ThreeStateProtein_access_func_holder; 55 #define ThreeStateProtein_access_func_holder Wise2_ThreeStateProtein_access_func_holder 56 #define DYNAMITE_DEFINED_ThreeStateProtein_access_func_holder 57 #endif 58 59 60 61 62 /***************************************************/ 63 /* Callable functions */ 64 /* These are the functions you are expected to use */ 65 /***************************************************/ 66 67 68 69 /* Function: PackAln_read_Shatter_ThreeStateProtein(mat) 70 * 71 * Descrip: Reads off PackAln from shatter matrix structure 72 * 73 * 74 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 75 * 76 * Return [UNKN ] Undocumented return value [PackAln *] 77 * 78 */ 79 PackAln * Wise2_PackAln_read_Shatter_ThreeStateProtein(ThreeStateProtein * mat); 80 #define PackAln_read_Shatter_ThreeStateProtein Wise2_PackAln_read_Shatter_ThreeStateProtein 81 82 83 /* Function: calculate_shatter_ThreeStateProtein(mat,dpenv) 84 * 85 * Descrip: This function calculates the ThreeStateProtein matrix when in shatter mode 86 * 87 * 88 * Arg: mat [UNKN ] (null) [ThreeStateProtein *] 89 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 90 * 91 * Return [UNKN ] Undocumented return value [boolean] 92 * 93 */ 94 boolean Wise2_calculate_shatter_ThreeStateProtein(ThreeStateProtein * mat,DPEnvelope * dpenv); 95 #define calculate_shatter_ThreeStateProtein Wise2_calculate_shatter_ThreeStateProtein 96 97 98 /* Function: search_ThreeStateProtein(dbsi,out,query,targetdb) 99 * 100 * Descrip: This function makes a database search of ThreeStateProtein 101 * It uses the dbsi structure to choose which implementation 102 * to use of the database searching. This way at run time you 103 * can switch between single threaded/multi-threaded or hardware 104 * 105 * 106 * Arg: dbsi [UNKN ] Undocumented argument [DBSearchImpl *] 107 * Arg: out [UNKN ] Undocumented argument [Hscore *] 108 * Arg: query [UNKN ] Undocumented argument [ThreeStateScore*] 109 * Arg: targetdb [UNKN ] Undocumented argument [ProteinDB*] 110 * 111 * Return [UNKN ] Undocumented return value [Search_Return_Type] 112 * 113 */ 114 Search_Return_Type Wise2_search_ThreeStateProtein(DBSearchImpl * dbsi,Hscore * out,ThreeStateScore* query,ProteinDB* targetdb ); 115 #define search_ThreeStateProtein Wise2_search_ThreeStateProtein 116 117 118 /* Function: serial_search_ThreeStateProtein(out,query,targetdb) 119 * 120 * Descrip: This function makes a database search of ThreeStateProtein 121 * It is a single processor implementation 122 * 123 * 124 * Arg: out [UNKN ] Undocumented argument [Hscore *] 125 * Arg: query [UNKN ] Undocumented argument [ThreeStateScore*] 126 * Arg: targetdb [UNKN ] Undocumented argument [ProteinDB*] 127 * 128 * Return [UNKN ] Undocumented return value [Search_Return_Type] 129 * 130 */ 131 Search_Return_Type Wise2_serial_search_ThreeStateProtein(Hscore * out,ThreeStateScore* query,ProteinDB* targetdb ); 132 #define serial_search_ThreeStateProtein Wise2_serial_search_ThreeStateProtein 133 134 135 /* Function: PackAln_bestmemory_ThreeStateProtein(query,target,dpenv,dpri) 136 * 137 * Descrip: This function chooses the best memory set-up for the alignment 138 * using calls to basematrix, and then implements either a large 139 * or small memory model. 140 * 141 * It is the best function to use if you just want an alignment 142 * 143 * If you want a label alignment, you will need 144 * /convert_PackAln_to_AlnBlock_ThreeStateProtein 145 * 146 * 147 * Arg: query [UNKN ] query data structure [ThreeStateScore*] 148 * Arg: target [UNKN ] target data structure [ComplexSequence*] 149 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 150 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 151 * 152 * Return [UNKN ] Undocumented return value [PackAln *] 153 * 154 */ 155 PackAln * Wise2_PackAln_bestmemory_ThreeStateProtein(ThreeStateScore* query,ComplexSequence* target ,DPEnvelope * dpenv,DPRunImpl * dpri); 156 #define PackAln_bestmemory_ThreeStateProtein Wise2_PackAln_bestmemory_ThreeStateProtein 157 158 159 /* Function: allocate_Expl_ThreeStateProtein(query,target,dpri) 160 * 161 * Descrip: This function allocates the ThreeStateProtein structure 162 * and the basematrix area for explicit memory implementations 163 * It calls /allocate_ThreeStateProtein_only 164 * 165 * 166 * Arg: query [UNKN ] query data structure [ThreeStateScore*] 167 * Arg: target [UNKN ] target data structure [ComplexSequence*] 168 * Arg: dpri [UNKN ] Undocumented argument [DPRunImpl *] 169 * 170 * Return [UNKN ] Undocumented return value [ThreeStateProtein *] 171 * 172 */ 173 ThreeStateProtein * Wise2_allocate_Expl_ThreeStateProtein(ThreeStateScore* query,ComplexSequence* target ,DPRunImpl * dpri); 174 #define allocate_Expl_ThreeStateProtein Wise2_allocate_Expl_ThreeStateProtein 175 176 177 /* Function: recalculate_PackAln_ThreeStateProtein(pal,mat) 178 * 179 * Descrip: This function recalculates the PackAln structure produced by ThreeStateProtein 180 * For example, in linear space methods this is used to score them 181 * 182 * 183 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 184 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 185 * 186 */ 187 void Wise2_recalculate_PackAln_ThreeStateProtein(PackAln * pal,ThreeStateProtein * mat); 188 #define recalculate_PackAln_ThreeStateProtein Wise2_recalculate_PackAln_ThreeStateProtein 189 190 191 /* Function: allocate_Small_ThreeStateProtein(query,target) 192 * 193 * Descrip: This function allocates the ThreeStateProtein structure 194 * and the basematrix area for a small memory implementations 195 * It calls /allocate_ThreeStateProtein_only 196 * 197 * 198 * Arg: query [UNKN ] query data structure [ThreeStateScore*] 199 * Arg: target [UNKN ] target data structure [ComplexSequence*] 200 * 201 * Return [UNKN ] Undocumented return value [ThreeStateProtein *] 202 * 203 */ 204 ThreeStateProtein * Wise2_allocate_Small_ThreeStateProtein(ThreeStateScore* query,ComplexSequence* target ); 205 #define allocate_Small_ThreeStateProtein Wise2_allocate_Small_ThreeStateProtein 206 207 208 /* Function: PackAln_calculate_Small_ThreeStateProtein(mat,dpenv) 209 * 210 * Descrip: This function calculates an alignment for ThreeStateProtein structure in linear space 211 * If you want only the start/end points 212 * use /AlnRangeSet_calculate_Small_ThreeStateProtein 213 * 214 * The function basically 215 * finds start/end points 216 * foreach start/end point 217 * calls /full_dc_ThreeStateProtein 218 * 219 * 220 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 221 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 222 * 223 * Return [UNKN ] Undocumented return value [PackAln *] 224 * 225 */ 226 PackAln * Wise2_PackAln_calculate_Small_ThreeStateProtein(ThreeStateProtein * mat,DPEnvelope * dpenv); 227 #define PackAln_calculate_Small_ThreeStateProtein Wise2_PackAln_calculate_Small_ThreeStateProtein 228 229 230 /* Function: AlnRangeSet_calculate_Small_ThreeStateProtein(mat) 231 * 232 * Descrip: This function calculates an alignment for ThreeStateProtein structure in linear space 233 * If you want the full alignment, use /PackAln_calculate_Small_ThreeStateProtein 234 * If you have already got the full alignment, but want the range set, use /AlnRangeSet_from_PackAln_ThreeStateProtein 235 * If you have got the small matrix but not the alignment, use /AlnRangeSet_from_ThreeStateProtein 236 * 237 * 238 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 239 * 240 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 241 * 242 */ 243 AlnRangeSet * Wise2_AlnRangeSet_calculate_Small_ThreeStateProtein(ThreeStateProtein * mat); 244 #define AlnRangeSet_calculate_Small_ThreeStateProtein Wise2_AlnRangeSet_calculate_Small_ThreeStateProtein 245 246 247 /* Function: AlnRangeSet_from_ThreeStateProtein(mat) 248 * 249 * Descrip: This function reads off a start/end structure 250 * for ThreeStateProtein structure in linear space 251 * If you want the full alignment use 252 * /PackAln_calculate_Small_ThreeStateProtein 253 * If you have not calculated the matrix use 254 * /AlnRange_calculate_Small_ThreeStateProtein 255 * 256 * 257 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 258 * 259 * Return [UNKN ] Undocumented return value [AlnRangeSet *] 260 * 261 */ 262 AlnRangeSet * Wise2_AlnRangeSet_from_ThreeStateProtein(ThreeStateProtein * mat); 263 #define AlnRangeSet_from_ThreeStateProtein Wise2_AlnRangeSet_from_ThreeStateProtein 264 265 266 /* Function: convert_PackAln_to_AlnBlock_ThreeStateProtein(pal) 267 * 268 * Descrip: Converts a path alignment to a label alignment 269 * The label alignment is probably much more useful than the path 270 * 271 * 272 * Arg: pal [UNKN ] Undocumented argument [PackAln *] 273 * 274 * Return [UNKN ] Undocumented return value [AlnBlock *] 275 * 276 */ 277 AlnBlock * Wise2_convert_PackAln_to_AlnBlock_ThreeStateProtein(PackAln * pal); 278 #define convert_PackAln_to_AlnBlock_ThreeStateProtein Wise2_convert_PackAln_to_AlnBlock_ThreeStateProtein 279 280 281 /* Function: PackAln_read_Expl_ThreeStateProtein(mat) 282 * 283 * Descrip: Reads off PackAln from explicit matrix structure 284 * 285 * 286 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 287 * 288 * Return [UNKN ] Undocumented return value [PackAln *] 289 * 290 */ 291 PackAln * Wise2_PackAln_read_Expl_ThreeStateProtein(ThreeStateProtein * mat); 292 #define PackAln_read_Expl_ThreeStateProtein Wise2_PackAln_read_Expl_ThreeStateProtein 293 294 295 /* Function: PackAln_read_generic_ThreeStateProtein(mat,h) 296 * 297 * Descrip: Reads off PackAln from explicit matrix structure 298 * 299 * 300 * Arg: mat [UNKN ] Undocumented argument [ThreeStateProtein *] 301 * Arg: h [UNKN ] Undocumented argument [ThreeStateProtein_access_func_holder] 302 * 303 * Return [UNKN ] Undocumented return value [PackAln *] 304 * 305 */ 306 PackAln * Wise2_PackAln_read_generic_ThreeStateProtein(ThreeStateProtein * mat,ThreeStateProtein_access_func_holder h); 307 #define PackAln_read_generic_ThreeStateProtein Wise2_PackAln_read_generic_ThreeStateProtein 308 309 310 /* Function: calculate_ThreeStateProtein(mat) 311 * 312 * Descrip: This function calculates the ThreeStateProtein matrix when in explicit mode 313 * To allocate the matrix use /allocate_Expl_ThreeStateProtein 314 * 315 * 316 * Arg: mat [UNKN ] ThreeStateProtein which contains explicit basematrix memory [ThreeStateProtein *] 317 * 318 * Return [UNKN ] Undocumented return value [boolean] 319 * 320 */ 321 boolean Wise2_calculate_ThreeStateProtein(ThreeStateProtein * mat); 322 #define calculate_ThreeStateProtein Wise2_calculate_ThreeStateProtein 323 324 325 /* Function: calculate_dpenv_ThreeStateProtein(mat,dpenv) 326 * 327 * Descrip: This function calculates the ThreeStateProtein matrix when in explicit mode, subject to the envelope 328 * 329 * 330 * Arg: mat [UNKN ] ThreeStateProtein which contains explicit basematrix memory [ThreeStateProtein *] 331 * Arg: dpenv [UNKN ] Undocumented argument [DPEnvelope *] 332 * 333 * Return [UNKN ] Undocumented return value [boolean] 334 * 335 */ 336 boolean Wise2_calculate_dpenv_ThreeStateProtein(ThreeStateProtein * mat,DPEnvelope * dpenv); 337 #define calculate_dpenv_ThreeStateProtein Wise2_calculate_dpenv_ThreeStateProtein 338 339 340 /* Function: ThreeStateProtein_alloc(void) 341 * 342 * Descrip: Allocates structure: assigns defaults if given 343 * 344 * 345 * 346 * Return [UNKN ] Undocumented return value [ThreeStateProtein *] 347 * 348 */ 349 ThreeStateProtein * Wise2_ThreeStateProtein_alloc(void); 350 #define ThreeStateProtein_alloc Wise2_ThreeStateProtein_alloc 351 352 353 /* Function: free_ThreeStateProtein(obj) 354 * 355 * Descrip: Free Function: removes the memory held by obj 356 * Will chain up to owned members and clear all lists 357 * 358 * 359 * Arg: obj [UNKN ] Object that is free'd [ThreeStateProtein *] 360 * 361 * Return [UNKN ] Undocumented return value [ThreeStateProtein *] 362 * 363 */ 364 ThreeStateProtein * Wise2_free_ThreeStateProtein(ThreeStateProtein * obj); 365 #define free_ThreeStateProtein Wise2_free_ThreeStateProtein 366 367 368 /* Unplaced functions */ 369 /* There has been no indication of the use of these functions */ 370 371 372 /***************************************************/ 373 /* Internal functions */ 374 /* you are not expected to have to call these */ 375 /***************************************************/ 376 int Wise2_ThreeStateProtein_shatter_access_main(ThreeStateProtein * mat,int i,int j,int state); 377 #define ThreeStateProtein_shatter_access_main Wise2_ThreeStateProtein_shatter_access_main 378 int Wise2_ThreeStateProtein_shatter_access_special(ThreeStateProtein * mat,int i,int j,int state); 379 #define ThreeStateProtein_shatter_access_special Wise2_ThreeStateProtein_shatter_access_special 380 void * Wise2_thread_loop_ThreeStateProtein(void * ptr); 381 #define thread_loop_ThreeStateProtein Wise2_thread_loop_ThreeStateProtein 382 int Wise2_score_only_ThreeStateProtein(ThreeStateScore* query,ComplexSequence* target ); 383 #define score_only_ThreeStateProtein Wise2_score_only_ThreeStateProtein 384 ThreeStateProtein * Wise2_allocate_ThreeStateProtein_only(ThreeStateScore* query,ComplexSequence* target ); 385 #define allocate_ThreeStateProtein_only Wise2_allocate_ThreeStateProtein_only 386 void Wise2_init_ThreeStateProtein(ThreeStateProtein * mat); 387 #define init_ThreeStateProtein Wise2_init_ThreeStateProtein 388 AlnRange * Wise2_AlnRange_build_ThreeStateProtein(ThreeStateProtein * mat,int stopj,int stopspecstate,int * startj,int * startspecstate); 389 #define AlnRange_build_ThreeStateProtein Wise2_AlnRange_build_ThreeStateProtein 390 boolean Wise2_read_hidden_ThreeStateProtein(ThreeStateProtein * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out); 391 #define read_hidden_ThreeStateProtein Wise2_read_hidden_ThreeStateProtein 392 int Wise2_max_hidden_ThreeStateProtein(ThreeStateProtein * mat,int hiddenj,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 393 #define max_hidden_ThreeStateProtein Wise2_max_hidden_ThreeStateProtein 394 boolean Wise2_read_special_strip_ThreeStateProtein(ThreeStateProtein * mat,int stopi,int stopj,int stopstate,int * startj,int * startstate,PackAln * out); 395 #define read_special_strip_ThreeStateProtein Wise2_read_special_strip_ThreeStateProtein 396 int Wise2_max_special_strip_ThreeStateProtein(ThreeStateProtein * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 397 #define max_special_strip_ThreeStateProtein Wise2_max_special_strip_ThreeStateProtein 398 int Wise2_max_matrix_to_special_ThreeStateProtein(ThreeStateProtein * mat,int i,int j,int state,int cscore,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore); 399 #define max_matrix_to_special_ThreeStateProtein Wise2_max_matrix_to_special_ThreeStateProtein 400 void Wise2_calculate_hidden_ThreeStateProtein(ThreeStateProtein * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv); 401 #define calculate_hidden_ThreeStateProtein Wise2_calculate_hidden_ThreeStateProtein 402 void Wise2_init_hidden_ThreeStateProtein(ThreeStateProtein * mat,int starti,int startj,int stopi,int stopj); 403 #define init_hidden_ThreeStateProtein Wise2_init_hidden_ThreeStateProtein 404 boolean Wise2_full_dc_ThreeStateProtein(ThreeStateProtein * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,PackAln * out,int * donej,int totalj,DPEnvelope * dpenv); 405 #define full_dc_ThreeStateProtein Wise2_full_dc_ThreeStateProtein 406 boolean Wise2_do_dc_single_pass_ThreeStateProtein(ThreeStateProtein * mat,int starti,int startj,int startstate,int stopi,int stopj,int stopstate,DPEnvelope * dpenv,int perc_done); 407 #define do_dc_single_pass_ThreeStateProtein Wise2_do_dc_single_pass_ThreeStateProtein 408 void Wise2_push_dc_at_merge_ThreeStateProtein(ThreeStateProtein * mat,int starti,int stopi,int startj,int * stopj,DPEnvelope * dpenv); 409 #define push_dc_at_merge_ThreeStateProtein Wise2_push_dc_at_merge_ThreeStateProtein 410 void Wise2_follow_on_dc_ThreeStateProtein(ThreeStateProtein * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 411 #define follow_on_dc_ThreeStateProtein Wise2_follow_on_dc_ThreeStateProtein 412 void Wise2_run_up_dc_ThreeStateProtein(ThreeStateProtein * mat,int starti,int stopi,int startj,int stopj,DPEnvelope * dpenv,int perc_done); 413 #define run_up_dc_ThreeStateProtein Wise2_run_up_dc_ThreeStateProtein 414 void Wise2_init_dc_ThreeStateProtein(ThreeStateProtein * mat); 415 #define init_dc_ThreeStateProtein Wise2_init_dc_ThreeStateProtein 416 int Wise2_start_end_find_end_ThreeStateProtein(ThreeStateProtein * mat,int * endj); 417 #define start_end_find_end_ThreeStateProtein Wise2_start_end_find_end_ThreeStateProtein 418 boolean Wise2_dc_optimised_start_end_calc_ThreeStateProtein(ThreeStateProtein *mat,DPEnvelope * dpenv); 419 #define dc_optimised_start_end_calc_ThreeStateProtein Wise2_dc_optimised_start_end_calc_ThreeStateProtein 420 void Wise2_init_start_end_linear_ThreeStateProtein(ThreeStateProtein * mat); 421 #define init_start_end_linear_ThreeStateProtein Wise2_init_start_end_linear_ThreeStateProtein 422 AlnConvertSet * Wise2_AlnConvertSet_ThreeStateProtein(void); 423 #define AlnConvertSet_ThreeStateProtein Wise2_AlnConvertSet_ThreeStateProtein 424 int Wise2_ThreeStateProtein_explicit_access_main(ThreeStateProtein * mat,int i,int j,int state); 425 #define ThreeStateProtein_explicit_access_main Wise2_ThreeStateProtein_explicit_access_main 426 int Wise2_ThreeStateProtein_explicit_access_special(ThreeStateProtein * mat,int i,int j,int state); 427 #define ThreeStateProtein_explicit_access_special Wise2_ThreeStateProtein_explicit_access_special 428 int Wise2_find_end_ThreeStateProtein(ThreeStateProtein * mat,int * ri,int * rj,int * state,boolean * isspecial,ThreeStateProtein_access_func_holder h); 429 #define find_end_ThreeStateProtein Wise2_find_end_ThreeStateProtein 430 void Wise2_ThreeStateProtein_debug_show_matrix(ThreeStateProtein * mat,int starti,int stopi,int startj,int stopj,FILE * ofp); 431 #define ThreeStateProtein_debug_show_matrix Wise2_ThreeStateProtein_debug_show_matrix 432 int Wise2_max_calc_ThreeStateProtein(ThreeStateProtein * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,ThreeStateProtein_access_func_holder h); 433 #define max_calc_ThreeStateProtein Wise2_max_calc_ThreeStateProtein 434 int Wise2_max_calc_special_ThreeStateProtein(ThreeStateProtein * mat,int i,int j,int state,boolean isspecial,int * reti,int * retj,int * retstate,boolean * retspecial,int * cellscore,ThreeStateProtein_access_func_holder h); 435 #define max_calc_special_ThreeStateProtein Wise2_max_calc_special_ThreeStateProtein 436 437 #ifdef _cplusplus 438 } 439 #endif 440 441 #endif 442