00001 #include "../headers/aa.h" 00002 00003 /* 00004 00005 ## GENERAL INFORMATION 00006 ## 00007 ## FILE aa.c 00008 ## AUTHORS P. Schmidtke and V. Le Guilloux 00009 ## LAST MODIFIED 28-11-08 (v) 00010 ## 00011 ## SPECIFICATIONS 00012 ## 00013 ## This file contains severals functions that allow one to 00014 ## deal with amino-acids and their properties. Properties 00015 ## should be stored in the static variable ST_aa, that 00016 ## contains for each amino-acids, several properties 00017 ## stored in a specific structure. 00018 ## 00019 ## MODIFICATIONS HISTORY 00020 ## 00021 ## 28-11-08 (v) Comments UTD 00022 ## 20-11-08 (v) Added molecular weight 00023 ## 01-04-08 (v) Added comments and creation of history 00024 ## 01-01-08 (vp) Created (random date...) 00025 ## 00026 ## TODO or SUGGESTIONS 00027 ## 00028 ## (v) Get more accurate descriptors, namely for the volume and charge *score* 00029 ## (v) Check and update if necessary comments of each function!! 00030 00031 */ 00032 00033 00034 /* 00035 COPYRIGHT DISCLAIMER 00036 00037 Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby 00038 disclaim all copyright interest in the program “fpocket” (which 00039 performs protein cavity detection) written by Vincent Le Guilloux and Peter 00040 Schmidtke. 00041 00042 Vincent Le Guilloux 28 November 2008 00043 Peter Schmidtke 28 November 2008 00044 Pierre Tuffery 28 November 2008 00045 00046 GNU GPL 00047 00048 This file is part of the fpocket package. 00049 00050 fpocket is free software: you can redistribute it and/or modify 00051 it under the terms of the GNU General Public License as published by 00052 the Free Software Foundation, either version 3 of the License, or 00053 (at your option) any later version. 00054 00055 fpocket is distributed in the hope that it will be useful, 00056 but WITHOUT ANY WARRANTY; without even the implied warranty of 00057 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00058 GNU General Public License for more details. 00059 00060 You should have received a copy of the GNU General Public License 00061 along with fpocket. If not, see <http://www.gnu.org/licenses/>. 00062 00063 **/ 00064 00065 /** 00066 Several amino-acid properties, taken from: 00067 http://www.info.univ-angers.fr/~gh/Idas/proprietes.htm 00068 00069 Hydrophobicity taken from : 00070 http://www.sigmaaldrich.com/Area_of_Interest/Biochemicals/PolyAmino_Acids/Reference_Chart.html 00071 00072 Monera & al. Journal of Protein Science 1, 319-329 (1995) 00073 00074 Molecular weight taken from: 00075 http://www.expasy.ch/tools/pscale/Molecularweight.html 00076 00077 */ 00078 static const s_amino_a ST_aa[20] = 00079 { 00080 // Name Code Molecular weight VolumeScore Hydrophobicity Charge Polatity func_grp 00081 { "ALA", 'A', 89.0, 2.0, 41.0, 0, 0, 2 }, 00082 { "ARG", 'R', 174.0, 7.0, -14.0, 1, 1, 5 }, 00083 { "ASN", 'N', 132.0, 3.0, -28.0, 0, 1, 3 }, 00084 { "ASP", 'D', 133.0, 3.0, -55.0, -1, 1, 3 }, 00085 { "CYS", 'C', 121.0, 3.0, 49.0, 0, 0, 6 }, 00086 { "GLN", 'Q', 146.0, 4.0, -10.0, 0, 1, 3 }, 00087 { "GLU", 'E', 147.0, 4.0, -31.0, -1, 1, 3 }, 00088 { "GLY", 'G', 75.0, 1.0, 0.0, 0, 0, 2 }, 00089 { "HIS", 'H', 155.0, 4.0, 8.0, 1, 1, 1 }, 00090 { "ILE", 'I', 131.0, 5.0, 99.0, 0, 0, 2 }, 00091 { "LEU", 'L', 131.0, 5.0, 97.0, 0, 0, 2 }, 00092 { "LYS", 'K', 146.0, 6.0, -23.0, 1, 1, 5 }, 00093 { "MET", 'M', 149.0, 5.0, 74.0, 0, 0, 5 }, 00094 { "PHE", 'F', 165.0, 6.0, 100.0, 0, 0, 1 }, 00095 { "PRO", 'P', 115.0, 3.0, -46.0, 0, 0, 2 }, 00096 { "SER", 'S', 105.0, 2.0, -5.0, 0, 1, 4 }, 00097 { "THR", 'T', 119.0, 3.0, 13.0, 0, 1, 4 }, 00098 { "TRP", 'W', 204.0, 8.0, 97.0, 0, 1, 1 }, 00099 { "TYR", 'Y', 181.0, 7.0, 63.0, 0, 1, 1 }, 00100 { "VAL", 'V', 117.0, 4.0, 76.0, 0, 0, 2 } 00101 } ; 00102 00103 /** 00104 ## FUNCTION: 00105 get_aa_name3 00106 00107 ## SPECIFICATION: 00108 Return the name of AA given in argument (index in the static table) 00109 00110 ## PARAMETRES: 00111 @ const int index: Index of the AA in the tab 00112 00113 ## RETURN: 00114 char *: Name if index is valid, NULL if not. 00115 00116 */ 00117 char* get_aa_name3(const int index) 00118 { 00119 if(index < M_NB_AA && index >= 0) { 00120 return (char*)ST_aa[index].name3 ; 00121 } 00122 return NULL ; 00123 } 00124 00125 /** 00126 ## FUNCTION: 00127 get_aa_index 00128 00129 ## SPECIFICATION: 00130 Return the index of AA given in argument (3letter code representation) in the 00131 static AA tab. 00132 00133 ## PARAMETRES: 00134 @ const char *name: Amno acid name (3 letter code representation) 00135 00136 ## RETURN: 00137 int: index of the given amino acid, -1 if not found in the tab 00138 00139 */ 00140 int get_aa_index(const char *name) 00141 { 00142 int i, 00143 aa_index = -1 ; 00144 00145 for(i = 0 ; i < M_NB_AA ; i++) { 00146 if(toupper(name[0]) == ST_aa[i].name3[0] && toupper(name[1]) == ST_aa[i].name3[1] 00147 && toupper(name[2]) == ST_aa[i].name3[2] ) { 00148 aa_index = i ; 00149 break ; 00150 } 00151 } 00152 00153 return aa_index ; 00154 } 00155 00156 /*********** Getting information from an AA name in the static tab ***********/ 00157 00158 00159 /** 00160 ## FUNCTION: 00161 get_aa_mw 00162 00163 ## SPECIFICATION: 00164 Return the molecular weight of AA given in argument 00165 00166 ## PARAMETRES: 00167 @ const int index: Index of the AA in the tab 00168 00169 ## RETURN: 00170 float: Molecular weight if the index is valid, NULL if not. 00171 00172 */ 00173 float get_aa_mw(const char *name) 00174 { 00175 int aa_index = get_aa_index(name) ; 00176 00177 if(aa_index != -1) { 00178 return ST_aa[aa_index].mw ; 00179 }/* 00180 else { 00181 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00182 }*/ 00183 00184 return -1.0 ; 00185 } 00186 00187 /** 00188 ## FUNCTION: 00189 get_aa_volume_score 00190 00191 ## SPECIFICATION: 00192 Return the volume score of given amino acid (very approximative...) 00193 00194 ## PARAMETRES: 00195 @ const char *name: Amno acid name (3 letter code representation) 00196 00197 ## RETURN: 00198 float: volume score, -1 if aa not found in the tab 00199 00200 */ 00201 float get_aa_volume_score(const char *name) 00202 { 00203 int aa_index = get_aa_index(name) ; 00204 00205 if(aa_index != -1) { 00206 return ST_aa[aa_index].volume ; 00207 }/* 00208 else { 00209 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00210 }*/ 00211 00212 return -1.0 ; 00213 } 00214 00215 /** 00216 ## FUNCTION: 00217 get_aa_hydrophobicity_score 00218 00219 ## SPECIFICATION: 00220 Return the hydrophobicity score of given amino acid 00221 00222 ## PARAMETRES: 00223 @ const char *name: Amno acid name (3 letter code representation) 00224 00225 ## RETURN: 00226 float: hydrophobicity score, -1 if aa not found in the tab 00227 00228 */ 00229 float get_aa_hydrophobicity_score(const char *name) 00230 { 00231 int aa_index = get_aa_index(name) ; 00232 00233 if(aa_index != -1) { 00234 return ST_aa[aa_index].hydrophobicity ; 00235 }/* 00236 else { 00237 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00238 }*/ 00239 00240 return -1.0 ; 00241 } 00242 00243 /** 00244 ## FUNCTION: 00245 get_aa_charge 00246 00247 ## SPECIFICATION: 00248 Return the charge score of given amino acid 00249 00250 ## PARAMETRES: 00251 const char *name: Amno acid name (3 letter code representation) 00252 00253 ## RETURN: 00254 charge (positiv, negativ, neutral, see header for more details), 0 if aa 00255 not found in the tab 00256 00257 */ 00258 int get_aa_charge(const char *name) 00259 { 00260 int aa_index = get_aa_index(name) ; 00261 00262 if(aa_index != -1) { 00263 return ST_aa[aa_index].charge ; 00264 }/* 00265 else { 00266 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00267 }*/ 00268 00269 return 0 ; 00270 } 00271 00272 /** 00273 ## FUNCTION: 00274 get_aa_polarity 00275 00276 ## SPECIFICATION: 00277 Return the polarity score of given amino acid 00278 00279 ## PARAMETRES: 00280 @ const char *name: Amno acid name (3 letter code representation) 00281 00282 ## RETURN: 00283 int polarity (polar, apolar), 0 if aa not found in the tab 00284 00285 */ 00286 int get_aa_polarity(const char *name) 00287 { 00288 int aa_index = get_aa_index(name) ; 00289 00290 if(aa_index != -1) { 00291 return ST_aa[aa_index].polarity ; 00292 }/* 00293 else { 00294 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00295 }*/ 00296 00297 return -1 ; 00298 } 00299 00300 /** 00301 ## FUNCTION: 00302 get_func_grp_from_idx 00303 00304 ## SPECIFICATION: 00305 Return the functional group type of the given amino acid 00306 00307 ## PARAMETRES: 00308 @ const char *name: Amno acid name (3 letter code representation) 00309 00310 ## RETURN: 00311 int: functional group id 00312 00313 */ 00314 int get_aa_func_grp(const char *name) 00315 { 00316 int aa_index = get_aa_index(name) ; 00317 00318 if(aa_index != -1) { 00319 return ST_aa[aa_index].func_grp ; 00320 }/* 00321 else { 00322 fprintf(stderr, "! Amino acid '%s' could not be found in property table...\n", name); 00323 }*/ 00324 00325 return -1 ; 00326 } 00327 00328 00329 /************** Getting information from an AA index in the static tab **************/ 00330 00331 00332 /** 00333 ## FUNCTION: 00334 get_volume_score_from_idx 00335 00336 ## SPECIFICATION: 00337 Return the volume score of given amino acid 00338 00339 ## PARAMETRES: 00340 @ int aa_index: Index of the amino acid in the tab 00341 00342 ## RETURN: 00343 float: volume score, -1 if aa not found in the tab 00344 00345 */ 00346 float get_volume_score_from_idx(int aa_index) 00347 { 00348 if(aa_index < M_NB_AA && aa_index >= 0){ 00349 return ST_aa[aa_index].volume ; 00350 }/* 00351 else { 00352 fprintf(stderr, "! Amino acid %d could not be found in property table...\n", aa_index); 00353 }*/ 00354 00355 return -1.0 ; 00356 } 00357 00358 /** 00359 ## FUNCTION: 00360 get_hydrophobicity_score_from_idx 00361 00362 ## SPECIFICATION: 00363 Return the hydrophobicity score of given amino acid 00364 00365 ## PARAMETRES: 00366 @ int aa_index: Index of the amino acid in the tab 00367 00368 ## RETURN: 00369 float hydrophobicity score, -1 if aa not found in the tab 00370 00371 */ 00372 float get_hydrophobicity_score_from_idx(int aa_index) 00373 { 00374 if(aa_index < M_NB_AA && aa_index >= 0) { 00375 return ST_aa[aa_index].hydrophobicity ; 00376 }/* 00377 else { 00378 fprintf(stderr, "! Amino acid %d could not be found in property table...\n", aa_index); 00379 }*/ 00380 00381 return -1.0 ; 00382 } 00383 00384 /** 00385 ## FUNCTION: 00386 get_charge_from_idx 00387 00388 ## SPECIFICATION: 00389 Return the charge score of given amino acid 00390 00391 ## PARAMETRES: 00392 @ int aa_index: Index of the amino acid in the tab 00393 00394 ## RETURN: 00395 int charge (positiv, negativ, neutral, see header for more details), 0 if aa 00396 not found in the tab 00397 00398 */ 00399 int get_charge_from_idx(int aa_index) 00400 { 00401 if(aa_index < M_NB_AA && aa_index >= 0){ 00402 return ST_aa[aa_index].charge ; 00403 }/* 00404 else { 00405 fprintf(stderr, "! Amino acid %d could not be found in property table...\n", aa_index); 00406 }*/ 00407 00408 return 0 ; 00409 } 00410 00411 /** 00412 ## FUNCTION: 00413 get_polarity_from_idx 00414 00415 ## SPECIFICATION: 00416 Return the polarity score of given amino acid 00417 00418 ## PARAMETRES: 00419 @ int aa_index: Index of the amino acid in the tab 00420 00421 ## RETURN: 00422 int: polarity (polar, apolar), -1 if aa not found in the tab 00423 00424 */ 00425 int get_polarity_from_idx(int aa_index) 00426 { 00427 if(aa_index < M_NB_AA && aa_index >= 0) { 00428 return ST_aa[aa_index].polarity ; 00429 }/* 00430 else { 00431 fprintf(stderr, "! Amino acid %d could not be found in property table...\n", aa_index); 00432 }*/ 00433 00434 return -1 ; 00435 } 00436 00437 /** 00438 ## FUNCTION: 00439 get_func_grp_from_idx 00440 00441 ## SPECIFICATION: 00442 Return the functional group type of the given amino acid 00443 00444 ## PARAMETRES: 00445 @ int aa_index: Index of the amino acid in the tab 00446 00447 ## RETURN: 00448 int: functional group id 00449 00450 */ 00451 int get_func_grp_from_idx(int aa_index) 00452 { 00453 if(aa_index < M_NB_AA && aa_index >= 0) { 00454 return ST_aa[aa_index].func_grp ; 00455 }/* 00456 else { 00457 fprintf(stderr, "! Amino acid %d could not be found in property table...\n", aa_index); 00458 }*/ 00459 00460 return -1 ; 00461 }