descriptors.c File Reference

#include "../headers/descriptors.h"

Go to the source code of this file.

Functions

s_descallocate_s_desc (void)
void reset_desc (s_desc *desc)
void set_descriptors (s_atm **atoms, int natoms, s_vvertice **tvert, int nvert, s_desc *desc, int niter, s_pdb *pdb, int flag_do_expensive_calculations)
int get_vert_apolar_density (s_vvertice **tvert, int nvert, s_vvertice *vert)
int countResidues (s_atm *atoms, int natoms, char chain[2])
void set_atom_based_descriptors (s_atm **atoms, int natoms, s_desc *desc, s_atm *all_atoms, int all_natoms)
void set_aa_desc (s_desc *desc, const char *aa_name)


Function Documentation

s_desc* allocate_s_desc ( void   ) 

## FUNCTION: allocate_s_desc

## SPECIFICATION: Allocate a descroptor structure

## PARAMETRES:

## RETURN: s_desc*

Definition at line 86 of file descriptors.c.

References my_malloc(), and reset_desc().

Referenced by desc_pocket().

00087 {
00088         s_desc *desc = (s_desc*)my_malloc(sizeof(s_desc)) ;
00089         
00090         reset_desc(desc) ;
00091 
00092         return desc ;
00093 }

int countResidues ( s_atm atoms,
int  natoms,
char  chain[2] 
)

Definition at line 333 of file descriptors.c.

References s_atm::chain, and s_atm::res_id.

Referenced by set_atom_based_descriptors().

00333                                                           {
00334     int i,
00335             n=0,
00336             curRes=-1,
00337             firstRes=-1,
00338             lastRes=-1;
00339     s_atm *curatom = NULL ;
00340     for(i=0;i<natoms;i++){
00341         curatom = &(atoms[i]) ;
00342         if(!strncmp(curatom->chain,chain,1) ){
00343             if(firstRes==-1) firstRes=curatom->res_id;
00344             lastRes=curatom->res_id;
00345             if(curRes!=curatom->res_id){
00346                 curRes=curatom->res_id;
00347                 n+=1;
00348             }
00349         }
00350     }
00351     return lastRes-firstRes;
00352 }

int get_vert_apolar_density ( s_vvertice **  tvert,
int  nvert,
s_vvertice vert 
)

## FUNCTION: get_vert_apolar_density

## SPECIFICATION: Here we calculate the number of apolar vertices (vertices that contact at least 3 atoms having their electronegativity > 2.7) that lie within a range of 0-r () from a given reference vertice, r being its own radius.

It provides the apolar density for a given vertice, that will be used for the calculation of the total apolar density of the pocket, defined as the mean value of it.

## PARAMETRES: @ s_vvertice **tvert : The list of vertices @ int nvert : The number of vertices @ s_vvertice *vert : The reference vertice.

## RETURN: int: The apolar density as defined previously.

Definition at line 309 of file descriptors.c.

References dist(), M_APOLAR_AS, s_vvertice::ray, s_vvertice::type, s_vvertice::x, s_vvertice::y, and s_vvertice::z.

00310 {
00311         int apol_neighbours = 0,
00312                 i = 0 ;
00313 
00314         s_vvertice *vc = NULL ;
00315 
00316         float vx = vert->x, 
00317                   vy = vert->y,
00318                   vz = vert->z,
00319                   vray = vert->ray ;
00320         
00321         for(i = 0 ; i < nvert ; i++) {
00322                 vc = tvert[i] ;
00323                 if(vc != vert && vc->type == M_APOLAR_AS){
00324                         if(dist(vx, vy, vz, vc->x, vc->y, vc->z)-(vc->ray + vray) <= 0.) {
00325                                 apol_neighbours += 1 ;
00326                         }
00327                 }
00328         }
00329 
00330         return apol_neighbours ;
00331 }

void reset_desc ( s_desc desc  ) 

## FUNCTION: reset_s_desc

## SPECIFICATION: Reset descriptors to 0 values.

## PARAMETRES:

## RETURN: void

Definition at line 108 of file descriptors.c.

References s_desc::aa_compo, s_desc::apolar_asphere_prop, s_desc::as_density, s_desc::as_density_norm, s_desc::as_max_dst, s_desc::as_max_dst_norm, s_desc::characterChain1, s_desc::characterChain2, s_desc::charge_score, s_desc::drug_score, s_desc::flex, s_desc::hydrophobicity_score, s_desc::masph_sacc, s_desc::mean_asph_ray, s_desc::mean_loc_hyd_dens, s_desc::mean_loc_hyd_dens_norm, s_desc::nas_norm, s_desc::nb_asph, s_desc::numResChain1, s_desc::numResChain2, s_desc::polarity_score, s_desc::polarity_score_norm, s_desc::prop_asapol_norm, s_desc::prop_polar_atm, s_desc::surf_apol_vdw, s_desc::surf_apol_vdw14, s_desc::surf_apol_vdw22, s_desc::surf_pol_vdw, s_desc::surf_pol_vdw14, s_desc::surf_pol_vdw22, s_desc::surf_vdw, s_desc::surf_vdw14, s_desc::surf_vdw22, s_desc::volume, and s_desc::volume_score.

Referenced by allocate_s_desc(), reset_pocket(), and set_pockets_descriptors().

00109 {
00110     desc->hydrophobicity_score = 0.0 ;
00111     desc->volume_score = 0.0 ;
00112     desc->volume = 0.0 ;
00113     desc->prop_polar_atm = 0.0 ;
00114     desc->mean_asph_ray = 0.0 ;
00115     desc->masph_sacc = 0.0 ;
00116     desc->apolar_asphere_prop = 0.0 ;
00117     desc->mean_loc_hyd_dens = 0.0 ;
00118     desc->as_density = 0.0 ;
00119     desc->as_max_dst = 0.0 ;
00120 
00121     desc->flex = 0.0 ;
00122     desc->nas_norm = 0.0 ;
00123     desc->prop_asapol_norm = 0.0 ;
00124     desc->mean_loc_hyd_dens_norm = 0.0 ;
00125     desc->as_density_norm = 0.0 ;
00126     desc->polarity_score_norm = 0.0 ;
00127     desc->as_max_dst_norm = 0.0 ;
00128 
00129     desc->nb_asph = 0 ;
00130     desc->polarity_score  = 0 ;
00131     desc->charge_score = 0 ;
00132 
00133     desc->surf_apol_vdw=0.0;
00134     desc->surf_apol_vdw14=0.0;
00135     desc->surf_apol_vdw22=0.0;
00136 
00137     desc->surf_pol_vdw=0.0;
00138     desc->surf_pol_vdw14=0.0;
00139     desc->surf_pol_vdw22=0.0;
00140 
00141     desc->surf_vdw=0.0;
00142     desc->surf_vdw14=0.0;
00143     desc->surf_vdw22=0.0;
00144 
00145     desc->drug_score=0.0;
00146     desc->numResChain1=0;
00147     desc->numResChain2=0;
00148     desc->characterChain1=0;
00149     desc->characterChain2=0;
00150 
00151     int i ;
00152     for(i = 0 ; i < 20 ; i++) desc->aa_compo[i] = 0 ;
00153 }

void set_aa_desc ( s_desc desc,
const char *  aa_name 
)

## FUNCTION: set_aa_desc

## SPECIFICATION: Set amino-acid based descriptors.

## PARAMETRES: @ s_desc *desc : OUTPUT: Structure of descriptors to fill @ const char *aa_name : The amino acid name

## RETURN: s_desc*

Definition at line 469 of file descriptors.c.

References s_desc::aa_compo, s_desc::charge_score, get_charge_from_idx(), get_hydrophobicity_score_from_idx(), get_polarity_from_idx(), get_volume_score_from_idx(), s_desc::hydrophobicity_score, M_ALA_IDX, M_ARG_IDX, M_ASN_IDX, M_ASP_IDX, M_CYS_IDX, M_GLN_IDX, M_GLU_IDX, M_GLY_IDX, M_HIS_IDX, M_ILE_IDX, M_LEU_IDX, M_LYS_IDX, M_MET_IDX, M_PHE_IDX, M_PRO_IDX, M_SER_IDX, M_THR_IDX, M_TRP_IDX, M_TYR_IDX, M_VAL_IDX, s_desc::polarity_score, and s_desc::volume_score.

Referenced by set_atom_based_descriptors().

00470 {       
00471         int aa_idx = -1;
00472         char l1 = aa_name[0], 
00473                  l2 = aa_name[1], 
00474                  l3 = aa_name[2] ;
00475 
00476         /* Ok, lets use the less comparisons possible... (may be used in the aa.c
00477          * file later!) 
00478          * Only A, C, G, H, I, L, M, P, S, T and V possibility for the first letter:
00479          **/
00480         switch(l1) {
00481                 case 'A' : /* Either ALA, ASP, ASN or ARG */
00482                         if(l2 == 'L') aa_idx = M_ALA_IDX ;                              /* ALA amino acid! */
00483                         else if(l2 == 'R') aa_idx = M_ARG_IDX ;                 /* ARG amino acid! */
00484                         else if(l2 == 'S' && l3 ==  'P') 
00485                                 aa_idx = M_ASP_IDX ;                                            /* ASP amino acid! */
00486                         else aa_idx = M_ASN_IDX ; break ;                               /* ASN amino acid! */
00487                         
00488                 case 'C' : aa_idx = M_CYS_IDX ; break ;                         /* CYS amino acid! */
00489                         
00490                 case 'G' : /* Either GLU, GLY, or GLN, so just check the 3rd letter */
00491                         if(l3 == 'U') aa_idx = M_GLU_IDX ;                              /* GLU amino acid! */
00492                         else if(l3 == 'Y') aa_idx = M_GLY_IDX ;                 /* GLY amino acid! */
00493                         else aa_idx = M_GLN_IDX ; break ;                               /* GLN amino acid! */
00494 
00495                 case 'H' : aa_idx = M_HIS_IDX ; break ;                         /* HIS amino acid! */
00496                 case 'I' : aa_idx = M_ILE_IDX ; break ;                         /* ILE amino acid! */
00497                         
00498                 case 'L' : /* Either ALA, ASP, ASN or ARG */
00499                         if(l2 == 'Y') aa_idx = M_LYS_IDX ;                              /* LYS amino acid! */
00500                         else aa_idx = M_LEU_IDX ; break ;                               /* LEU amino acid! */
00501                         
00502                 case 'M' : aa_idx = M_MET_IDX ; break ;                         /* MET amino acid! */
00503                 case 'P' : /* Either ALA, ASP, ASN or ARG */
00504                         if(l2 == 'H') aa_idx = M_PHE_IDX ;                              /* PHE amino acid! */
00505                         else aa_idx = M_PRO_IDX ; break ;                               /* PRO amino acid! */
00506 
00507                 case 'S' : aa_idx = M_SER_IDX ; break ;                         /* SER amino acid! */
00508 
00509                 case 'T' : /* Either ALA, ASP, ASN or ARG */
00510                         if(l2 == 'H') aa_idx = M_THR_IDX ;                              /* THR amino acid! */
00511                         else if(l2 == 'R') aa_idx = M_TRP_IDX ;                 /* TRP amino acid! */
00512                         else aa_idx = M_TYR_IDX ; break ;                               /* TYR amino acid! */
00513 
00514                 case 'V' : aa_idx = M_VAL_IDX ; break ;                         /* VAL amino acid! */
00515 
00516                 default: /*fprintf(stderr, "! Amno acid %s does not exists!\n", aa_name) ;*/
00517                         break ;
00518         }
00519 
00520         /* Ok now we have our amino acid, lets update statistics! */
00521 
00522         if(aa_idx != -1) {
00523                 desc->aa_compo[aa_idx] ++ ;
00524                 desc->hydrophobicity_score += get_hydrophobicity_score_from_idx(aa_idx) ;
00525                 desc->polarity_score += get_polarity_from_idx(aa_idx) ;
00526                 desc->volume_score += get_volume_score_from_idx(aa_idx) ;
00527                 desc->charge_score += get_charge_from_idx(aa_idx) ;
00528         }
00529 }

void set_atom_based_descriptors ( s_atm **  atoms,
int  natoms,
s_desc desc,
s_atm all_atoms,
int  all_natoms 
)

## FUNCTION: set_atom_based_descriptors

## SPECIFICATION: Update atomic descriptors of the pocket for the given atom. Here, we just update mean bfactor, electronegativity, amino-acids scores...

## PARAMETRES: @ s_atom *atoms : The atoms @ int natoms : Number of atoms @ s_desc *desc : OUTPUT : The descriptor structure to fill

## RETURN: void

Definition at line 373 of file descriptors.c.

References s_atm::bfactor, s_atm::chain, s_desc::characterChain1, s_desc::characterChain2, countResidues(), s_atm::electroneg, element_in_kept_res(), element_in_nucl_acid(), element_in_std_res(), s_desc::flex, s_desc::hydrophobicity_score, in_tab(), s_desc::interChain, s_desc::nameChain1, s_desc::nameChain2, s_desc::numResChain1, s_desc::numResChain2, s_desc::prop_polar_atm, s_atm::res_id, s_atm::res_name, set_aa_desc(), and s_desc::volume_score.

Referenced by set_descriptors().

00374 {
00375         s_atm *curatom = NULL ;
00376         s_atm *firstatom = NULL;
00377         int i,
00378                 curChar = 0, 
00379                 res_ids[natoms],        /* Maximum natoms residues contacting the pocket */
00380                 nb_res_ids = 0 ;        /* Current number of residus */
00381 
00382         int nb_polar_atm = 0 ;
00383         char curChainName[2];
00384         if(atoms){
00385             firstatom=atoms[0];
00386             desc->interChain=0;
00387 
00388             if(element_in_std_res(firstatom->res_name))             desc->characterChain1=0;
00389             else if(element_in_nucl_acid(firstatom->res_name))      desc->characterChain1=1;
00390             else if(element_in_kept_res(firstatom->res_name))       desc->characterChain1=2;
00391             strcpy(desc->nameChain1,firstatom->chain);
00392             strcpy(curChainName,firstatom->chain);
00393             desc->numResChain1 = countResidues(all_atoms,all_natoms,firstatom->chain);
00394 
00395             for(i = 0 ; i < natoms ; i++) {
00396                     curatom = atoms[i] ;
00397                     if(curatom!=firstatom){
00398                         if(strcmp(curatom->chain,firstatom->chain)!=0 && desc->interChain < 1) {
00399                             desc->interChain = 1;
00400                             if(!desc->numResChain2){
00401                                 desc->numResChain2 = countResidues(all_atoms,all_natoms,curatom->chain);
00402                                 strncpy(curChainName,curatom->chain,1);
00403                             }
00404                         }
00405 
00406                         if(element_in_std_res(curatom->res_name)){
00407                             curChar=0;
00408                             //strcpy(curChainName,curatom->chain);
00409                         }
00410                         else if(element_in_nucl_acid(curatom->res_name)){
00411                             curChar=1;
00412                             //strcpy(curChainName,curatom->chain);
00413                         }
00414                         else if(element_in_kept_res(curatom->res_name)){
00415                             curChar=2;
00416                             //strcpy(curChainName,curatom->chain);
00417                         }
00418                         if(curChar!=desc->characterChain1){
00419                             desc->characterChain2=curChar;
00420                             //strcpy(curChainName,curatom->chain);
00421                         }
00422                     }
00423             /* Setting amino acid descriptor of the current atom */
00424                     if(in_tab(res_ids,  nb_res_ids, curatom->res_id) == 0) {
00425                             set_aa_desc(desc, atoms[i]->res_name) ;
00426                             res_ids[nb_res_ids] = curatom->res_id ;
00427                             nb_res_ids ++ ;
00428                     }
00429 
00430             /* Setting atom descriptor */
00431                     desc->flex += curatom->bfactor ;
00432                     if(curatom->electroneg > 2.7)  nb_polar_atm += 1 ;
00433             }
00434 
00435             if(!desc->numResChain2) desc->numResChain2 = countResidues(all_atoms,all_natoms,curatom->chain);
00436             strcpy(desc->nameChain2,curChainName);
00437 
00438             /*fprintf(stdout,":%s:",desc->ligTag);*/
00439             desc->hydrophobicity_score = desc->hydrophobicity_score/ (float) nb_res_ids ;
00440             desc->volume_score = desc->volume_score / (float) nb_res_ids ;
00441 
00442             desc->flex /= natoms ;
00443             desc->prop_polar_atm = ((float) nb_polar_atm) / ((float) natoms) * 100.0 ;
00444         }
00445         else {
00446             desc->hydrophobicity_score=0.0;
00447             desc->volume_score=0.0;
00448             desc->flex=0.0;
00449             desc->prop_polar_atm=0.0;
00450         }
00451 
00452 }

void set_descriptors ( s_atm **  atoms,
int  natoms,
s_vvertice **  tvert,
int  nvert,
s_desc desc,
int  niter,
s_pdb pdb,
int  flag_do_expensive_calculations 
)

## FUNCTION: set_descriptors

## SPECIFICATION: Set descriptors using a set of atoms with corresponding voronoi vertices. Current descriptors (need to be improved...) includes atom/AA based descriptors and voronoi vertice based descriptors. A word on several descriptors:

  • The "solvent accessibility" of a sphere (which is rather the buriedness degree...) is defined as the distance of the barycenter of the sphere (defined using the 4 contacted atoms) from the center of the sphere.
  • The mean_loc_hyd_dens is the mean value of apolar density calculated for each vertice and defined in the next function (see comments or doc)

## PARAMETRES: @ s_atm **atoms : The list of atoms @ int natoms : The number of atoms @ s_vvertice **tvert : The list of vertices @ int nvert : The number of vertices @ s_desc *desc : OUTPUT: The descriptor structure to fill

## RETURN: void: s_desc is filled

Definition at line 182 of file descriptors.c.

References s_desc::apolar_asphere_prop, s_desc::as_density, s_desc::as_max_dst, s_desc::as_max_r, s_vvertice::bary, dist(), get_verts_volume_ptr(), s_pdb::latoms, M_APOLAR_AS, s_desc::masph_sacc, s_desc::mean_asph_ray, s_desc::mean_loc_hyd_dens, s_pdb::natoms, s_desc::nb_asph, s_vvertice::ray, set_ASA(), set_atom_based_descriptors(), s_vvertice::type, s_desc::volume, s_vvertice::x, s_vvertice::y, and s_vvertice::z.

Referenced by get_explicit_desc(), mdpocket_characterize(), and set_pockets_descriptors().

00184 {
00185         /* Setting atom-based descriptors */
00186         set_atom_based_descriptors(atoms, natoms, desc, pdb->latoms, pdb->natoms) ;
00187             
00188         /* Setting vertice-based descriptors */
00189         if(! tvert) return ;
00190 
00191         float d = 0.0, vx, vy, vz, vrad,
00192                   masph_sacc = 0.0, /* Mean alpha sphere solvent accessibility */
00193                   mean_ashape_radius = 0.0,
00194                   as_density = 0.0, as_max_dst = -1.0,
00195                   dtmp = 0.0 ;
00196 
00197         int i, j,
00198                 napol_neigh = 0,
00199                 nAlphaApol = 0 ;
00200         
00201         float as_max_r = -1.0 ;
00202 
00203         s_vvertice *vcur = NULL,
00204                            *vc = NULL ;
00205 
00206         desc->mean_loc_hyd_dens = 0.0 ;
00207 /*
00208                 fprintf(stdout, "\nIn set descripotirs\n") ;
00209 */
00210         for(i = 0 ; i < nvert ; i++) {
00211                 vcur = tvert[i] ;
00212 /*
00213                 fprintf(stdout, "Vertice %d: %d %f\n", i, vcur->id, vcur->ray) ;
00214 */
00215                 if(vcur->ray > as_max_r) as_max_r = vcur->ray ;
00216 
00217                 vx = vcur->x ; vy = vcur->y ; vz = vcur->z ; vrad = vcur->ray ;
00218 
00219                 /* Calculate apolar density if necessary, and pocket density */
00220                 j = 0 ;
00221                 if(vcur->type == M_APOLAR_AS) {
00222                         napol_neigh = 0 ;
00223                         for(j = 0 ; j < nvert ; j++) {
00224                                 vc = tvert[j] ;
00225 
00226                                 /* Increment the number of apolar neighbor */
00227                                 if(vc != vcur && vc->type == M_APOLAR_AS &&
00228                                    dist(vx, vy, vz, vc->x, vc->y, vc->z)-(vc->ray + vrad) <= 0.) {
00229                                         napol_neigh += 1 ;
00230                                 }
00231 
00232                                 /* Update density by the way... */
00233                                 if(j > i) {
00234                                         dtmp = dist(vcur->x, vcur->y, vcur->z,
00235                                                                 vc->x, vc->y, vc->z);
00236                                         
00237                                         if(dtmp > as_max_dst) as_max_dst = dtmp ;
00238                                         as_density += dtmp ;
00239                                 }
00240                         }
00241                         desc->mean_loc_hyd_dens += (float) napol_neigh ;
00242                         nAlphaApol += 1 ;
00243                 }
00244                 else {
00245                         /* Update density */
00246                         for(j = i+1 ; j < nvert ; j++) {
00247                                 dtmp = dist(vcur->x, vcur->y, vcur->z,
00248                                                         tvert[j]->x, tvert[j]->y, tvert[j]->z) ;
00249                                 
00250                                 if(dtmp > as_max_dst) as_max_dst = dtmp ;
00251                                 as_density += dtmp ;
00252                         }
00253                 }
00254 
00255                 mean_ashape_radius += vcur->ray ;
00256                 /* Estimating solvent accessibility of the sphere */
00257                 d = dist(vcur->x, vcur->y, vcur->z,
00258                                  vcur->bary[0], vcur->bary[1], vcur->bary[2]) ;
00259                 masph_sacc += d/vcur->ray ;
00260         }
00261 
00262         if(nAlphaApol>0) desc->mean_loc_hyd_dens /= (float)nAlphaApol ;
00263         else desc->mean_loc_hyd_dens= 0.0;
00264 
00265         if(flag_do_expensive_calculations) {
00266             set_ASA(desc, pdb, tvert, nvert);
00267             desc->volume = get_verts_volume_ptr(tvert, nvert, niter,-1.6) ;
00268         }
00269         /*set_ASA(desc,pdb, atoms, natoms, tvert, nvert);*/
00270 
00271         desc->as_max_dst = as_max_dst ;
00272         desc->apolar_asphere_prop = (float)nAlphaApol / (float)nvert ;
00273         desc->masph_sacc =  masph_sacc / nvert ;
00274         desc->mean_asph_ray = mean_ashape_radius / (float)nvert ;
00275         desc->nb_asph = nvert ;
00276         desc->as_density = as_density / ((nvert*nvert - nvert) * 0.5) ;
00277 
00278         desc->as_max_r = as_max_r ;
00279         if (nvert==0){
00280             desc->apolar_asphere_prop=0.0;
00281             desc->masph_sacc=0.0;
00282             desc->mean_asph_ray=0.0;
00283             desc->as_density=0.0;
00284         }
00285 }


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