pertable.h File Reference

#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include "utils.h"

Go to the source code of this file.

Functions

float pte_get_vdw_ray (const char *symbol)
float pte_get_mass (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)


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 }


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