dpocket.h File Reference

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "fpocket.h"
#include "fpout.h"
#include "tpocket.h"
#include "dparams.h"
#include "descriptors.h"
#include "neighbor.h"
#include "pocket.h"
#include "cluster.h"
#include "refine.h"
#include "aa.h"
#include "utils.h"
#include "memhandler.h"

Go to the source code of this file.

Defines

#define M_DP_EXPLICIT   1
#define M_DP_POCKET   2
#define M_DP_POCETLIG   3
#define M_DP_OUTP_HEADER   "pdb lig overlap PP-crit PP-dst crit4 crit5 crit6 crit6_continue lig_vol pock_vol nb_AS nb_AS_norm mean_as_ray mean_as_solv_acc apol_as_prop apol_as_prop_norm mean_loc_hyd_dens mean_loc_hyd_dens_norm hydrophobicity_score volume_score polarity_score polarity_score_norm charge_score flex prop_polar_atm as_density as_density_norm as_max_dst as_max_dst_norm drug_score"
#define M_DP_OUTP_FORMAT   "%s %s %6.2f %2d %6.2f %4.2f %4.2f %2d %5.2f %8.2f %10.2f %5d %4.2f %6.2f %6.2f %5.2f %4.2f %7.2f %4.2f %9.2f %7.2f %5d %5.2f %5d %6.2f %7.2f %5.2f %5.2f %5.2f %5.2f %5.2f"
#define M_DP_OUTP_VAR(fc, l, ovlp, status, dst, c4, c5, c6, c6_c, lv, d)

Functions

void dpocket (s_dparams *par)
void desc_pocket (char fcomplexe[], const char ligname[], s_dparams *par, FILE *f[3])
s_atm ** get_explicit_desc (s_pdb *pdb_cplx_l, s_lst_vvertice *verts, s_atm **lig, int nal, s_dparams *par, int *nai, s_desc *desc)
void write_pocket_desc (const char fc[], const char l[], s_desc *d, float lv, float ovlp, float dst, float c4, float c5, FILE *f)


Define Documentation

#define M_DP_EXPLICIT   1

Definition at line 60 of file dpocket.h.

#define M_DP_OUTP_FORMAT   "%s %s %6.2f %2d %6.2f %4.2f %4.2f %2d %5.2f %8.2f %10.2f %5d %4.2f %6.2f %6.2f %5.2f %4.2f %7.2f %4.2f %9.2f %7.2f %5d %5.2f %5d %6.2f %7.2f %5.2f %5.2f %5.2f %5.2f %5.2f"

format for the dpocket output

Definition at line 66 of file dpocket.h.

Referenced by write_pocket_desc().

#define M_DP_OUTP_HEADER   "pdb lig overlap PP-crit PP-dst crit4 crit5 crit6 crit6_continue lig_vol pock_vol nb_AS nb_AS_norm mean_as_ray mean_as_solv_acc apol_as_prop apol_as_prop_norm mean_loc_hyd_dens mean_loc_hyd_dens_norm hydrophobicity_score volume_score polarity_score polarity_score_norm charge_score flex prop_polar_atm as_density as_density_norm as_max_dst as_max_dst_norm drug_score"

header for the dpocket output

Definition at line 64 of file dpocket.h.

Referenced by dpocket().

#define M_DP_OUTP_VAR ( fc,
l,
ovlp,
status,
dst,
c4,
c5,
c6,
c6_c,
lv,
 ) 

Value:

fc, l, ovlp, status, dst, c4, c5, c6, c6_c, lv, \
                                          d->volume, \
                                          d->nb_asph, d->nas_norm,\
                                          d->mean_asph_ray, \
                                          d->masph_sacc, \
                                          d->apolar_asphere_prop, \
                                          d->prop_asapol_norm, \
                                          d->mean_loc_hyd_dens, \
                                          d->mean_loc_hyd_dens_norm, \
                                          d->hydrophobicity_score, \
                                          d->volume_score, \
                                          d->polarity_score, \
                                          d->polarity_score_norm, \
                                          d->charge_score, \
                                          d->flex, \
                                          d->prop_polar_atm, \
                                          d->as_density, \
                                          d->as_density_norm, \
                                          d->as_max_dst, \
                                          d->as_max_dst_norm, \
                                          d->drug_score
list of descriptors to output in the dpocket output

Definition at line 67 of file dpocket.h.

Referenced by write_pocket_desc().

#define M_DP_POCETLIG   3

Definition at line 62 of file dpocket.h.

#define M_DP_POCKET   2

Definition at line 61 of file dpocket.h.


Function Documentation

void desc_pocket ( char  fcomplexe[],
const char  ligname[],
s_dparams par,
FILE *  f[3] 
)

## FUNCTION: desc_pocket

## SPECIFICATION: @ const char fcomplexe[] : File containing the PDB @ const char ligname[] : Ligand resname identifier @ s_dparams *par : Parameters @ FILE *f[3] : The 3 FILE * to write output in

## PARAMETRES:

## RETURN:

Definition at line 184 of file dpocket.c.

References allocate_s_desc(), atm_corsp(), s_pocket::bary, c_lst_pocket_free(), count_atm_prop_vert_neigh(), count_pocket_lig_vert_ovlp(), dist(), c_lst_pockets::first, s_dparams::fpar, free_pdb_atoms(), get_explicit_desc(), get_mol_volume_ptr(), get_pocket_pvertices(), get_vert_contacted_atms(), s_pdb::latm_lig, M_CRIT4_D, M_CRIT5_D, M_DONT_KEEP_LIG, M_KEEP_LIG, my_free(), s_pdb::natm_lig, s_fparams::nb_mcv_iter, node_pocket::next, s_pocket::pdesc, node_pocket::pocket, s_atm::res_id, rpdb_open(), rpdb_read(), search_pocket(), s_pocket::size, s_pocket::v_lst, c_lst_pockets::vertices, and write_pocket_desc().

Referenced by dpocket().

00186 {
00187         c_lst_pockets *pockets = NULL ;
00188         s_lst_vvertice *verts = NULL ;
00189         
00190         s_atm **interface = NULL ;
00191         s_desc *edesc ;
00192         s_atm **lig = NULL,
00193                   **patoms ;
00194 
00195         float vol, ovlp, dst = 0.0, tmp, c4, c5 ;
00196         int nal = 0,
00197                 nai = 0,        /* Number of atoms in the interface */
00198                 nbpa ;
00199         int j ;
00200 
00201 /*
00202         fprintf(stdout, "dpocket: Loading pdb... ") ; fflush(stdout) ;
00203 */
00204         s_pdb *pdb_cplx_l = rpdb_open(fcomplexe, ligname, M_KEEP_LIG);
00205         s_pdb *pdb_cplx_nl = rpdb_open(fcomplexe, ligname, M_DONT_KEEP_LIG) ;
00206         
00207         if(! pdb_cplx_l || !pdb_cplx_nl || pdb_cplx_l->natm_lig <= 0) {
00208                 if(pdb_cplx_l->natm_lig <= 0) {
00209                         fprintf(stdout, "ERROR - No ligand %s found in %s.\n", ligname, fcomplexe) ;
00210 
00211                 }
00212                 else fprintf(stdout, "ERROR - PDB file %s could not be opened\n", fcomplexe) ;
00213                 
00214                 return ;
00215         }
00216 
00217         rpdb_read(pdb_cplx_l, ligname, M_KEEP_LIG) ;
00218         rpdb_read(pdb_cplx_nl, ligname, M_DONT_KEEP_LIG) ;
00219 /*
00220         fprintf(stdout, " OK\n") ;
00221 */
00222 
00223         lig = pdb_cplx_l->latm_lig ;
00224         nal = pdb_cplx_l->natm_lig ;
00225 
00226         /*check if there are multiple ligand mols*/
00227         int n_lig_molecules=1;
00228         char chain_tmp[2];
00229         int resnumber_tmp;
00230         strcpy(chain_tmp,lig[0]->chain);
00231         resnumber_tmp = lig[0]->res_id;
00232         
00233         for (j = 1 ; j < nal ; j++) {
00234             if(strcmp(chain_tmp,lig[j]->chain) !=0 || resnumber_tmp!=lig[j]->res_id){
00235                 n_lig_molecules++;
00236                 strcpy(chain_tmp,lig[j]->chain);
00237                 resnumber_tmp =lig[j]->res_id;
00238             }
00239         }
00240         
00241                 /* Getting explicit interface using the known ligand */
00242 /*
00243                 fprintf(stdout, "dpocket: Explicit pocket definition... \n") ; 
00244                 fflush(stdout) ;
00245 */
00246         pockets = search_pocket(pdb_cplx_nl, par->fpar,pdb_cplx_l) ;
00247         if(pockets == NULL) {
00248                 fprintf(stdout, "ERROR - No pocket found for %s\n", fcomplexe) ;
00249                 return ;
00250         }
00251         //else write_out_fpocket(pockets, pdb_cplx_nl, fcomplexe);
00252 /*
00253         verts = load_vvertices(pdb_cplx_nl, 3, par->fpar->asph_min_size,
00254                                                    par->fpar->asph_max_size) ;
00255 */
00256 
00257         verts = pockets->vertices ;
00258         edesc = allocate_s_desc() ;
00259         interface = get_explicit_desc(pdb_cplx_l, verts, lig, nal, par,
00260                                                                    &nai, edesc) ;
00261 
00262         /* Writing output */
00263         vol = get_mol_volume_ptr(lig, nal, par->fpar->nb_mcv_iter) ;
00264         write_pocket_desc(fcomplexe, ligname, edesc, vol, 100.0, 0.0, 1.0, 1.0, f[0]) ;
00265 
00266         node_pocket *cur = pockets->first ;
00267         s_vvertice **pvert = NULL ;
00268         while(cur) {
00269                 /* Get the natomic overlap */
00270                 patoms = get_vert_contacted_atms(cur->pocket->v_lst, &nbpa) ;
00271                 ovlp = atm_corsp(interface, nai, patoms, nbpa) ;
00272 
00273                 /* Get the smallest distance of the ligand to the pocket
00274                    (PocketPicker criteria) */
00275                 for (j = 0 ; j < nal ; j++) {
00276                         tmp = dist(lig[j]->x, lig[j]->y, lig[j]->z,
00277                                            cur->pocket->bary[0], cur->pocket->bary[1],
00278                                            cur->pocket->bary[2]) ;
00279                         if(j == 0) dst = tmp ;
00280                         else {
00281                                 if(tmp < dst) dst = tmp ;
00282                         }
00283                 }
00284 
00285                 /* Get the consensus criteria too */
00286                 pvert = get_pocket_pvertices(cur->pocket) ;
00287 
00288                 c4 = count_atm_prop_vert_neigh( lig, pdb_cplx_l->natm_lig,
00289                                                                             pvert, cur->pocket->size, M_CRIT4_D,n_lig_molecules) ;
00290                 c5 = count_pocket_lig_vert_ovlp(lig, pdb_cplx_l->natm_lig,
00291                                                                                 pvert, cur->pocket->size, M_CRIT5_D) ;
00292 
00293                 /* */
00294                 if(ovlp > 40.0 || dst < 4.0) {
00295                         write_pocket_desc(fcomplexe, ligname, cur->pocket->pdesc, vol,
00296                                                           ovlp, dst, c4, c5, f[1]) ;
00297                 }
00298                 else {
00299                         write_pocket_desc(fcomplexe, ligname, cur->pocket->pdesc, vol,
00300                                                           ovlp, dst, c4, c5, f[2]) ;
00301                 }
00302                 my_free(patoms) ;
00303                 cur = cur->next ;
00304         }
00305 
00306         /* Free memory */
00307         c_lst_pocket_free(pockets) ;
00308         my_free(interface) ;
00309         free_pdb_atoms(pdb_cplx_l) ;
00310         free_pdb_atoms(pdb_cplx_nl) ;
00311         
00312 }

void dpocket ( s_dparams par  ) 

## FUNCTION: dpocket

## SPECIFICATION: Dpocket main function. Simple loop is performed over all files.

## PARAMETRES: @ s_dparams *par: Parameters of the programm

## RETURN: void

Definition at line 116 of file dpocket.c.

References desc_pocket(), s_dparams::f_exp, s_dparams::f_fpcknp, s_dparams::f_fpckp, s_dparams::fcomplex, get_aa_name3(), s_dparams::ligs, M_DP_OUTP_HEADER, and s_dparams::nfiles.

Referenced by main().

00117 {
00118         int i, j ;
00119         FILE *fout[3] ;
00120 
00121         if(par) {
00122         /* Opening output file file */
00123 
00124                 fout[0] = fopen(par->f_exp,"w") ;
00125                 fout[1] = fopen(par->f_fpckp,"w") ;
00126                 fout[2] = fopen(par->f_fpcknp,"w") ;
00127 
00128                 if(fout[0] && fout[1] && fout[2]) {
00129 
00130                 /* Writing column names */
00131         
00132                         for( i = 0 ; i < 3 ; i++ ) {
00133                                 fprintf(fout[i], M_DP_OUTP_HEADER) ;
00134                                 for( j = 0 ; j < 20 ; j++ ) fprintf(fout[i], " %s", get_aa_name3(j));
00135                                 fprintf(fout[i], "\n");
00136                         }
00137         
00138                 /* Begins dpocket */
00139                         for(i = 0 ; i < par->nfiles ; i++) {
00140                                 fprintf(stdout, "<dpocket>s %d/%d - %s:",
00141                                                 i+1, par->nfiles, par->fcomplex[i]) ;
00142 
00143                                 desc_pocket(par->fcomplex[i], par->ligs[i], par, fout) ;
00144                                 if(i == par->nfiles - 1) fprintf(stdout,"\n") ;
00145                                 else fprintf(stdout,"\r") ;
00146 
00147                                 fflush(stdout) ;
00148                         }
00149 
00150                         for( i = 0 ; i < 3 ; i++ ) fclose(fout[i]) ;
00151                 }
00152                 else {
00153                         if(! fout[0]) {
00154                                 fprintf(stdout, "! Output file <%s> couldn't be opened.\n", 
00155                                                 par->f_exp) ;
00156                         }
00157                         else if (! fout[1]) {
00158                                 fprintf(stdout, "! Output file <%s> couldn't be opened.\n", 
00159                                                 par->f_fpckp) ;
00160                         }
00161                         else {
00162                                 fprintf(stdout, "! Output file <%s> couldn't be opened.\n", 
00163                                                 par->f_fpcknp) ;
00164                         }
00165                 }
00166         }
00167 }

s_atm** get_explicit_desc ( s_pdb pdb_cplx_l,
s_lst_vvertice verts,
s_atm **  lig,
int  nal,
s_dparams par,
int *  nai,
s_desc desc 
)

## FUNCTION: get_explicit_desc

## SPECIFICATION: Determine the explicit pocket (see comments at the top of the file), and calculate descriptors (and fill the input structure)

## PARAMETRES: @ s_pdb *pdb_cplx_l : The pdb structure @ s_lst_vvertice *verts : The vertices found @ s_atm **lig : Atoms of the ligand @ int nal : Number of atom in the ligand @ s_dparams *par : Parameters @ int *nai : OUTPUT Number of atom in the interface @ s_desc *desc : OUTPUT Descriptors

## RETURN: s_atm **: List of pointer to atoms defining the explicit pocket. plus nai and desc are filled.

Definition at line 336 of file dpocket.c.

References s_fparams::flag_do_asa_and_volume_calculations, s_dparams::fpar, get_mol_atm_neigh(), get_mol_ctd_atm_neigh(), get_mol_vert_neigh(), s_dparams::interface_dist_crit, s_dparams::interface_method, s_pdb::latoms_p, M_INTERFACE_METHOD2, M_INTERFACE_SEARCH, my_free(), s_pdb::natoms, s_fparams::nb_mcv_iter, s_lst_vvertice::nvert, s_lst_vvertice::pvertices, and set_descriptors().

Referenced by desc_pocket().

00338 {
00339         int nvn = 0 ;   /* Number of vertices in the interface */
00340 
00341         s_atm **interface = NULL ;
00342 
00343 /*
00344         fprintf(stdout, "dpocket: Determning explicit interface... ") ; 
00345         fflush(stdout) ;
00346 */
00347         
00348         if(par->interface_method == M_INTERFACE_METHOD2) {
00349         /* Use the distance-based method to define the interface */
00350                 interface = get_mol_atm_neigh(  lig, nal, pdb_cplx_l->latoms_p,
00351                                                                                 pdb_cplx_l->natoms,
00352                                                                                 par->interface_dist_crit, nai) ;
00353         }
00354         else {
00355         /* Use the voronoi vertices-based method to define the interface */
00356                 
00357                 interface = get_mol_ctd_atm_neigh(lig, nal, verts->pvertices, verts->nvert,
00358                                                                                   par->interface_dist_crit,
00359                                                                                   M_INTERFACE_SEARCH, nai) ;
00360         }
00361 
00362         /* Get a tab of pointer for interface's vertices to send a correct argument 
00363          * type to set_descriptors */
00364         s_vvertice **tpverts = get_mol_vert_neigh(lig, nal, verts->pvertices, verts->nvert,
00365                                                                                           par->interface_dist_crit, &nvn) ;
00366         
00367         /* Ok we have the interface and the correct vertices list, now calculate 
00368          * descriptors and write it.
00369          **/
00370 /*
00371         fprintf(stdout, "dpocket: Calculating descriptors... ") ; fflush(stdout) ;
00372 */
00373         set_descriptors(interface, *nai, tpverts, nvn, desc, par->fpar->nb_mcv_iter,pdb_cplx_l,par->fpar->flag_do_asa_and_volume_calculations);
00374 /*
00375         fprintf(stdout, " OK\n") ;
00376 */
00377 
00378         /* Free memory */
00379         my_free(tpverts) ;
00380 
00381         return interface ;
00382 }

void write_pocket_desc ( const char  fc[],
const char  l[],
s_desc d,
float  lv,
float  ovlp,
float  dst,
float  c4,
float  c5,
FILE *  f 
)

## FUNCTION: write_pocket_desc

## SPECIFICATION: Write pocket descriptors into a file.

## PARAMETRES: @ const char fc[] : Name of the pdb file @ const char l[] : Resname of the ligand @ s_desc *d : Stucture of descriptors @ float lv : Ligand volume @ float ovlp : Overlap @ FILE *f : Buffer to write in

## RETURN: void

Definition at line 403 of file dpocket.c.

References s_desc::aa_compo, M_CRIT4_VAL, M_CRIT5_VAL, M_DP_OUTP_FORMAT, and M_DP_OUTP_VAR.

Referenced by desc_pocket().

00405 {
00406         int status = 0 ;
00407         if(dst < 4.0) status = 1 ;
00408 
00409         int c6 = (c4 >= M_CRIT4_VAL && c5 >= M_CRIT5_VAL) ?1:0 ;
00410         float c6_c = ((c4 - M_CRIT4_VAL)/ (1-M_CRIT4_VAL)) + ((c5 - M_CRIT5_VAL)/ (1-M_CRIT5_VAL)) ;
00411 
00412         fprintf(f, M_DP_OUTP_FORMAT, M_DP_OUTP_VAR(fc, l, ovlp, status, dst, c4, c5, c6, c6_c, lv, d)) ;
00413 
00414         int i ;
00415         for(i = 0 ; i < 20 ; i++) fprintf(f, " %3d", d->aa_compo[i]) ;
00416         
00417         fprintf(f, "\n") ;
00418 }


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