tpocket.h File Reference

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "tparams.h"
#include "neighbor.h"
#include "fpocket.h"
#include "fpout.h"
#include "memhandler.h"

Go to the source code of this file.

Defines

#define M_CRIT1_D   3.0
#define M_CRIT2_D   3.0
#define M_CRIT4_D   3.0
#define M_CRIT5_D   3.0
#define M_CRIT1_VAL   50.0
#define M_CRIT2_VAL   50.0
#define M_CRIT3_VAL   4.0
#define M_CRIT4_VAL   0.5
#define M_CRIT5_VAL   0.20
#define M_NDDATA   16
#define M_MAXPCT1   0
#define M_MAXPCT2   1
#define M_MINDST   2
#define M_CRIT4   3
#define M_CRIT5   4
#define M_CRIT6   5
#define M_OREL1   6
#define M_OREL2   7
#define M_OREL3   8
#define M_OREL4   9
#define M_OREL5   10
#define M_OREL6   11
#define M_LIGMASS   12
#define M_LIGVOL   13
#define M_POCKETVOL_C3   14
#define M_POCKETVOL_C6   15
#define M_NIDATA   9
#define M_NPOCKET   0
#define M_POS1   1
#define M_POS2   2
#define M_POS3   3
#define M_POS4   4
#define M_POS5   5
#define M_POS6   6
#define M_NATM3   7
#define M_NATM6   8
#define M_LIGNOTFOUND   -2
#define M_PDBOPENFAILED   -1
#define M_OK   0
#define M_NOPOCKETFOUND   1

Functions

void test_fpocket (s_tparams *par)
int test_set (s_tparams *par, int i, float ddata[][M_NDDATA], int idata[][M_NIDATA])
void check_pockets (c_lst_pockets *pockets, s_atm **accpck, int naccpck, s_atm **lig, int nalig, s_atm **alneigh, int nlneigh, float ddata[][M_NDDATA], int idata[][M_NIDATA], int i)
s_atm ** get_actual_pocket (s_pdb *com_pdb, s_pdb *com_pdb_nolig, int i, s_tparams *par, int *nb_atm)
s_atm ** get_actual_pocket_DEPRECATED (s_pdb *com_pdb, float lig_dist_crit, int *nb_atm)
float set_overlap_volumes (s_pocket *pocket, s_atm **lig, int natoms, float lig_vol, s_fparams *params)
float set_mc_overlap_volume (s_atm **lig, int natoms, float lig_vol, s_pocket *pocket, int niter)
float set_basic_overlap_volume (s_atm **lig, int natoms, float lig_vol, s_pocket *pocket, int idiscret)
void write_pockets_stats (c_lst_pockets *pockets, const char base_pdb_name[])


Define Documentation

#define M_CRIT1_D   3.0

Definition at line 51 of file tpocket.h.

Referenced by get_actual_pocket().

#define M_CRIT1_VAL   50.0

Definition at line 56 of file tpocket.h.

Referenced by check_pockets().

#define M_CRIT2_D   3.0

Definition at line 52 of file tpocket.h.

Referenced by test_set().

#define M_CRIT2_VAL   50.0

Definition at line 57 of file tpocket.h.

Referenced by check_pockets().

#define M_CRIT3_VAL   4.0

Definition at line 58 of file tpocket.h.

Referenced by check_pockets().

#define M_CRIT4   3

Minimum distance observed (barycenter/ligand), crit 4

Definition at line 70 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_CRIT4_D   3.0

Definition at line 53 of file tpocket.h.

Referenced by check_pockets(), and desc_pocket().

#define M_CRIT4_VAL   0.5

Definition at line 59 of file tpocket.h.

Referenced by check_pockets(), and write_pocket_desc().

#define M_CRIT5   4

Minimum distance observed (barycenter/ligand), crit 5

Definition at line 71 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_CRIT5_D   3.0

Definition at line 54 of file tpocket.h.

Referenced by check_pockets(), and desc_pocket().

#define M_CRIT5_VAL   0.20

Definition at line 60 of file tpocket.h.

Referenced by check_pockets(), and write_pocket_desc().

#define M_CRIT6   5

Minimum distance observed (barycenter/ligand), crit 5

Definition at line 72 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_LIGMASS   12

Mass of the ligand

Definition at line 79 of file tpocket.h.

Referenced by test_fpocket(), and test_set().

#define M_LIGNOTFOUND   -2

Flags used for the pocket detection

Definition at line 95 of file tpocket.h.

Referenced by test_set().

#define M_LIGVOL   13

Volume of the ligand

Definition at line 80 of file tpocket.h.

Referenced by test_fpocket(), and test_set().

#define M_MAXPCT1   0

Maximum observed overlap for the criteria 1

Definition at line 67 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_MAXPCT2   1

Maximum observed overlap for the criteria 2

Definition at line 68 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_MINDST   2

Minimum distance observed (barycenter/ligand), crit 3

Definition at line 69 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_NATM3   7

Rank of the right pocket for the 5th criteria

Definition at line 92 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_NATM6   8

Rank of the right pocket for the 6th criteria

Definition at line 93 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_NDDATA   16

Number of floating values

Definition at line 66 of file tpocket.h.

Referenced by test_fpocket().

#define M_NIDATA   9

Number of interger values

Definition at line 84 of file tpocket.h.

Referenced by test_fpocket().

#define M_NOPOCKETFOUND   1

Flags used for the pocket detection

Definition at line 98 of file tpocket.h.

Referenced by test_set().

#define M_NPOCKET   0

Total number of pocket found

Definition at line 85 of file tpocket.h.

Referenced by test_fpocket(), and test_set().

#define M_OK   0

Flags used for the pocket detection

Definition at line 97 of file tpocket.h.

Referenced by test_fpocket(), and test_set().

#define M_OREL1   6

Relative overlap of the pocket found for criteria 1

Definition at line 73 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_OREL2   7

Relative overlap of the pocket found for criteria 2

Definition at line 74 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_OREL3   8

Relative overlap of the pocket found for criteria 3

Definition at line 75 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_OREL4   9

Relative overlap of the pocket found for criteria 3

Definition at line 76 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_OREL5   10

Relative overlap of the pocket found for criteria 3

Definition at line 77 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_OREL6   11

Relative overlap of the pocket found for criteria 3

Definition at line 78 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_PDBOPENFAILED   -1

Flags used for the pocket detection

Definition at line 96 of file tpocket.h.

#define M_POCKETVOL_C3   14

Volume of the pocket found by the 1st criteria

Definition at line 81 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POCKETVOL_C6   15

Volume of the pocket found by the 6th criteria

Definition at line 82 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS1   1

Rank of the right pocket for the 1st criteria

Definition at line 86 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS2   2

Rank of the right pocket for the 2nd criteria

Definition at line 87 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS3   3

Rank of the right pocket for the 3rd criteria

Definition at line 88 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS4   4

Rank of the right pocket for the 4th criteria

Definition at line 89 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS5   5

Rank of the right pocket for the 5th criteria

Definition at line 90 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().

#define M_POS6   6

Rank of the right pocket for the 6th criteria

Definition at line 91 of file tpocket.h.

Referenced by check_pockets(), and test_fpocket().


Function Documentation

void check_pockets ( c_lst_pockets pockets,
s_atm **  accpck,
int  naccpck,
s_atm **  lig,
int  nalig,
s_atm **  alneigh,
int  nlneigh,
float  ddata[][M_NDDATA],
int  idata[][M_NIDATA],
int  i 
)

## FUNCTION: check_pockets

## SPECIFICATION: Checking the pocket prediction for one data set. (apo+complex+ligand) This function will calculate three criterias: 1 - Overlap using the first definition of the pocket (atoms contacted by vertices next to the ligand) 2 - Overlap using the second definition of the pocket (atoms situated at N A of the ligand) 3 - Smallest distance of each ligand atom from the barycenter of the pocket. Cutoff: 4A

The two arrays ddata and idata given in paramet are used as output.

## PARAMETRES: @ c_lst_pockets *pockets: The pockets found for this set. @ s_atm accpck : The actual pocket using first definition @ int naccpckk : Number of atoms in the actual pocket definition 1 @ s_atm lig : Ligand atoms @ int nalig : Number of ligand atoms @ s_atm alneigh : The actual pocket using second definition @ int nlneigh : Number of atoms in the actual pocket definition 2 @ float ddata[][] : Used to store statistics for the evaluation (float) @ float idata[][] : Used to store statistics for the evaluation (integers) @ int i : ID if the current test set. Used to fill the two following statistic arrays

## RETURN: void

Definition at line 661 of file tpocket.c.

References atm_corsp(), s_pocket::bary, count_atm_prop_vert_neigh(), count_pocket_contacted_atms(), count_pocket_lig_vert_ovlp(), dist(), c_lst_pockets::first, get_pocket_contacted_atms(), get_pocket_pvertices(), M_CRIT1_VAL, M_CRIT2_VAL, M_CRIT3_VAL, M_CRIT4, M_CRIT4_D, M_CRIT4_VAL, M_CRIT5, M_CRIT5_D, M_CRIT5_VAL, M_CRIT6, M_MAXPCT1, M_MAXPCT2, M_MINDST, M_NATM3, M_NATM6, M_OREL1, M_OREL2, M_OREL3, M_OREL4, M_OREL5, M_OREL6, M_POCKETVOL_C3, M_POCKETVOL_C6, M_POS1, M_POS2, M_POS3, M_POS4, M_POS5, M_POS6, my_free(), node_pocket::next, s_pocket::pdesc, node_pocket::pocket, s_atm::res_id, s_pocket::size, and s_desc::volume.

Referenced by test_set().

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         /* float ovol ; */
00669         
00670         s_atm **pneigh = NULL ;
00671         s_vvertice **pvert = NULL ;
00672         
00673         node_pocket *ncur = NULL ;
00674         s_pocket *pcur = NULL ;
00675         
00676         /* Check the correspondance for each pocket found */
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                         TEST THE FIRST CRITERIA (DISTANCE TO BARYCENTER)
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                                 /* Criteria 3 OK  */
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                         TEST THE 2nd and 3rd CRITERIA (ATOMIC OVERLAP)
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                         TEST THE 4th and 5th CRITERIA (VERTICE OVERLAPS)
00746                  */
00747                 if(!found[3] || !found[4] || !found[5]) {
00748                         pvert = get_pocket_pvertices(pcur) ;
00749                         if(!found[3]){
00750                                 /* Calculate proportion of ligand atom that lies within 3A
00751                                    of at least one vertice */
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                                 /* Calculate proportion of pocket vertice that lies within 3A
00764                                    of at least one ligand atom */
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                 /* Break the loop if all criteria are OK */
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 }

s_atm** get_actual_pocket ( s_pdb cpdb,
s_pdb cpdb_nolig,
int  i,
s_tparams par,
int *  nb_atm 
)

## FUNCTION: get_actual_pocket

## SPECIFICATION: Get atoms contacted by voronoi vertices present in the actual pocket and situated at a distance of M_DST_CRIT from each ligand atoms. This way of finding exact atoms contacted by the ligand is more accurate, but need an extra search by fpocket to find voronoi vertices in the complexe form without the ligand...

## PARAMETRES: @ s_pdb *cpdb : The pdb structure of the complexe. @ s_pdb *cpdb_nolig : The pdb structure of the complexe WITHOUT the ligand @ int i : ID of the current test set @ s_tparams *par : Parameters @ int *nb_atm : Number of atom (this an output, it should be set here)

## RETURN: s_atm **: A 2D table containing pointers to atoms which defines the pocket.

Definition at line 556 of file tpocket.c.

References c_lst_pocket_free(), s_tparams::fapo, s_tparams::fcomplex, s_tparams::fligan, s_tparams::fpar, get_mol_ctd_atm_neigh(), s_pdb::latm_lig, M_CRIT1_D, M_INTERFACE_SEARCH, c_lst_pockets::n_pockets, s_pdb::natm_lig, s_lst_vvertice::nvert, s_lst_vvertice::pvertices, search_pocket(), and c_lst_pockets::vertices.

Referenced by test_set().

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                 /* Get the list of atoms contacted by the vertices near the ligand. */
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 }

s_atm** get_actual_pocket_DEPRECATED ( s_pdb cpdb,
float  lig_dist_crit,
int *  nb_atm 
)

## FUNCTION: get_actual_pocket

## SPECIFICATION: Get atoms situated at a distance of lig_dist_crit from each ligand atoms. This is a quite inacurate way of defining the pocket -> DEPRECATED If the distance criteria used does not allow any identification, we will test a larger distance until 6A.

## PARAMETRES: @ s_pdb *cpdb : The pdb structure of the complexe. @ float lig_dist_crit : The distance criteria @ int *nb_atm : OUTPUT: Number of atom found in the pocket

## RETURN: s_atm **: A 2D table containing pointers to atoms which defines the pocket.

Definition at line 601 of file tpocket.c.

References get_mol_atm_neigh(), s_pdb::latm_lig, s_pdb::latoms_p, my_free(), s_pdb::natm_lig, and s_pdb::natoms.

Referenced by test_set().

00602 {
00603         /* Getting the ligan's neighbors. */
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 }

float set_basic_overlap_volume ( s_atm **  lig,
int  natoms,
float  lig_vol,
s_pocket pocket,
int  idiscret 
)

## FUNCTION: set_basic_overlap_volume

## SPECIFICATION: This function will set an overlap volume between each pocket and the ligand. Discrete aproximation. (algo in idiscret*idiscret*idiscret operation minimum)

## PARAMETRES: @ s_atm **lig : The ligand atoms. @ int natoms natoms : Number of atoms of the ligand. @ float lig_vol : Volume of the ligand @ s_pocket *pockets : The pocket @ int idiscret : Discretisation of the space: splitt the space in N*N*N cubes.

## RETURN:

Definition at line 1047 of file tpocket.c.

References c_lst_vertices::first, node_vertice::next, s_pocket::pdesc, s_atm::radius, s_vvertice::ray, s_pocket::v_lst, node_vertice::vertice, s_pocket::vol_corresp, s_desc::volume, s_vvertice::x, s_atm::x, s_vvertice::y, s_atm::y, s_vvertice::z, and s_atm::z.

Referenced by set_overlap_volumes().

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         /* First, search extrems coordinates in the ligan */
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                 /* Update the minimum and maximum extreme point */
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         /* Continue with the pocket */
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         /* Next calculate the box volume */
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         /* Then apply monte carlo approximation of the volume */
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                                 /* Compare r^2 and dist(center, random_point)^2 */
01129                                         if((vcur->ray*vcur->ray) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01130                                         /* The point is inside one of the vertice!! */
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                                         /* Compare r^2 and dist(center, random_point)^2 */
01144                                                 if((acur->radius*acur->radius) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01145                                                 /* The point is inside one of the vertice!! */
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         /* Ok lets just return the volume Vpok = Nb_in/Niter*Vbox */
01159         return pocket->vol_corresp ;
01160 }

float set_mc_overlap_volume ( s_atm **  lig,
int  natoms,
float  lig_vol,
s_pocket pocket,
int  niter 
)

## FUNCTION: set_mc_overlap_volume

## SPECIFICATION: This function will set an overlap volume between each pocket and the ligand. Method: monte Carlo aproximation.

## PARAMETRES: @ s_atm **lig : The ligand atoms. @ int natoms natoms : Number of atoms of the ligand. @ float lig_vol : Volume of the ligand @ s_pocket *pockets : The pocket @ int niter : Number of monte-carlo iterations

## RETURN:

Definition at line 924 of file tpocket.c.

References c_lst_vertices::first, node_vertice::next, s_pocket::pdesc, s_atm::radius, rand_uniform(), s_vvertice::ray, s_pocket::v_lst, node_vertice::vertice, s_pocket::vol_corresp, s_desc::volume, s_vvertice::x, s_atm::x, s_vvertice::y, s_atm::y, s_vvertice::z, and s_atm::z.

Referenced by set_overlap_volumes().

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         /* First, search extrems coordinates in the ligan */
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                 /* Update the minimum and maximum extreme point */
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         /* Continue with the pocket */
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         /* Next calculate the box volume */
00982         vbox = (xmax - xmin)*(ymax - ymin)*(zmax - zmin) ;
00983 
00984         /* Then apply monte carlo approximation of the volume */
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                 /* Compare r^2 and dist(center, random_point)^2 */
00999                         if((vcur->ray*vcur->ray) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01000                         /* The point is inside one of the vertice!!*/ 
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                         /* Compare r^2 and dist(center, random_point)^2 */
01014                                 if((acur->radius*acur->radius) > (xtmp*xtmp + ytmp*ytmp + ztmp*ztmp)) {
01015                                 /* The point is inside one of the vertice!! */
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 }

float set_overlap_volumes ( s_pocket pocket,
s_atm **  lig,
int  natoms,
float  lig_vol,
s_fparams params 
)

-- --

ALL THE FOPLLOWING FUNCTIONS SHOULD BE USED TO CALCULATE AN OVERLAP VOLUME BETWEEN A GIVEN POPCKET AND THE REAL POCKET.

THE FUNCTION set_overlap_volumes WILL SET AN OVERLAP VOLUME FOR EACH POCKET IN THE LIST GIVEN IN ARGUMENT, USING MONTE-CARLO OR BASIC DISCRETE ALGORITHM DEPENDING ON THE PARAMETERS OF THE PROGRAM.

BOTH ALGORITHM CAN BE USED INDEPENDENLTLY WITHOUT THE NEED OF A PARAMETER STRUCTURE (s_fparams)

-- -- ## FUNCTION: void set_overlap_volumes

## SPECIFICATION: This function will set an overlap volume between a pocket, defined here by its voronoi vertices, and the ligand. Depending on the parameters, the method used will be either Monte Carlo approximation, or discret basic approximation.

## PARAMETRES: @ s_pocket *pockets : The pocket @ s_atm **lig : The ligand atoms. @ int natoms natoms : Number of atoms of the ligand. @ float lig_vol : Volume of the ligand @ s_fparams *params : Parameters, giving the algorithm to use and the corresponding parameter.

## RETURN: float: The overlap volume found

Definition at line 881 of file tpocket.c.

References s_fparams::basic_volume_div, c_lst_vertices::n_vertices, s_fparams::nb_mcv_iter, set_basic_overlap_volume(), set_mc_overlap_volume(), and s_pocket::v_lst.

00883 {
00884         /* The function to use for calculation */
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 }

void test_fpocket ( s_tparams par  ) 

## FUNCTION: test_fpocket

## SPECIFICATION: Test fpocket for a set of pdb files. The output is writen in this function, and consists of two files (see documentation for details)

## PARAMETRES: @ s_tparams *par: Parameters, contain the fpocket parameters, and the list of data set information.

## RETURN: void

Definition at line 82 of file tpocket.c.

References s_tparams::fapo, s_tparams::fcomplex, s_tparams::fligan, s_tparams::fpar, s_tparams::g_output, M_CRIT4, M_CRIT5, M_CRIT6, M_LIGMASS, M_LIGVOL, M_MAXPCT1, M_MAXPCT2, M_MINDST, M_NATM3, M_NATM6, M_NDDATA, M_NIDATA, M_NPOCKET, M_OK, M_OREL1, M_OREL2, M_OREL3, M_OREL4, M_OREL5, M_OREL6, M_POCKETVOL_C3, M_POCKETVOL_C6, M_POS1, M_POS2, M_POS3, M_POS4, M_POS5, M_POS6, s_tparams::nfiles, s_tparams::p_output, s_fparams::pdb_path, remove_path(), and test_set().

Referenced by main().

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         /* Store statistics for each files: */
00103         int status[par->nfiles] ;
00104         float ddata [par->nfiles][M_NDDATA];
00105         int idata [par->nfiles][M_NIDATA];
00106 
00107         /* Test all files */
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         /* Printing each complexe statistics */
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         /* Printing global statistics */
00207         FILE *fg = fopen(par->g_output, "w") ;
00208         if(fg) {
00209                 /* Write the first criteria statistics */
00210                 fprintf(fg, "===================== General statistics on all complexes =======================\n") ;
00211 
00212 
00213                 /* Write the first criteria statistics */
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                         //printf("%d NOK: %d, %d, %f\n", ranks[i], nok, N, ((float)nok) / ((float) N)) ;
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                 /* Write the 2nd criteria statistics */
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                 /* Write the 3rd criteria statistics */
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                 /* Write the 4th criteria statistics */
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                 /* Write the 4th criteria statistics */
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                         //printf("%d NOK: %d, %d, %f\n", ranks[i], nok, N, ((float)nok) / ((float) N)) ;
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 }

int test_set ( s_tparams par,
int  i,
float  ddata[][M_NDDATA],
int  idata[][M_NIDATA] 
)

## FUNCTION: void test_set(s_tparams *par)

## SPECIFICATION: Test fpocket for a single set of apo/complexe/ligand.

## PARAMETRES: @ s_tparams *par : Parameters, contain the fpocket parameters, and the list of data set to test. @ int i : ID if the current test set. Used to fill the two following statistic arrays @ float ddata[][] : Used to store statistics for the evaluation (float) @ float idata[][] : Used to store statistics for the evaluation (integers)

## RETURN: int - A flag saying whether or not the evaluation is successfull. Values: M_LIGNOTFOUND -2 M_PDBOPENFAILED -1 M_OK 0 M_NOPOCKETFOUND 1

Load the apo form, the complexe form with ligand, and the complexe form without ligand. The complexe without ligand will allow us to get exact atoms contacted by voronoi vertices detected by fpocket on the complexe form and then detect which atoms are involved in the interaction.

Definition at line 440 of file tpocket.c.

References c_lst_pocket_free(), check_pockets(), s_tparams::fapo, s_tparams::fcomplex, s_tparams::fligan, s_tparams::fpar, free_pdb_atoms(), get_actual_pocket(), get_actual_pocket_DEPRECATED(), get_mol_mass_ptr(), get_mol_volume_ptr(), s_tparams::keep_fpout, s_pdb::latm_lig, M_CRIT2_D, M_DONT_KEEP_LIG, M_KEEP_LIG, M_LIGMASS, M_LIGNOTFOUND, M_LIGVOL, M_NOPOCKETFOUND, M_NPOCKET, M_OK, my_free(), c_lst_pockets::n_pockets, s_pdb::natm_lig, s_fparams::nb_mcv_iter, rpdb_open(), rpdb_read(), search_pocket(), set_pockets_bary(), and write_out_fpocket().

Referenced by test_fpocket().

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         /** Load the apo form, the complexe form with ligand, and the complexe form 
00453           * without ligand. The complexe without ligand will allow us to get exact 
00454           * atoms contacted by voronoi vertices detected by fpocket on the complexe 
00455           * form and then detect which atoms are involved in the interaction.
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         /* Check that both pdb files are opened */
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         /* Check now if the ligand have been found */
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         /* PDBs and ligand OK, now read PDB and launch fpocket */
00482         
00483         /* Get rid of HETATM in the apo structure*/
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         /* Check that at least one pocket have been found */
00492         if(!pockets || pockets->n_pockets <= 0) {
00493                 if(pockets) c_lst_pocket_free(pockets) ;
00494                 return M_NOPOCKETFOUND ;
00495         }
00496         
00497         /* Everything is OK, so now perform the evaluation*/
00498         
00499         /* We found pocket on the apo form get volume and mass of the ligand */
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         /* Get atoms involved in the actual pocket */
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         /* Calculate evaluation criterias */
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         /* write_pdb_com(cpdb, par->fcomplex[i]) ; */
00523         
00524         /* Free memory */
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 }

void write_pockets_stats ( c_lst_pockets pockets,
const char  base_pdb_name[] 
)


Generated on Mon Jun 7 16:44:23 2010 for fpocket by  doxygen 1.5.6