00001 #include "../headers/tpocket.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 void test_fpocket(s_tparams *par)
00083 {
00084 if(! par || par->nfiles <= 0) return ;
00085
00086 int nranks = 13, novlp = 5, novlp2 = 9,novlp3 = 8,
00087 i, j, k, nok = 0 ;
00088 int ranks [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 50} ;
00089 float ovlp[] = {50.0, 60.0, 70.0, 80.0,90.0} ;
00090 float ovlp2[] = {0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.9, 1.0} ;
00091 float ovlp3[] = {0.2, 0.25, 0.3, 0.35, 0.4, 0.5, 0.6, 0.7} ;
00092
00093 float mean_ov1 = 0.0, mean_ov2 = 0.0, mean_dst = 0.0, mean_ov4 = 0.0, mean_ov5 = 0.0,
00094 mean_ovr1 = 0.0, mean_ovr2 = 0.0, mean_ovr3 = 0.0, mean_ovr4 = 0.0, mean_ovr5 = 0.0, mean_ovr6 = 0.0,
00095 mean_pvol3 = 0.0, mean_pvol6 = 0.0 ;
00096
00097 float mean_lvol = 0.0 ;
00098 int mean_nbatm3 = 0, mean_nbatm6 = 0 ;
00099
00100 int n1, n2, n3, n4, n5, n6, N = 0 ;
00101
00102
00103 int status[par->nfiles] ;
00104 float ddata [par->nfiles][M_NDDATA];
00105 int idata [par->nfiles][M_NIDATA];
00106
00107
00108 for(i = 0 ; i < par->nfiles ; i++) {
00109 strcpy(par->fpar->pdb_path, par->fapo[i]) ;
00110 status [i] = test_set(par, i, ddata, idata) ;
00111 fprintf(stdout, "> %3d : %s output code %d", i+1, par->fapo[i],
00112 status [i]) ;
00113 if(i == par->nfiles - 1) fprintf(stdout, "\n") ;
00114 else fprintf(stdout, "\r") ;
00115 fflush(stdout) ;
00116
00117 if(status[i] == M_OK) N++ ;
00118 }
00119
00120
00121 FILE *fp = fopen(par->p_output, "w") ;
00122 if(fp) {
00123 n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0 ;
00124 fprintf(fp, "LIG | COMPLEXE | APO | NB_PCK | CRIT1 | CRIT2 | CRIT3 | CRIT4 | CRIT5 | CRIT6 | POS1 | POS2 | POS3 | POS4 | POS5 | POS6 | REL_OVLP1 | REL_OVLP2 | REL_OVLP3 | REL_OVLP4 | REL_OVLP5 | REL_OVLP6 | LIGMASS | LIGVOL | PVOL3 | NATM3 | PVOL6 | NATM6 \n") ;
00125 for(i = 0 ; i < par->nfiles ; i++) {
00126 remove_path(par->fcomplex[i]) ;
00127 remove_path(par->fapo[i]) ;
00128 if(status[i] == M_OK) {
00129 fprintf(fp, "%s %s %s %5d %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %4d %4d %4d %4d %4d %4d %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %9.2f %9.2f %12.2f %4d %12.2f %4d\n",
00130 par->fligan[i], par->fcomplex[i], par->fapo[i], idata[i][M_NPOCKET],
00131 ddata[i][M_MAXPCT1], ddata[i][M_MAXPCT2], ddata[i][M_MINDST], ddata[i][M_CRIT4], ddata[i][M_CRIT5], ddata[i][M_CRIT6],
00132 idata[i][M_POS1], idata[i][M_POS2], idata[i][M_POS3], idata[i][M_POS4], idata[i][M_POS5], idata[i][M_POS6],
00133 ddata[i][M_OREL1], ddata[i][M_OREL2], ddata[i][M_OREL3], ddata[i][M_OREL4], ddata[i][M_OREL5], ddata[i][M_OREL6],
00134 ddata[i][M_LIGMASS], ddata[i][M_LIGVOL], ddata[i][M_POCKETVOL_C3], idata[i][M_NATM3], ddata[i][M_POCKETVOL_C6], idata[i][M_NATM6]) ;
00135
00136 if(idata[i][M_POS1] > 0) {
00137 mean_ov1 += ddata[i][M_MAXPCT1] ;
00138 mean_ovr1 += ddata[i][M_OREL1];
00139 n1++ ;
00140 }
00141
00142 if(idata[i][M_POS2] > 0) {
00143 mean_ov2 += ddata[i][M_MAXPCT2] ;
00144 mean_ovr2 += ddata[i][M_OREL2];
00145 n2++ ;
00146 }
00147
00148 if(idata[i][M_POS3] > 0) {
00149 mean_dst += ddata[i][M_MINDST];
00150 mean_ovr3 += ddata[i][M_OREL3];
00151 mean_pvol3 += ddata[i][M_POCKETVOL_C3] ;
00152 mean_nbatm3 += idata[i][M_NATM3] ;
00153 n3 ++ ;
00154 }
00155
00156 if(idata[i][M_POS4] > 0) {
00157 mean_ov4 += ddata[i][M_CRIT4];
00158 mean_ovr4 += ddata[i][M_OREL4];
00159 n4 ++ ;
00160 }
00161
00162 if(idata[i][M_POS5] > 0) {
00163 mean_ov5 += ddata[i][M_CRIT5];
00164 mean_ovr5 += ddata[i][M_OREL5];
00165 n5 ++ ;
00166 }
00167
00168 if(idata[i][M_POS6] > 0) {
00169 mean_ovr6 += ddata[i][M_OREL5];
00170 mean_pvol6 += ddata[i][M_POCKETVOL_C6] ;
00171 mean_nbatm6 += idata[i][M_NATM6] ;
00172 n6 ++ ;
00173 }
00174 }
00175 else {
00176 fprintf(fp, "%s %s %s %5d %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %4d %4d %4d %4d %4d %4d %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %9.2f %9.2f %12.2f %4d %12.2f %4d \n",
00177 par->fligan[i], par->fcomplex[i], par->fapo[i], -1,
00178 -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
00179 -1, -1, -1, -1, -1, -1,
00180 -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
00181 -1.0, -1.0, -1.0, -1, -1.0, -1) ;
00182 }
00183 mean_lvol += ddata[i][M_LIGVOL] ;
00184 }
00185
00186 mean_ov1 /= (float) n1 ; mean_ovr1 /= (float) n1 ;
00187 mean_ov2 /= (float) n2 ; mean_ovr2 /= (float) n2 ;
00188
00189 mean_dst /= (float) n3 ; mean_ovr3 /= (float) n3 ;
00190 mean_pvol3 /= (float) n3 ;
00191 mean_nbatm3 /= (float) n3 ;
00192
00193 mean_ov4 /= (float) n4 ; mean_ovr4 /= (float) n4 ;
00194 mean_ov5 /= (float) n5 ; mean_ovr5 /= (float) n5 ;
00195
00196 mean_ovr6 /= (float) n6 ;
00197 mean_pvol6 /= (float) n6 ;
00198 mean_nbatm6 /= (float) n6 ;
00199
00200 mean_lvol /= (float) par->nfiles ;
00201
00202 fclose(fp) ;
00203 }
00204 else fprintf(stdout, "The file %s could not be opened\n", par->p_output) ;
00205
00206
00207 FILE *fg = fopen(par->g_output, "w") ;
00208 if(fg) {
00209
00210 fprintf(fg, "===================== General statistics on all complexes =======================\n") ;
00211
00212
00213
00214 fprintf(fg, "\n\t--\n") ;
00215 fprintf(fg, "\t- _ Distance criteria _ -\n") ;
00216 fprintf(fg, "\t--\n\n") ;
00217 fprintf(fg, " Ratio of good predictions (dist = 4A) \n") ;
00218 fprintf(fg, "\n") ;
00219
00220 for(i = 0 ; i < nranks ; i++) {
00221 nok = 0 ;
00222 for(k = 0 ; k < par->nfiles ; k++) {
00223 if(status[k] == M_OK && idata[k][M_POS3] <= ranks[i]
00224 && idata[k][M_POS3] > 0) {
00225 nok ++ ;
00226 }
00227 }
00228
00229 fprintf(fg, "Rank <= %2d :\t\t%6.2f\n", ranks[i],
00230 ((float)nok) / ((float) N)) ;
00231 }
00232
00233 fprintf(fg, "-\n") ;
00234 fprintf(fg, "Mean distance : %8.2f\n", mean_dst) ;
00235 fprintf(fg, "Mean relative overlap : %8.2f\n", mean_ovr3) ;
00236 fprintf(fg, "Mean pocket volume (estimation) : %8.2f\n", mean_pvol3) ;
00237 fprintf(fg, "Mean ligand volume (estimation) : %8.2f\n", mean_lvol) ;
00238 fprintf(fg, "Mean number of pocket atom : %4d\n", mean_nbatm3) ;
00239
00240
00241
00242 fprintf(fg, "\n\t--\n") ;
00243 fprintf(fg, "\t- _ 1st overlap criteria (use of ligand's alpha sphere neighbors)_ -\n") ;
00244 fprintf(fg, "\t--\n\n") ;
00245 fprintf(fg," :");
00246 for( j = 0 ; j < novlp ; j++) {
00247 fprintf(fg, " >%5.2f :", ovlp[j]) ;
00248 }
00249 fprintf(fg,"\n");
00250 fprintf(fg,"--");
00251 for( j = 0 ; j < novlp ; j++) {
00252 fprintf(fg, "-") ;
00253 }
00254 fprintf(fg,"\n");
00255
00256 for(i = 0 ; i < nranks ; i++) {
00257 fprintf(fg, "Rank <= %2d :", ranks[i]) ;
00258 for( j = 0 ; j < novlp ; j++) {
00259 nok = 0 ;
00260 for(k = 0 ; k < par->nfiles ; k++) {
00261 if( status[k] == M_OK &&
00262 ddata[k][M_MAXPCT2] >= ovlp[j] &&
00263 idata[k][M_POS2] <= ranks[i] &&
00264 idata[k][M_POS2] > 0) {
00265 nok ++ ;
00266 }
00267 }
00268 fprintf(fg, " %6.2f :", ((float)nok) / ((float) N)) ;
00269 }
00270 fprintf(fg, "\n") ;
00271 }
00272 fprintf(fg, "-\n") ;
00273 fprintf(fg, "Mean overlap : %8.2f\n", mean_ov2) ;
00274 fprintf(fg, "Mean relative overlap : %8.2f\n", mean_ovr2) ;
00275
00276
00277
00278 fprintf(fg, "\n\t--\n") ;
00279 fprintf(fg, "\t- _ 2nd overlap criteria (simple distance criteria) _ -\n") ;
00280 fprintf(fg, "\t--\n\n") ;
00281 fprintf(fg," :");
00282
00283 for( j = 0 ; j < novlp ; j++) {
00284 fprintf(fg, " >%5.2f :", ovlp[j]) ;
00285 }
00286
00287 fprintf(fg,"\n");
00288 fprintf(fg,"---");
00289
00290 for( j = 0 ; j < novlp ; j++) {
00291 fprintf(fg, "-") ;
00292 }
00293 fprintf(fg,"\n");
00294
00295 for(i = 0 ; i < nranks ; i++) {
00296 fprintf(fg, "Rank <= %2d :", ranks[i]) ;
00297 for( j = 0 ; j < novlp ; j++) {
00298 nok = 0 ;
00299 for(k = 0 ; k < par->nfiles ; k++) {
00300 if( status[k] == M_OK
00301 && ddata[k][M_MAXPCT1] >= ovlp[j]
00302 && idata[k][M_POS1] <= ranks[i]
00303 && idata[k][M_POS1] > 0) {
00304 nok ++ ;
00305 }
00306 }
00307 fprintf(fg, " %6.2f :", ((float)nok) / ((float) N)) ;
00308 }
00309 fprintf(fg, "\n") ;
00310 }
00311 fprintf(fg, "-\n") ;
00312 fprintf(fg, "Mean overlap : %f\n", mean_ov1) ;
00313 fprintf(fg, "Mean relative overlap : %f\n", mean_ovr1) ;
00314
00315
00316
00317 fprintf(fg, "\n\t--\n") ;
00318 fprintf(fg, "\t- _ 4th overlap criteria (alpha sphere overlap) _ -\n") ;
00319 fprintf(fg, "\t--\n\n") ;
00320 fprintf(fg," :");
00321 for( j = 0 ; j < novlp2 ; j++) {
00322 fprintf(fg, " >%5.2f :", ovlp2[j]) ;
00323 }
00324 fprintf(fg,"\n");
00325 fprintf(fg,"----");
00326 for( j = 0 ; j < novlp2 ; j++) {
00327 fprintf(fg, "-") ;
00328 }
00329 fprintf(fg,"\n");
00330
00331 for(i = 0 ; i < nranks ; i++) {
00332 fprintf(fg, "Rank <= %2d :", ranks[i]) ;
00333 for( j = 0 ; j < novlp2 ; j++) {
00334 nok = 0 ;
00335 for(k = 0 ; k < par->nfiles ; k++) {
00336 if( status[k] == M_OK &&
00337 ddata[k][M_CRIT4] >= ovlp2[j] &&
00338 idata[k][M_POS4] <= ranks[i] &&
00339 idata[k][M_POS4] > 0) {
00340 nok ++ ;
00341 }
00342 }
00343 fprintf(fg, " %6.2f :", ((float)nok) / ((float) N)) ;
00344 }
00345 fprintf(fg, "\n") ;
00346 }
00347 fprintf(fg, "-\n") ;
00348 fprintf(fg, "Mean overlap : %f\n", mean_ov4) ;
00349 fprintf(fg, "Mean relative overlap : %f\n", mean_ovr4) ;
00350
00351
00352
00353 fprintf(fg, "\n\t--\n") ;
00354 fprintf(fg, "\t- _ 5th overlap criteria (alpha sphere overlap) _ -\n") ;
00355 fprintf(fg, "\t--\n\n") ;
00356 fprintf(fg," :");
00357 for( j = 0 ; j < novlp3 ; j++) {
00358 fprintf(fg, " >%5.2f :", ovlp3[j]) ;
00359 }
00360 fprintf(fg,"\n");
00361 fprintf(fg,"----");
00362 for( j = 0 ; j < novlp3 ; j++) {
00363 fprintf(fg, "-") ;
00364 }
00365 fprintf(fg,"\n");
00366
00367 for(i = 0 ; i < nranks ; i++) {
00368 fprintf(fg, "Rank <= %2d :", ranks[i]) ;
00369 for( j = 0 ; j < novlp3 ; j++) {
00370 nok = 0 ;
00371 for(k = 0 ; k < par->nfiles ; k++) {
00372 if( status[k] == M_OK &&
00373 ddata[k][M_CRIT5] >= ovlp3[j] &&
00374 idata[k][M_POS5] <= ranks[i] &&
00375 idata[k][M_POS5] > 0) {
00376 nok ++ ;
00377 }
00378 }
00379 fprintf(fg, " %6.2f :", ((float)nok) / ((float) N)) ;
00380 }
00381 fprintf(fg, "\n") ;
00382 }
00383 fprintf(fg, "-\n") ;
00384 fprintf(fg, "Mean overlap : %f\n", mean_ov5) ;
00385 fprintf(fg, "Mean relative overlap : %f\n", mean_ovr5) ;
00386
00387
00388 fprintf(fg, "\n\t--\n") ;
00389 fprintf(fg, "\t- _ Concensus overlap criteria (alpha sphere overlap) _ -\n") ;
00390 fprintf(fg, "\t--\n\n") ;
00391 fprintf(fg, " Ratio of good predictions (dist = 3A) \n") ;
00392 fprintf(fg, "\n") ;
00393
00394 for(i = 0 ; i < nranks ; i++) {
00395 nok = 0 ;
00396 for(k = 0 ; k < par->nfiles ; k++) {
00397 if(status[k] == M_OK && idata[k][M_POS6] <= ranks[i]
00398 && idata[k][M_POS6] > 0) {
00399 nok ++ ;
00400 }
00401 }
00402
00403 fprintf(fg, "Rank <= %2d :\t\t%6.2f\n", ranks[i],
00404 ((float)nok) / ((float) N)) ;
00405 }
00406
00407 fprintf(fg, "-\n") ;
00408 fprintf(fg, "Mean relative overlap : %7.2f\n", mean_ovr6) ;
00409 fprintf(fg, "Mean pocket volume (estimation) : %10.2f\n", mean_pvol6) ;
00410 fprintf(fg, "Mean number of pocket atom : %4d\n", mean_nbatm6) ;
00411
00412 fclose(fg) ;
00413 }
00414 else fprintf(stdout, "The file %s could not be opened\n", par->g_output) ;
00415 }
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440 int test_set(s_tparams *par, int i, float ddata [][M_NDDATA], int idata [][M_NIDATA])
00441 {
00442 s_atm **accpck = NULL,
00443 **accpck2 = NULL ;
00444
00445 char *fa = par->fapo[i],
00446 *fc = par->fcomplex[i],
00447 *lig = par->fligan[i] ;
00448
00449 int naccpck = 0,
00450 naccpck2 = 0 ;
00451
00452
00453
00454
00455
00456
00457 s_pdb *apdb = rpdb_open(fa, lig, M_DONT_KEEP_LIG) ;
00458 s_pdb *cpdb = rpdb_open(fc, lig, M_KEEP_LIG);
00459 s_pdb *cpdb_nolig = rpdb_open(fc, lig, M_DONT_KEEP_LIG) ;
00460
00461
00462 if(! apdb || !cpdb) {
00463 fprintf(stderr, "!! PDB loading failed for %s-%s ligand %s... %p %p\n",
00464 fc, fa, lig, apdb, cpdb) ;
00465 if(cpdb) free_pdb_atoms(cpdb) ;
00466 if(apdb) free_pdb_atoms(apdb) ;
00467
00468 return M_LIGNOTFOUND ;
00469 }
00470
00471
00472 if(cpdb->natm_lig <= 0) {
00473
00474 fprintf(stderr, "! Ligand '%s' not found in the complex %s...\n",
00475 lig, fc) ;
00476
00477 return M_LIGNOTFOUND ;
00478 }
00479
00480
00481
00482
00483
00484 rpdb_read(apdb, lig, M_DONT_KEEP_LIG) ;
00485 rpdb_read(cpdb, lig, M_KEEP_LIG) ;
00486 rpdb_read(cpdb_nolig, lig, M_DONT_KEEP_LIG) ;
00487
00488 c_lst_pockets *pockets = search_pocket(apdb, par->fpar,cpdb);
00489 set_pockets_bary(pockets) ;
00490
00491
00492 if(!pockets || pockets->n_pockets <= 0) {
00493 if(pockets) c_lst_pocket_free(pockets) ;
00494 return M_NOPOCKETFOUND ;
00495 }
00496
00497
00498
00499
00500 idata[i][M_NPOCKET] = pockets->n_pockets ;
00501 ddata[i][M_LIGMASS] = get_mol_mass_ptr(cpdb->latm_lig, cpdb->natm_lig) ;
00502 ddata[i][M_LIGVOL] = get_mol_volume_ptr(cpdb->latm_lig, cpdb->natm_lig,
00503 par->fpar->nb_mcv_iter);
00504
00505
00506 accpck = get_actual_pocket_DEPRECATED(cpdb, M_CRIT2_D, &naccpck) ;
00507 accpck2 = get_actual_pocket(cpdb, cpdb_nolig, i, par, &naccpck2) ;
00508
00509 fflush(stdout) ;
00510 if (naccpck2 <= 0) {
00511 fprintf(stdout, "! Warning: actual pocket has 0 atoms!! %s %d\n", fa,
00512 naccpck2) ;
00513 }
00514
00515
00516 check_pockets(pockets, accpck2, naccpck2, cpdb->latm_lig, cpdb->natm_lig,
00517 accpck, naccpck, ddata, idata, i) ;
00518
00519 if(par->keep_fpout != 0) {
00520 write_out_fpocket(pockets, apdb, par->fapo[i]) ;
00521 }
00522
00523
00524
00525 c_lst_pocket_free(pockets) ;
00526 my_free(accpck) ;
00527 free_pdb_atoms(apdb) ;
00528 free_pdb_atoms(cpdb) ;
00529 free_pdb_atoms(cpdb_nolig) ;
00530
00531 return M_OK ;
00532 }
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556 s_atm** get_actual_pocket(s_pdb *cpdb, s_pdb *cpdb_nolig, int i, s_tparams *par, int *nb_atm)
00557 {
00558 s_atm **neigh = NULL ;
00559
00560 c_lst_pockets *pockets = search_pocket(cpdb_nolig, par->fpar,cpdb);
00561 if(pockets && pockets->n_pockets > 0) {
00562
00563
00564
00565 neigh = get_mol_ctd_atm_neigh(cpdb->latm_lig, cpdb->natm_lig,
00566 pockets->vertices->pvertices,
00567 pockets->vertices->nvert, M_CRIT1_D,
00568 M_INTERFACE_SEARCH, nb_atm) ;
00569
00570 c_lst_pocket_free(pockets) ;
00571 }
00572 else {
00573 fprintf(stderr, "! No pocket found for apo %s and complex %s ligand %s...\n",
00574 par->fapo[i], par->fcomplex[i], par->fligan[i]) ;
00575
00576 if(pockets) c_lst_pocket_free(pockets) ;
00577 }
00578
00579 return neigh ;
00580 }
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601 s_atm** get_actual_pocket_DEPRECATED(s_pdb *cpdb, float lig_dist_crit, int *nb_atm)
00602 {
00603
00604 s_atm **alneigh = get_mol_atm_neigh(cpdb->latm_lig, cpdb->natm_lig,
00605 cpdb->latoms_p, cpdb->natoms,
00606 lig_dist_crit, nb_atm) ;
00607 if(*nb_atm <= 0) {
00608 if(alneigh) my_free(alneigh) ;
00609 alneigh = get_mol_atm_neigh(cpdb->latm_lig, cpdb->natm_lig,
00610 cpdb->latoms_p, cpdb->natoms,
00611 lig_dist_crit+1.0, nb_atm) ;
00612
00613 if(*nb_atm <= 0) {
00614 if(alneigh) my_free(alneigh) ;
00615 alneigh = get_mol_atm_neigh(cpdb->latm_lig, cpdb->natm_lig,
00616 cpdb->latoms_p, cpdb->natoms,
00617 lig_dist_crit+2.0, nb_atm) ;
00618 if(*nb_atm <= 0) {
00619 if(alneigh) my_free(alneigh) ;
00620 alneigh = NULL ;
00621 }
00622 }
00623 }
00624
00625 return alneigh ;
00626 }
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661 void check_pockets(c_lst_pockets *pockets, s_atm **accpck, int naccpck, s_atm **lig,
00662 int nalig, s_atm **alneigh, int nlneigh,
00663 float ddata [][M_NDDATA], int idata [][M_NIDATA], int i)
00664 {
00665 int found [] = {0, 0, 0, 0, 0, 0} ;
00666 int npneigh = 0, pos, j ;
00667 float ov1, ov2, ov3, ov4, dst = 0.0 ;
00668
00669
00670 s_atm **pneigh = NULL ;
00671 s_vvertice **pvert = NULL ;
00672
00673 node_pocket *ncur = NULL ;
00674 s_pocket *pcur = NULL ;
00675
00676
00677 ncur = pockets->first ;
00678
00679 int n_lig_molecules=1;
00680 char chain_tmp[2];
00681 int resnumber_tmp;
00682 strcpy(chain_tmp,lig[0]->chain);
00683 resnumber_tmp = lig[0]->res_id;
00684
00685 for (j = 1 ; j < nalig ; j++) {
00686 if(strcmp(chain_tmp,lig[j]->chain) !=0 || resnumber_tmp!=lig[j]->res_id){
00687 n_lig_molecules++;
00688 strcpy(chain_tmp,lig[j]->chain);
00689 resnumber_tmp =lig[j]->res_id;
00690 }
00691 }
00692
00693 pos = 0 ;
00694 while(ncur) {
00695 pos ++ ;
00696 pcur = ncur->pocket ;
00697
00698
00699
00700
00701 if(! found[0]) {
00702 for (j = 0 ; j < nalig ; j++) {
00703 dst = dist(lig[j]->x, lig[j]->y, lig[j]->z,
00704 pcur->bary[0], pcur->bary[1], pcur->bary[2]) ;
00705 if(dst < M_CRIT3_VAL) {
00706
00707 ddata[i][M_MINDST] = dst ;
00708 ddata[i][M_OREL3] = (naccpck <= 0.0)?-1.0 :(float)npneigh/(float)naccpck*100.0 ;
00709 ddata[i][M_POCKETVOL_C3] = pcur->pdesc->volume ;
00710 idata[i][M_POS3] = pos ;
00711 idata[i][M_NATM3] = count_pocket_contacted_atms(pcur) ;
00712 found[0] = 1 ; break ;
00713 }
00714 }
00715 }
00716
00717
00718
00719
00720 if(!found[1] || !found[2]) {
00721 pneigh = get_pocket_contacted_atms(pcur, &npneigh) ;
00722 if(! found[1]) {
00723 ov1 = atm_corsp(alneigh, nlneigh, pneigh, npneigh) ;
00724 if(ov1 > M_CRIT1_VAL) {
00725 idata[i][M_POS1] = pos ;
00726 ddata[i][M_MAXPCT1] = ov1 ;
00727 ddata[i][M_OREL1] = (nlneigh <= 0.0)? -1.0 : (float)npneigh/(float)nlneigh*100.0 ;
00728 found[1] = 1 ;
00729 }
00730 }
00731
00732 if(! found[2]) {
00733 ov2 = atm_corsp(accpck, naccpck, pneigh, npneigh) ;
00734 if(ov2 > M_CRIT2_VAL) {
00735 idata[i][M_POS2] = pos ;
00736 ddata[i][M_MAXPCT2] = ov2 ;
00737 ddata[i][M_OREL2] = (naccpck <= 0.0)?-1.0 : (float)npneigh/(float)naccpck*100.0 ;
00738 found[2] = 1 ;
00739 }
00740 }
00741 my_free(pneigh) ;
00742 }
00743
00744
00745
00746
00747 if(!found[3] || !found[4] || !found[5]) {
00748 pvert = get_pocket_pvertices(pcur) ;
00749 if(!found[3]){
00750
00751
00752
00753 ov3 = count_atm_prop_vert_neigh( lig, nalig,pvert, pcur->size, M_CRIT4_D,n_lig_molecules) ;
00754 if(ov3 > M_CRIT4_VAL) {
00755 idata[i][M_POS4] = pos ;
00756 ddata[i][M_CRIT4] = ov3 ;
00757 ddata[i][M_OREL4] = ov3*100 ;
00758 found[3] = 1 ;
00759 }
00760 }
00761
00762 if(!found[4]){
00763
00764
00765 ov4 = count_pocket_lig_vert_ovlp(lig, nalig,
00766 pvert, pcur->size, M_CRIT5_D) ;
00767 if(ov4 > M_CRIT5_VAL) {
00768 idata[i][M_POS5] = pos ;
00769 ddata[i][M_CRIT5] = ov4 ;
00770 ddata[i][M_OREL5] = ov4*100 ;
00771 found[4] = 1 ;
00772 }
00773 }
00774
00775 if(!found[5]){
00776 ov3 = count_atm_prop_vert_neigh( lig, nalig,
00777 pvert, pcur->size, M_CRIT4_D,n_lig_molecules );
00778 ov4 = count_pocket_lig_vert_ovlp(lig, nalig,
00779 pvert, pcur->size, M_CRIT5_D) ;
00780 if(ov4 > M_CRIT5_VAL && ov3 > M_CRIT4_VAL) {
00781 idata[i][M_POS6] = pos ;
00782 ddata[i][M_CRIT6] = 1.0 ;
00783 ddata[i][M_POCKETVOL_C6] = pcur->pdesc->volume ;
00784 ddata[i][M_OREL6] = ov4*100 ;
00785 idata[i][M_NATM6] = count_pocket_contacted_atms(pcur) ;
00786 found[5] = 1 ;
00787 }
00788 }
00789 my_free(pvert) ;
00790 }
00791
00792 ncur = ncur->next ;
00793
00794
00795 if(found[0] && found[1] && found[2] && found[3] && found[4] && found[5]) break ;
00796
00797 }
00798
00799 if (! found[0]) {
00800 ddata[i][M_MINDST] = 0.0 ;
00801 ddata[i][M_OREL3] = 0.0 ;
00802 idata[i][M_POS3] = 0 ;
00803 idata[i][M_NATM3] = -1 ;
00804 ddata[i][M_POCKETVOL_C3] = 0.0 ;
00805 }
00806
00807 if (! found[1]) {
00808 ddata[i][M_MAXPCT1] = 0.0 ;
00809 ddata[i][M_OREL1] = 0.0 ;
00810 idata[i][M_POS1] = 0 ;
00811 }
00812
00813 if (! found[2]) {
00814 ddata[i][M_MAXPCT2] = 0.0 ;
00815 ddata[i][M_OREL2] = 0.0 ;
00816 idata[i][M_POS2] = 0 ;
00817 }
00818
00819 if (! found[3]) {
00820 ddata[i][M_CRIT4] = 0.0 ;
00821 ddata[i][M_OREL4] = 0.0 ;
00822 idata[i][M_POS4] = 0 ;
00823 }
00824
00825 if (! found[4]) {
00826 ddata[i][M_CRIT5] = 0.0 ;
00827 ddata[i][M_OREL5] = 0.0 ;
00828 idata[i][M_POS5] = 0 ;
00829 }
00830
00831 if (! found[5]) {
00832 ddata[i][M_CRIT6] = 0.0 ;
00833 ddata[i][M_OREL6] = 0.0 ;
00834 idata[i][M_POS6] = 0 ;
00835 idata[i][M_NATM6] = -1 ;
00836 ddata[i][M_POCKETVOL_C6] = 0.0 ;
00837 }
00838 }
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881 float set_overlap_volumes(s_pocket *pocket, s_atm **lig, int natoms, float lig_vol,
00882 s_fparams *params)
00883 {
00884
00885 float (*pf_set_vol)(s_atm**, int, float, s_pocket*, int ) = NULL ;
00886 int crit = 0,
00887 method = 0 ;
00888
00889 if(params->basic_volume_div <= 0) {
00890 pf_set_vol = set_mc_overlap_volume ;
00891 crit = params->nb_mcv_iter ;
00892 }
00893 else {
00894 pf_set_vol = set_basic_overlap_volume ;
00895 crit = params->basic_volume_div ;
00896 method = 1 ;
00897 }
00898
00899 if(pocket->v_lst->n_vertices > 150) {
00900 if(method == 0 && crit < 20000) crit = 20000 ;
00901 }
00902
00903 return pf_set_vol(lig, natoms, lig_vol, pocket, crit) ;
00904 }
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924 float set_mc_overlap_volume(s_atm **lig, int natoms, float lig_vol,
00925 s_pocket *pocket, int niter)
00926 {
00927 c_lst_vertices *vertices = pocket->v_lst ;
00928 s_vvertice *vcur = NULL ;
00929
00930 int i = 0, j = 0,
00931 nb_in = 0,
00932 found = 0 ;
00933
00934 float xmin = 0.0, xmax = 0.0,
00935 ymin = 0.0, ymax = 0.0,
00936 zmin = 0.0, zmax = 0.0,
00937 xtmp = 0.0, ytmp = 0.0, ztmp = 0.0,
00938 xr = 0.0, yr = 0.0, zr = 0.0,
00939 vbox = 0.0, full_vol = 0.0;
00940
00941 s_atm *acur = NULL ;
00942
00943
00944 for(i = 0 ; i < natoms ; i++) {
00945 acur = lig[i] ;
00946 if(i == 0) {
00947 xmin = acur->x - acur->radius ; xmax = acur->x + acur->radius ;
00948 ymin = acur->y - acur->radius ; ymax = acur->y + acur->radius ;
00949 zmin = acur->z - acur->radius ; zmax = acur->z + acur->radius ;
00950 }
00951 else {
00952
00953 if(xmin > (xtmp = acur->x - acur->radius)) xmin = xtmp ;
00954 else if(xmax < (xtmp = acur->x + acur->radius)) xmax = xtmp ;
00955
00956 if(ymin > (ytmp = acur->y - acur->radius)) ymin = ytmp ;
00957 else if(ymax < (ytmp = acur->y + acur->radius)) ymax = ytmp ;
00958
00959 if(zmin > (ztmp = acur->z - acur->radius)) zmin = ztmp ;
00960 else if(zmax < (ztmp = acur->z + acur->radius)) zmax = ztmp ;
00961 }
00962 }
00963
00964 node_vertice *cur = vertices->first ;
00965
00966 while(cur) {
00967 vcur = cur->vertice ;
00968 if(xmin > (xtmp = vcur->x - vcur->ray)) xmin = xtmp ;
00969 else if(xmax < (xtmp = vcur->x + vcur->ray)) xmax = xtmp ;
00970
00971 if(ymin > (ytmp = vcur->y - vcur->ray)) ymin = ytmp ;
00972 else if(ymax < (ytmp = vcur->y + vcur->ray)) ymax = ytmp ;
00973
00974 if(zmin > (ztmp = vcur->z - vcur->ray)) zmin = ztmp ;
00975 else if(zmax < (ztmp = vcur->z + vcur->ray)) zmax = ztmp ;
00976
00977 cur = cur->next ;
00978 }
00979
00980
00981
00982 vbox = (xmax - xmin)*(ymax - ymin)*(zmax - zmin) ;
00983
00984
00985 for(i = 0 ; i < niter ; i++) {
00986 found = 0 ;
00987 xr = rand_uniform(xmin, xmax) ;
00988 yr = rand_uniform(ymin, ymax) ;
00989 zr = rand_uniform(zmin, zmax) ;
00990
00991 cur = vertices->first ;
00992 while(cur) {
00993 vcur = cur->vertice ;
00994 xtmp = vcur->x - xr ;
00995 ytmp = vcur->y - yr ;
00996 ztmp = vcur->z - zr ;
00997
00998
00999 if((vcur->ray*vcur->ray) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01000
01001 nb_in ++ ; found = 1 ; break ;
01002 }
01003 cur = cur->next ;
01004 }
01005
01006 if(!found) {
01007 for(j = 0 ; j < natoms ; j++) {
01008 acur = lig[j] ;
01009 xtmp = acur->x - xr ;
01010 ytmp = acur->y - yr ;
01011 ztmp = acur->z - zr ;
01012
01013
01014 if((acur->radius*acur->radius) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01015
01016 nb_in ++ ; break ;
01017 }
01018 }
01019 }
01020 }
01021
01022 full_vol = ((float)nb_in)/((float)niter)*vbox ;
01023 pocket->vol_corresp = ((pocket->pdesc->volume + lig_vol) - full_vol)/lig_vol ;
01024
01025 return pocket->vol_corresp ;
01026 }
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047 float set_basic_overlap_volume(s_atm **lig, int natoms, float lig_vol,
01048 s_pocket *pocket, int idiscret)
01049 {
01050 c_lst_vertices *vertices = pocket->v_lst ;
01051 s_vvertice *vcur = NULL ;
01052
01053 int i = 0, j = 0,
01054 nb_in = 0,
01055 found = 0,
01056 niter = 0 ;
01057
01058 float discret = 1.0/(float)idiscret ;
01059
01060 float x = 0.0, y = 0.0, z = 0.0,
01061 xstep = 0.0, ystep = 0.0, zstep = 0.0 ;
01062
01063 float xmin = 0.0, xmax = 0.0,
01064 ymin = 0.0, ymax = 0.0,
01065 zmin = 0.0, zmax = 0.0,
01066 xtmp = 0.0, ytmp = 0.0, ztmp = 0.0,
01067 vbox = 0.0, full_vol = 0.0;
01068
01069 s_atm *acur = NULL ;
01070
01071
01072 for(i = 0 ; i < natoms ; i++) {
01073 acur = lig[i] ;
01074 if(i == 0) {
01075 xmin = acur->x - acur->radius ; xmax = acur->x + acur->radius ;
01076 ymin = acur->y - acur->radius ; ymax = acur->y + acur->radius ;
01077 zmin = acur->z - acur->radius ; zmax = acur->z + acur->radius ;
01078 }
01079 else {
01080
01081 if(xmin > (xtmp = acur->x - acur->radius)) xmin = xtmp ;
01082 else if(xmax < (xtmp = acur->x + acur->radius)) xmax = xtmp ;
01083
01084 if(ymin > (ytmp = acur->y - acur->radius)) ymin = ytmp ;
01085 else if(ymax < (ytmp = acur->y + acur->radius)) ymax = ytmp ;
01086
01087 if(zmin > (ztmp = acur->z - acur->radius)) zmin = ztmp ;
01088 else if(zmax < (ztmp = acur->z + acur->radius)) zmax = ztmp ;
01089 }
01090 }
01091
01092 node_vertice *cur = vertices->first ;
01093
01094 while(cur) {
01095 vcur = cur->vertice ;
01096 if(xmin > (xtmp = vcur->x - vcur->ray)) xmin = xtmp ;
01097 else if(xmax < (xtmp = vcur->x + vcur->ray)) xmax = xtmp ;
01098
01099 if(ymin > (ytmp = vcur->y - vcur->ray)) ymin = ytmp ;
01100 else if(ymax < (ytmp = vcur->y + vcur->ray)) ymax = ytmp ;
01101
01102 if(zmin > (ztmp = vcur->z - vcur->ray)) zmin = ztmp ;
01103 else if(zmax < (ztmp = vcur->z + vcur->ray)) zmax = ztmp ;
01104
01105 cur = cur->next ;
01106 }
01107
01108
01109
01110 vbox = (xmax - xmin)*(ymax - ymin)*(zmax - zmin) ;
01111
01112 xstep = discret * (xmax - xmin) ;
01113 ystep = discret * (ymax - ymin) ;
01114 zstep = discret * (zmax - zmin) ;
01115
01116
01117 for(x = xmin ; x < xmax ; x += xstep) {
01118 for(y = ymin ; y < ymax ; y += ystep) {
01119 for(z = zmin ; z < zmax ; z += zstep) {
01120 found = 0 ;
01121 cur = vertices->first ;
01122 while(cur) {
01123 vcur = cur->vertice ;
01124 xtmp = vcur->x - x ;
01125 ytmp = vcur->y - y ;
01126 ztmp = vcur->z - z ;
01127
01128
01129 if((vcur->ray*vcur->ray) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01130
01131 nb_in ++ ; found = 1 ; break ;
01132 }
01133 cur = cur->next ;
01134 }
01135
01136 if(!found) {
01137 for(j = 0 ; j < natoms ; j++) {
01138 acur = lig[j] ;
01139 xtmp = acur->x - x ;
01140 ytmp = acur->y - y ;
01141 ztmp = acur->z - z ;
01142
01143
01144 if((acur->radius*acur->radius) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01145
01146 nb_in ++ ; break ;
01147 }
01148 }
01149 }
01150 niter++ ;
01151 }
01152 }
01153 }
01154
01155 full_vol = ((float)nb_in)/((float)niter)*vbox ;
01156 pocket->vol_corresp = ((pocket->pdesc->volume + lig_vol) - full_vol)/lig_vol ;
01157
01158
01159 return pocket->vol_corresp ;
01160 }