pertable.c File Reference

#include "../headers/pertable.h"

Go to the source code of this file.

Functions

float pte_get_mass (const char *symbol)
float pte_get_vdw_ray (const char *symbol)
float pte_get_enegativity (const char *symbol)
int is_valid_element (const char *str, int ignore_case)
int element_in_std_res (char *res_name)
int element_in_nucl_acid (char *res_name)
int is_water (char *res_name)
int is_valid_prot_element (const char *str, int ignore_case)
int is_valid_nucl_acid_element (const char *str, int ignore_case)

Variables

static const int ST_nelem = 112
static const char * ST_pte_symbol []
static const int ST_prot_nelem = 5
static const char * ST_pte_prot_symbol []
static const int ST_nucl_acid_nelem = 5
static const char * ST_pte_nucl_acid_symbol []
static const int ST_n_standard_res_names = 23
static const char * ST_standard_res_names []
static const int ST_n_standard_nucl_acid_names = 9
static const char * ST_standard_nucl_acid_names []
static const float ST_pte_electronegativity []
static const float ST_pte_mass []
static const float ST_pte_rvdw []


Function Documentation

int element_in_nucl_acid ( char *  res_name  ) 

----------------------------------------------------------------------------- ## FUNCTION: int element_in_nucl_acid(char *res_name) ----------------------------------------------------------------------------- ## SPECIFICATION: Compare resname to the list of standard nucleic acid residues. Return 1 if resname is in this list, 0 else. ----------------------------------------------------------------------------- ## PARAMETRES: @ char *res_name : The current residue name ----------------------------------------------------------------------------- ## RETURN: int -----------------------------------------------------------------------------

Definition at line 355 of file pertable.c.

References ST_n_standard_nucl_acid_names, and ST_standard_nucl_acid_names.

Referenced by guess_element(), and set_atom_based_descriptors().

00355                                         {
00356     int i;
00357     for(i=0;i<ST_n_standard_nucl_acid_names;i++){
00358         if(!strncmp(res_name, ST_standard_nucl_acid_names[i],3)) return 1;
00359     }
00360     return 0;
00361 }

int element_in_std_res ( char *  res_name  ) 

----------------------------------------------------------------------------- ## FUNCTION: int element_in_std_res(char *res_name) ----------------------------------------------------------------------------- ## SPECIFICATION: Compare resname to the list of standard protein resnames. Return 1 if resname is in this list, 0 else. ----------------------------------------------------------------------------- ## PARAMETRES: @ char *res_name : The current residue name ----------------------------------------------------------------------------- ## RETURN: int -----------------------------------------------------------------------------

Definition at line 333 of file pertable.c.

References ST_n_standard_res_names, and ST_standard_res_names.

Referenced by guess_element(), and set_atom_based_descriptors().

00333                                       {
00334     int i;
00335     for(i=0;i<ST_n_standard_res_names;i++){
00336         if(!strncmp(res_name, ST_standard_res_names[i],3)) return 1;
00337     }
00338     return 0;
00339 }

int is_valid_element ( const char *  str,
int  ignore_case 
)

## FUNCTION: is_valid_element

## SPECIFICATION: Check if a given string corresponds to an atom element.

## PARAMETERS: @ const char *str : The string to test @ int tcase : If = 1, dont take into account the case.

## RETURN: int: -1 if the strig is not an atom element, the index in the periodic table if so.

Definition at line 282 of file pertable.c.

References ST_nelem, ST_pte_symbol, and str_trim().

Referenced by check_is_valid_element(), and guess_element().

00283 {
00284         if(str == NULL) return -1 ;
00285         if(strlen(str) <= 0) return -1 ;
00286 
00287         /* Use temporary variable to work on the string */
00288         int i ;
00289         char str_tmp[strlen(str)+1] ;
00290         strcpy(str_tmp, str) ;
00291 
00292         /* Remove spaces and case if asked*/
00293         str_trim(str_tmp) ;
00294         if(ignore_case == 1) {
00295                 str_tmp[0] = tolower(str_tmp[0]) ;
00296                 str_tmp[1] = tolower(str_tmp[1]) ;
00297         }
00298 
00299         /* Loop over */
00300         for (i = 0; i < ST_nelem ; i++) {
00301                 char tmp[3] ;
00302                 tmp[0] = ST_pte_symbol[i][0] ;
00303                 tmp[1] = ST_pte_symbol[i][1] ;
00304 
00305                 /* Remove case if asked */
00306                 if(ignore_case == 1) {
00307                         tmp[0] = tolower(tmp[0]) ;
00308                         tmp[1] = tolower(tmp[1]) ;
00309                 }
00310                 tmp[2] = '\0' ;
00311 
00312                 /* Do the comparison*/
00313                 if(strcmp(str_tmp, tmp) == 0) return i ;
00314         }
00315         
00316         return -1 ;
00317 }

int is_valid_nucl_acid_element ( const char *  str,
int  ignore_case 
)

----------------------------------------------------------------------------- ## FUNCTION: is_valid_nucl_acid_element ----------------------------------------------------------------------------- ## SPECIFICATION: Check if a given string corresponds to an atom element. ----------------------------------------------------------------------------- ## PARAMETERS: @ const char *str : The string to test @ int tcase : If = 1, dont take into account the case. ----------------------------------------------------------------------------- ## RETURN: int: -1 if the strig is not an atom element, the index in the periodic table if so. -----------------------------------------------------------------------------

Definition at line 437 of file pertable.c.

References ST_nucl_acid_nelem, ST_pte_nucl_acid_symbol, and str_trim().

Referenced by guess_element().

00438 {
00439         if(str == NULL) return -1 ;
00440         if(strlen(str) <= 0) return -1 ;
00441         /* Use temporary variable to work on the string */
00442         int i ;
00443         char str_tmp[strlen(str)+1] ;
00444         strcpy(str_tmp, str) ;
00445 
00446 
00447         /* Remove spaces and case if asked*/
00448         str_trim(str_tmp) ;
00449         if(ignore_case == 1) {
00450                 str_tmp[0] = tolower(str_tmp[0]) ;
00451                 str_tmp[1] = tolower(str_tmp[1]) ;
00452         }
00453 
00454         /* Loop over standard protein element table*/
00455         for (i = 0; i < ST_nucl_acid_nelem ; i++) {
00456                 char tmp[3] ;
00457                 tmp[0] = ST_pte_nucl_acid_symbol[i][0] ;
00458                 tmp[1] = ST_pte_nucl_acid_symbol[i][1] ;
00459 
00460                 /* Remove case if asked */
00461                 if(ignore_case == 1) {
00462                         tmp[0] = tolower(tmp[0]) ;
00463                         tmp[1] = tolower(tmp[1]) ;
00464                 }
00465                 tmp[2] = '\0' ;
00466 
00467                 /* Do the comparison*/
00468                 if(strncmp(str_tmp, tmp,1) == 0) return i ;
00469         }
00470 
00471         return -1 ;
00472 }

int is_valid_prot_element ( const char *  str,
int  ignore_case 
)

----------------------------------------------------------------------------- ## FUNCTION: is_valid_prot_element ----------------------------------------------------------------------------- ## SPECIFICATION: Check if a given string corresponds to an atom element. ----------------------------------------------------------------------------- ## PARAMETERS: @ const char *str : The string to test @ int tcase : If = 1, dont take into account the case. ----------------------------------------------------------------------------- ## RETURN: int: -1 if the strig is not an atom element, the index in the periodic table if so. -----------------------------------------------------------------------------

Definition at line 384 of file pertable.c.

References ST_prot_nelem, ST_pte_prot_symbol, and str_trim().

Referenced by guess_element().

00385 {
00386         if(str == NULL) return -1 ;
00387         if(strlen(str) <= 0) return -1 ;
00388         /* Use temporary variable to work on the string */
00389         int i ;
00390         char str_tmp[strlen(str)+1] ;
00391         strcpy(str_tmp, str) ;
00392 
00393 
00394         /* Remove spaces and case if asked*/
00395         str_trim(str_tmp) ;
00396         if(ignore_case == 1) {
00397                 str_tmp[0] = tolower(str_tmp[0]) ;
00398                 str_tmp[1] = tolower(str_tmp[1]) ;
00399         }
00400 
00401         /* Loop over standard protein element table*/
00402         for (i = 0; i < ST_prot_nelem ; i++) {
00403                 char tmp[3] ;
00404                 tmp[0] = ST_pte_prot_symbol[i][0] ;
00405                 tmp[1] = ST_pte_prot_symbol[i][1] ;
00406 
00407                 /* Remove case if asked */
00408                 if(ignore_case == 1) {
00409                         tmp[0] = tolower(tmp[0]) ;
00410                         tmp[1] = tolower(tmp[1]) ;
00411                 }
00412                 tmp[2] = '\0' ;
00413 
00414                 /* Do the comparison*/
00415                 if(strncmp(str_tmp, tmp,1) == 0) return i ;
00416         }
00417 
00418         return -1 ;
00419 }

int is_water ( char *  res_name  ) 

Definition at line 363 of file pertable.c.

00363                             {
00364     if(!strncmp(res_name, "HOH",3)||!strncmp(res_name, "WAT",3)) return 1;
00365     return 0;
00366 }

float pte_get_enegativity ( const char *  symbol  ) 

## FUNCTION: pte_get_enegativity

## SPECIFICATION: Returns the electronegativity (Pauling) value for a given element

## PARAMETERS: @ const char *symbol: The symbol of the element in the periodic table

## RETURN: float: electrobegativity of Pauling corresponding to symbol

Definition at line 247 of file pertable.c.

References ST_nelem, ST_pte_electronegativity, and ST_pte_symbol.

Referenced by rpdb_read().

00248 {
00249         char atom[3] = "" ;
00250 
00251         if (symbol != NULL) {
00252                 atom[0] = (char) toupper((int) symbol[0]);
00253                 atom[1] = (char) tolower((int) symbol[1]);
00254                 atom[2] = '\0' ;
00255         
00256                 int i ;
00257                 for (i = 0; i < ST_nelem ; i++) {
00258                         if ( (ST_pte_symbol[i][0] == atom[0]) && (ST_pte_symbol[i][1] == atom[1]) ) {
00259                                 return ST_pte_electronegativity[i] ;
00260                         }
00261                 }
00262         }
00263 
00264         return -1 ;
00265 }

float pte_get_mass ( const char *  symbol  ) 

## FUNCTION: pte_get_mass

## SPECIFICATION: Returns the mass for a given element

## PARAMETERS: @ const char *symbol: The symbol of the element in the periodic table

## RETURN: float: mass corresponding to symbol

Definition at line 178 of file pertable.c.

References ST_nelem, ST_pte_mass, and ST_pte_symbol.

Referenced by rpdb_read().

00179 {       
00180         char atom[3] ;
00181         if (symbol != NULL) {
00182                 atom[0] = (char) toupper((int) symbol[0]);
00183                 atom[1] = (char) tolower((int) symbol[1]);      
00184                 atom[2] = '\0' ;
00185         
00186                 int i ;
00187                 for (i = 0; i < ST_nelem ; i++) {
00188                         if ( (ST_pte_symbol[i][0] == atom[0]) && (ST_pte_symbol[i][1] == atom[1]) ) {
00189                                 
00190                                 return ST_pte_mass[i] ;
00191                         }
00192                 }
00193         }
00194 
00195 
00196         return -1 ;
00197 }

float pte_get_vdw_ray ( const char *  symbol  ) 

## FUNCTION: pte_get_vdw_ray

## SPECIFICATION: Returns the van der walls radius for a given element

## PARAMETERS: @ const char *symbol: The symbol of the element in the periodic table

## RETURN: float: vdw radius corresponding to symbol

Definition at line 213 of file pertable.c.

References ST_nelem, ST_pte_rvdw, and ST_pte_symbol.

Referenced by rpdb_read().

00214 {
00215         char atom[3] ;
00216 
00217         if (symbol != NULL) {
00218                 atom[0] = (char) toupper((int) symbol[0]);
00219                 atom[1] = (char) tolower((int) symbol[1]);
00220                 atom[2] = '\0' ;
00221         
00222                 int i ;
00223                 for (i = 0; i < ST_nelem ; i++) {
00224                         if ( (ST_pte_symbol[i][0] == atom[0]) && (ST_pte_symbol[i][1] == atom[1]) ) {
00225                                 return ST_pte_rvdw[i] ;
00226                         }
00227                 }
00228         }
00229 
00230         return -1 ;
00231 }


Variable Documentation

const int ST_n_standard_nucl_acid_names = 9 [static]

Definition at line 96 of file pertable.c.

Referenced by element_in_nucl_acid().

const int ST_n_standard_res_names = 23 [static]

Definition at line 89 of file pertable.c.

Referenced by element_in_std_res().

const int ST_nelem = 112 [static]

number of elements in the const char *ST_pte_symbol list

Definition at line 62 of file pertable.c.

Referenced by is_valid_element(), pte_get_enegativity(), pte_get_mass(), and pte_get_vdw_ray().

const int ST_nucl_acid_nelem = 5 [static]

Definition at line 84 of file pertable.c.

Referenced by is_valid_nucl_acid_element().

const int ST_prot_nelem = 5 [static]

Definition at line 79 of file pertable.c.

Referenced by is_valid_prot_element().

const float ST_pte_electronegativity[] [static]

Initial value:

 {
         0.0,  2.1, 0.98,  1.0,  1.5,  2.0,  2.5,  3.0,  3.5,  4.0, -1.0,
         0.9,  1.2,  1.5,  1.8,  2.1,  2.5,  3.0, -1.0,  0.8,  1.0,  1.3,
         1.5,  1.6,  1.6,  1.5,  1.8,  1.8,  1.9,  1.9,  1.6,  1.8,  2.0,
         2.2,  2.4,  2.9, -1.0,  0.8,  1.0,  1.2,  1.3,  1.6,  2.0,  1.9,
         2.2,  2.2,  2.3,  1.9,  1.7,  1.7,  1.8,  2.0,  2.1,  2.6,  2.6,
         0.8,  0.9, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
        -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,  1.3,  1.5,  1.7,  1.9,  2.2,
         2.2,  2.2,  2.4,  1.9,  1.8,  1.8,  1.9,  2.0,  2.2, -1.0,  0.7,
         0.9,  1.1,  1.3,  1.5,  1.7,  1.3,  1.3,  1.3,  1.3,  1.3,  1.3,
         1.3,  1.3,  1.3,  1.3, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
        -1.0, -1.0
}
electronegativity list

Definition at line 102 of file pertable.c.

Referenced by pte_get_enegativity().

const float ST_pte_mass[] [static]

Initial value:

 { 
         0.00000, 1.00794, 4.00260, 6.941, 9.012182, 10.811,  
         12.0107, 14.0067, 15.9994, 18.9984032, 20.1797, 
         22.989770, 24.3050, 26.981538, 28.0855, 30.973761,
         32.065, 35.453, 39.948, 39.0983, 40.078, 44.955910,
         47.867, 50.9415, 51.9961, 54.938049, 55.845, 58.9332,
         58.6934, 63.546, 65.409, 69.723, 72.64, 74.92160, 
         78.96, 79.904, 83.798, 85.4678, 87.62, 88.90585, 
         91.224, 92.90638, 95.94, 98.0, 101.07, 102.90550,
         106.42, 107.8682, 112.411, 114.818, 118.710, 121.760, 
         127.60, 126.90447, 131.293, 132.90545, 137.327, 
         138.9055, 140.116, 140.90765, 144.24, 145.0, 150.36,
         151.964, 157.25, 158.92534, 162.500, 164.93032, 
         167.259, 168.93421, 173.04, 174.967, 178.49, 180.9479,
         183.84, 186.207, 190.23, 192.217, 195.078, 196.96655, 
         200.59, 204.3833, 207.2, 208.98038, 209.0, 210.0, 222.0, 
         223.0, 226.0, 227.0, 232.0381, 231.03588, 238.02891,
         237.0, 244.0, 243.0, 247.0, 247.0, 251.0, 252.0, 257.0,
         258.0, 259.0, 262.0, 261.0, 262.0, 266.0, 264.0, 269.0,
         268.0, 271.0, 272.0
}
atomic masses

Definition at line 116 of file pertable.c.

Referenced by pte_get_mass().

const char* ST_pte_nucl_acid_symbol[] [static]

Initial value:

 {
        "H",  "C",  "N",  "O", "P"
}

Definition at line 85 of file pertable.c.

Referenced by is_valid_nucl_acid_element().

const char* ST_pte_prot_symbol[] [static]

Initial value:

 {
        "H",  "C",  "N",  "O", "S"
}

Definition at line 80 of file pertable.c.

Referenced by is_valid_prot_element().

const float ST_pte_rvdw[] [static]

Initial value:

 {
         1.5, 1.2, 1.4, 1.82, 2.0, 2.0,  
         1.7, 1.55, 1.52, 1.47, 1.54, 
         2.27, 1.73, 2.0, 2.1, 1.8,
         1.8, 1.75, 1.88, 2.75, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         1.63, 1.4, 1.39, 1.07, 2.0, 1.85,
         1.9, 1.85, 2.02, 2.0, 2.0, 2.0, 
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         1.63, 1.72, 1.58, 1.93, 2.17, 2.0, 
         2.06, 1.98, 2.16, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 1.72, 1.66,
         1.55, 1.96, 2.02, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0, 1.86,
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
         2.0, 2.0, 2.0
}
VDW radii for different elements

Definition at line 142 of file pertable.c.

Referenced by pte_get_vdw_ray().

const char* ST_pte_symbol[] [static]

Initial value:

 { 
        "X",  "H",  "He", "Li", "Be", "B",  "C",  "N",  "O",  "F",  "Ne",
        "Na", "Mg", "Al", "Si", "P" , "S",  "Cl", "Ar", "K",  "Ca", "Sc",
        "Ti", "V",  "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", 
        "As", "Se", "Br", "Kr", "Rb", "Sr", "Y",  "Zr", "Nb", "Mo", "Tc",
        "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I",  "Xe",
        "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb",
        "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W",  "Re", "Os",
        "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr",
        "Ra", "Ac", "Th", "Pa", "U",  "Np", "Pu", "Am", "Cm", "Bk", "Cf",
        "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt",
        "Ds", "Rg"
}
element list

Definition at line 64 of file pertable.c.

Referenced by is_valid_element(), pte_get_enegativity(), pte_get_mass(), and pte_get_vdw_ray().

const char* ST_standard_nucl_acid_names[] [static]

Initial value:

 {
    "dG","dC", "dT","dA","A","C","T","G","U"
}

Definition at line 97 of file pertable.c.

Referenced by element_in_nucl_acid().

const char* ST_standard_res_names[] [static]

Initial value:

 {
    "GLY", "LEU", "ILE", "TRP", "MET", "SER", "THR", "LYS", "ARG", "ASN",
    "GLN", "GLU", "ASP", "CYS", "PRO", "HIS", "TYR", "PHE", "VAL", "ALA",
    "HIE", "HID", "HIP", "HSD", "HSE", "HSP"
}

Definition at line 90 of file pertable.c.

Referenced by element_in_std_res().


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