#include "../headers/asa.h"
Go to the source code of this file.
Functions | |
int | atom_in_list (s_atm *a, s_atm **atoms, int natoms) |
int * | get_surrounding_atoms_idx (s_vvertice **tvert, int nvert, s_pdb *pdb, int *n_sa) |
int * | get_unique_atoms (s_vvertice **tvert, int nvert, int *n_ua, s_atm **atoms, int na) |
s_atm ** | get_unique_atoms_DEPRECATED (s_vvertice **tvert, int nvert, int *n_ua) |
void | set_ASA (s_desc *desc, s_pdb *pdb, s_vvertice **tvert, int nvert) |
float * | get_points_on_sphere (int nop) |
## FUNCTION: atom_not_in_list
## SPECIFICATION: This function checks if the atom a is in the list of atoms "atoms"
## PARAMETRES: @ s_atm *a : The query atom, @ s_atm **atoms : The set of atoms to test @ int natoms : number of atoms in the set of atoms
## RETURN: 1 if a is in atoms, 0 if not
Definition at line 74 of file asa.c.
References s_atm::id.
Referenced by get_unique_atoms_DEPRECATED().
00074 { 00075 int i; 00076 if(atoms){ 00077 for(i = 0 ; i < natoms ; i++){ 00078 if(atoms[i]==a) { 00079 if(atoms[i]->id != a->id) { 00080 fprintf(stdout,"WARNING asa.c: atom in the list but with different ID!") ; 00081 } 00082 return 1; 00083 } 00084 } 00085 } 00086 return 0; 00087 }
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 }
s_atm** get_unique_atoms_DEPRECATED | ( | s_vvertice ** | tvert, | |
int | nvert, | |||
int * | n_ua | |||
) |
Definition at line 208 of file asa.c.
References atom_in_list(), and s_vvertice::neigh.
Referenced by set_ASA().
00209 { 00210 s_vvertice *vcur = NULL ; 00211 s_atm **neighs = NULL ; 00212 00213 s_atm *a=NULL; 00214 s_atm **ua=(s_atm **) malloc(sizeof(s_atm*)*10); 00215 00216 int tab_size = 10 ; 00217 int nb_ua = 0; 00218 int z = 0, j = 0; 00219 00220 /* Loop over each vertice */ 00221 for(z = 0 ; z < nvert ; z++){ 00222 vcur = tvert[z] ; 00223 neighs = tvert[z]->neigh ; 00224 00225 /* Loop over each vertice neighbors */ 00226 for(j = 0 ; j < 4 ; j++) { 00227 a = neighs[j]; 00228 if(atom_in_list(a, ua, nb_ua) == 0) { 00229 ua[nb_ua] = a; 00230 00231 nb_ua = nb_ua + 1; 00232 if(nb_ua >= tab_size){ 00233 ua = (s_atm **) realloc(ua,sizeof(s_atm*)*(nb_ua+10)); 00234 tab_size += 10 ; 00235 } 00236 } 00237 } 00238 } 00239 00240 *n_ua = nb_ua ; 00241 00242 return ua; 00243 }
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 }