asa.h File Reference

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include "rpdb.h"
#include "voronoi.h"
#include "pocket.h"
#include "psorting.h"
#include "cluster.h"
#include "refine.h"
#include "fparams.h"
#include "memhandler.h"

Go to the source code of this file.

Defines

#define M_NSPIRAL   100
#define M_PADDING   1.0
#define M_PROBE_SIZE   1.4
#define M_PROBE_SIZE2   2.2
#define PI   3.1415926535897931

Functions

int atom_not_in_list (s_atm *a, s_atm **atoms, int natoms)
void set_ASA (s_desc *desc, s_pdb *pdb, s_vvertice **tvert, int nvert)
int * get_unique_atoms (s_vvertice **tvert, int nvert, int *n_ua, s_atm **p, int na)
float * get_points_on_sphere (int nop)
int * get_surrounding_atoms_idx (s_vvertice **tvert, int nvert, s_pdb *pdb, int *n_sa)


Define Documentation

#define M_NSPIRAL   100

COPYRIGHT DISCLAIMER

Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby disclaim all copyright interest in the program “fpocket” (which performs protein cavity detection) written by Vincent Le Guilloux and Peter Schmidtke.

Vincent Le Guilloux 28 November 2008 Peter Schmidtke 28 November 2008 Pierre Tuffery 28 November 2008

GNU GPL

This file is part of the fpocket package.

fpocket is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

fpocket is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with fpocket. If not, see <http://www.gnu.org/licenses/>.

Definition at line 61 of file asa.h.

Referenced by set_ASA().

#define M_PADDING   1.0

Definition at line 62 of file asa.h.

Referenced by get_surrounding_atoms_idx().

#define M_PROBE_SIZE   1.4

Definition at line 63 of file asa.h.

Referenced by set_ASA().

#define M_PROBE_SIZE2   2.2

Definition at line 64 of file asa.h.

Referenced by set_ASA().

#define PI   3.1415926535897931

Definition at line 65 of file asa.h.

Referenced by get_points_on_sphere(), and set_ASA().


Function Documentation

int atom_not_in_list ( s_atm a,
s_atm **  atoms,
int  natoms 
)

float* get_points_on_sphere ( int  nop  ) 

## FUNCTION: get_points_on_sphere

## SPECIFICATION: This function takes an integer as argument and returns a unit sphere with distributed points on its surface according to the Golden Section Spiral Distribution

## PARAMETRES: @ int nop : number of points to create on the unit sphere (resolution of the surface)

## RETURN: float* : list of points on the unit sphere

Definition at line 443 of file asa.c.

References PI.

Referenced by set_ASA().

00443                                      {
00444     float *pts =NULL;
00445     pts=(float *) malloc(sizeof (float) * nop * 3);
00446     float inc = PI * (3.0 - sqrt(5.0));
00447     float off = 2.0 / (float) nop;
00448     float y, r, phi;
00449     int k;
00450     for (k = 0; k < nop; k++) {
00451         y = ((float) k) * off - 1.0 + (off / 2.0);
00452         r = sqrt(1.0 - y * y);
00453         phi = k * inc;
00454         pts[3 * k] = cos(phi) * r;
00455         pts[3 * k + 1] = y;
00456         pts[3 * k + 2] = sin(phi) * r;
00457     }
00458     return pts;
00459 }

int* get_surrounding_atoms_idx ( s_vvertice **  tvert,
int  nvert,
s_pdb pdb,
int *  n_sa 
)

## FUNCTION: get_surrounding_atoms_idx

## SPECIFICATION: Get atom ids around a given set of voronoi vertices

## PARAMETRES: @ s_vvertices **tvert : List of pointers to voronoi vertices, @ int nvert : Number of Voronoi vertices @ s_pdb *pdb : Structure of the protein @ int *n_sa : Pointer to int holding the number of surrounding atoms

## RETURN: int * : atom ids of surrounding atoms

Definition at line 107 of file asa.c.

References ddist(), in_tab(), s_pdb::latoms_p, M_PADDING, s_pdb::natoms, s_vvertice::ray, s_atm::symbol, s_vvertice::x, s_atm::x, s_vvertice::y, s_atm::y, s_vvertice::z, and s_atm::z.

Referenced by set_ASA(), and write_pocket_pdb_DB().

00107                                                                                   {
00108     s_atm *a=NULL;
00109     int *sa=NULL;
00110     int i,z,flag=0;
00111     *n_sa=0;
00112     for(i=0;i<pdb->natoms;i++){
00113         a=pdb->latoms_p[i];
00114         //consider only heavy atoms for vdw incr.
00115         if(strncmp(a->symbol,"H",1)){
00116             flag=0;
00117             for(z=0;z<nvert && !flag;z++){
00118                 //flag=atom_not_in_list(a,sa,*n_sa);
00119                 flag=in_tab(sa,*n_sa,i);
00120                 if(!flag && ddist(a->x,a->y,a->z,tvert[z]->x,tvert[z]->y,tvert[z]->z)<(tvert[z]->ray+M_PADDING)*(tvert[z]->ray+M_PADDING)){
00121                     *n_sa=*n_sa+1;
00122                     if(sa==NULL){
00123                         sa=(int *)malloc(sizeof(int));
00124                         sa[*n_sa-1]=i;
00125                     }
00126                     else {
00127                         sa=(int *)realloc(sa,sizeof(int)*(*n_sa));
00128                         sa[*n_sa-1]=i;
00129                     }
00130                 }
00131             }
00132         }
00133     }
00134     return sa;
00135 }

int* get_unique_atoms ( s_vvertice **  tvert,
int  nvert,
int *  n_ua,
s_atm **  atoms,
int  na 
)

## FUNCTION: get_unique_atoms

## SPECIFICATION: Get a list of unique atom ids near the pocket

## PARAMETRES: @ s_vvertices **tvert : List of pointers to voronoi vertices, @ int nvert : Number of Voronoi vertices @ int *n_sa : Pointer to int holding the number of surrounding atoms @ s_atm **atoms : List of pointers to atoms @ int na : Number of atoms in atoms

## RETURN: int * : atom ids of unique atoms

Definition at line 157 of file asa.c.

References s_atm::id, in_tab(), and s_vvertice::neigh.

00157                                                                                     {
00158     s_atm *a=NULL;
00159     int *ua=NULL;
00160     int z,j;
00161     int ca_idx;
00162     *n_ua=0;
00163     int flag=0;
00164 
00165     s_vvertice *vcur = NULL ;
00166     s_atm **neighs = NULL ;
00167 /*
00168     fprintf(stdout, "\nIn get unique atom\n") ;
00169 */
00170     for(z=0;z<nvert;z++){
00171         vcur = tvert[z] ;
00172         neighs = tvert[z]->neigh ;
00173         for(j=0;j<4;j++){
00174             a=neighs[j];
00175             flag=in_tab(ua,*n_ua,a->id);
00176             if(!flag) {
00177                 *n_ua=*n_ua+1;
00178                 if(ua==NULL) ua=(int *)malloc(sizeof(int));
00179                 else ua=(int *)realloc(ua,sizeof(int)*(*n_ua));
00180                 
00181                 if(a->id-1 < na && a==atoms[a->id-1]) {
00182                     ua[*n_ua-1]=a->id-1;
00183                /*     if(a->id >= 1631) {
00184                         fprintf(stdout, "\nSetting bad id! %d", a->id ) ;
00185                     }*/
00186                 }
00187                 else {
00188                     for(ca_idx=0;ca_idx<na;ca_idx++){
00189                         if(a==atoms[ca_idx]) {
00190                             ua[*n_ua-1]=ca_idx;
00191 
00192                  /*           if(ca_idx >= 1631) {
00193 
00194                                 fprintf(stdout, "\nSetting bad id! %d", ca_idx ) ;
00195                             }*/
00196                             break;
00197                         }
00198                     }
00199                 }
00200             }
00201         }
00202     }
00203 
00204     return ua;
00205 }

void set_ASA ( s_desc desc,
s_pdb pdb,
s_vvertice **  tvert,
int  nvert 
)

## FUNCTION: set_ASA

## SPECIFICATION: The actual ASA calculation, resulst are written to the descriptor structure

## PARAMETRES: @ s_desc *desc : Structure of descriptors @ s_pdb *pdb : Structure containing the protein @ s_vvertices **tvert : List of pointers to Voronoi vertices @ int nvert : Number of vertices

## RETURN: void

Definition at line 267 of file asa.c.

References ddist(), s_atm::electroneg, get_points_on_sphere(), get_surrounding_atoms_idx(), get_unique_atoms_DEPRECATED(), s_pdb::latoms_p, M_NSPIRAL, M_PROBE_SIZE, M_PROBE_SIZE2, my_malloc(), s_desc::n_abpa, PI, s_atm::radius, s_vvertice::ray, s_desc::surf_apol_vdw14, s_desc::surf_apol_vdw22, s_desc::surf_pol_vdw14, s_desc::surf_pol_vdw22, s_desc::surf_vdw14, s_desc::surf_vdw22, s_atm::x, s_atm::y, and s_atm::z.

Referenced by set_descriptors().

00268 {
00269     desc->surf_pol_vdw14=0.0;
00270     desc->surf_apol_vdw14=0.0;
00271     desc->surf_vdw14=0.0;
00272     desc->surf_vdw22=0.0;
00273     desc->surf_pol_vdw22=0.0;
00274     desc->surf_apol_vdw22=0.0;
00275     desc->n_abpa=0;
00276     int *sa=NULL;    /*surrounding atoms container*/
00277     /*int *ua=NULL;    /*unique atoms contacting vvertices*/
00278     s_atm ** ua = NULL ;
00279     
00280     int n_sa = 0;
00281     int n_ua = 0;
00282     int i;
00283     sa=get_surrounding_atoms_idx(tvert,nvert,pdb, &n_sa);
00284     /*ua=get_unique_atoms_DEPRECATED(tvert,nvert, &n_ua,pdb->latoms_p,pdb->natoms);*/
00285 
00286     ua=get_unique_atoms_DEPRECATED(tvert,nvert, &n_ua);
00287     float *abpatmp=NULL;
00288     abpatmp=(float *)my_malloc(sizeof(float)*n_ua);
00289 /*
00290     for(i = 0 ; i < pdb->natoms ; i++) {
00291         if(pdb->latoms_p[i]->id > 1631) {
00292             fprintf(stdout, "\nWTF at %d %d", i,pdb->latoms_p[i]->id) ;
00293         }
00294     }
00295     for( i = 0 ; i < n_ua ; i++) {
00296         if(ua[i] > 1631)
00297             fprintf(stdout, "Atom %d: %d\n", i, ua[i]) ;
00298 
00299     }
00300 */
00301 
00302     s_atm *a,*cura;
00303     float *curpts=NULL,tz,tx,ty,dsq,area;
00304     int j=0,iv,k,burried,nnburried,vidx,vrefburried;
00305     curpts=get_points_on_sphere(M_NSPIRAL);
00306     for(i=0;i<n_ua;i++){
00307         abpatmp[i]=0.0;
00308 /*
00309         fprintf(stdout, "\nUA %d (%d): %d (%d)", i, pdb->natoms, ua [i], n_ua);
00310 */
00311 /*
00312         if(ua [i] >= pdb->natoms) {
00313             fprintf(stdout, "\nWOOPS at %d! %d \n", i, ua[i]) ;//exit(0) ;
00314         }
00315 */
00316 /*
00317         cura=pdb->latoms_p[ua[i]];
00318 */
00319         cura = ua[i] ;
00320         nnburried=0;
00321         
00322         for(k=0;k<M_NSPIRAL;k++){
00323             burried=0;
00324             j=0;
00325             tx=cura->x+curpts[3*k]*(cura->radius+M_PROBE_SIZE);
00326             ty=cura->y+curpts[3*k+1]*(cura->radius+M_PROBE_SIZE);
00327             tz=cura->z+curpts[3*k+2]*(cura->radius+M_PROBE_SIZE);
00328             vrefburried=1;
00329             for(iv=0;iv<nvert;iv++){
00330                 for(vidx=0;vidx<4;vidx++){
00331                     if(cura==tvert[iv]->neigh[vidx]){
00332                         if(ddist(tx,ty,tz,tvert[iv]->x,tvert[iv]->y,tvert[iv]->z)<=tvert[iv]->ray*tvert[iv]->ray) vrefburried=0;
00333                     }
00334                 }
00335             }
00336             while(!burried && j< n_sa && !vrefburried){
00337                 a=pdb->latoms_p[sa[j]];
00338                 if(a!=cura){
00339                     dsq=ddist(tx,ty,tz,a->x,a->y,a->z);
00340                     if(dsq<(a->radius+M_PROBE_SIZE)*(a->radius+M_PROBE_SIZE)) burried=1;
00341                 }
00342                 j++;
00343             }
00344             if(!burried && !vrefburried) {
00345                 nnburried++;
00346             }
00347         }
00348         area=(4*PI*(cura->radius+M_PROBE_SIZE)*(cura->radius+M_PROBE_SIZE)/(float)M_NSPIRAL)*nnburried;
00349         abpatmp[i]=area;
00350         if(cura->electroneg<2.8) desc->surf_apol_vdw14=desc->surf_apol_vdw14+area;
00351         else desc->surf_pol_vdw14=desc->surf_pol_vdw14+area;
00352         desc->surf_vdw14=desc->surf_vdw14+area;
00353         
00354     }
00355     
00356 
00357     /*now test with vdw +2.2*/
00358     for(i=0;i<n_ua;i++){
00359 /*
00360         fprintf(stdout, "\nUA %d (%d): %d (%d)", i, pdb->natoms, ua [i], n_ua);
00361 */
00362 /*
00363         if(ua [i] >= pdb->natoms) {
00364             fprintf(stdout, "\nWOOPS at %d! %d \n", i, ua[i]) ;//exit(0) ;
00365         }
00366 */
00367 /*
00368         cura=pdb->latoms_p[ua[i]];
00369 */
00370         cura = ua[i] ;
00371         nnburried=0;
00372 
00373         for(k=0;k<M_NSPIRAL;k++){
00374             burried=0;
00375             j=0;
00376             tx=cura->x+curpts[3*k]*(cura->radius+M_PROBE_SIZE2);
00377             ty=cura->y+curpts[3*k+1]*(cura->radius+M_PROBE_SIZE2);
00378             tz=cura->z+curpts[3*k+2]*(cura->radius+M_PROBE_SIZE2);
00379             vrefburried=1;
00380             for(iv=0;iv<nvert;iv++){
00381                 for(vidx=0;vidx<4;vidx++){
00382                     if(cura==tvert[iv]->neigh[vidx]){
00383                         if(ddist(tx,ty,tz,tvert[iv]->x,tvert[iv]->y,tvert[iv]->z)<=tvert[iv]->ray*tvert[iv]->ray) vrefburried=0;
00384                     }
00385                 }
00386             }
00387             while(!burried && j< n_sa && !vrefburried){
00388                 a=pdb->latoms_p[sa[j]];
00389                 if(a!=cura){
00390                     dsq=ddist(tx,ty,tz,a->x,a->y,a->z);
00391                     if(dsq<(a->radius+M_PROBE_SIZE2)*(a->radius+M_PROBE_SIZE2)) burried=1;
00392                 }
00393                 j++;
00394             }
00395             if(!burried && !vrefburried) {
00396                 nnburried++;
00397             }
00398         }
00399         area=(4*PI*(cura->radius+M_PROBE_SIZE2)*(cura->radius+M_PROBE_SIZE2)/(float)M_NSPIRAL)*nnburried;
00400         if(cura->electroneg<2.8) {
00401             if(area<=abpatmp[i] && abpatmp[i] <=10.0 && area > 0.0){
00402                 desc->n_abpa+=1;
00403             }
00404             desc->surf_apol_vdw22=desc->surf_apol_vdw22+area;
00405         }
00406         else desc->surf_pol_vdw22=desc->surf_pol_vdw22+area;
00407         desc->surf_vdw22=desc->surf_vdw22+area;
00408 
00409     }
00410     free(curpts);
00411 
00412 
00413 
00414     curpts=NULL;
00415    /* for(i=0;i<n_ua-1;i++){
00416         free(ua[i]);
00417     }*/
00418     
00419     free(ua);
00420     free(sa);
00421 
00422     sa=NULL;
00423     ua=NULL;
00424 }


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