#include <stdlib.h>
#include <stdio.h>
#include "fpocket.h"
#include "fpout.h"
#include "rpdb.h"
#include "atom.h"
#include "fparams.h"
Go to the source code of this file.
Functions | |
int | check_qhull (void) |
int | check_fparams (void) |
int | check_fpocket (void) |
int | check_is_valid_element (void) |
int | check_pdb_reader (void) |
void | load_pdb_line (s_atm *atom, char *line) |
void | test_pdb_line (char test_case[], const char entry[], int id, const char name[], char aloc, char chain, int resid, char insert, float x, float y, float z, float occ, float bfactor, const char symbol[], int charge, int N) |
int check_fparams | ( | void | ) |
## FUNCTION: int check_fparams(void)
## SPECIFICATION: function to check fparams parsing
Definition at line 173 of file check.c.
References s_fparams::asph_max_size, s_fparams::asph_min_size, s_fparams::clust_max_dist, get_fpocket_args(), s_fparams::min_apol_neigh, s_fparams::min_pock_nb_asph, my_free(), my_malloc(), s_fparams::pdb_path, s_fparams::refine_clust_dist, s_fparams::refine_min_apolar_asphere_prop, s_fparams::sl_clust_max_dist, and s_fparams::sl_clust_min_nneigh.
Referenced by main().
00174 { 00175 fprintf(stdout, "\n--> TESTING FPOCKET PARAMETERS <--\n") ; 00176 /* Setting parameters*/ 00177 int N = 21 ; 00178 int i ; 00179 char targs[][100] = { "fpocket", 00180 "-f", "sample/3LKF.pdb", 00181 "-m", "3.1", 00182 "-M", "6.1", 00183 "-A", "2", 00184 "-D", "1.5", 00185 "-s", "4.0", 00186 "-n", "5", 00187 "-i", "1000", 00188 "-r", "10.0", 00189 "-p", "0.0001"} ; 00190 00191 char **args = my_malloc(N*sizeof(char*)) ; 00192 for(i = 0 ; i < N ; i++) { 00193 args[i] = my_malloc(sizeof(char)*strlen(targs[i])) ; 00194 strcpy(args[i], targs[i]) ; 00195 } 00196 /* Checking */ 00197 00198 fprintf(stdout, " PARSING COMMAND LINE ........... ") ; 00199 s_fparams *params = get_fpocket_args(N, (char**)args) ; 00200 if(!params) { 00201 fprintf(stdout, "FAILED \n") ; 00202 return 1 ; 00203 } 00204 fprintf(stdout, "OK \n") ; 00205 00206 int nfails = 0 ; 00207 if(strcmp(args[2], params->pdb_path) == 0) 00208 fprintf(stdout, " TEST FPARAM f .................. OK \n") ; 00209 else { 00210 nfails ++ ; 00211 fprintf(stdout, " TEST FPARAM f .................. FAILED \n") ; 00212 } 00213 00214 if( params->asph_min_size <= atof(args[4])+0.001 00215 && params->asph_min_size >= atof(args[4])-0.001) 00216 fprintf(stdout, " TEST FPARAM m .................. OK \n") ; 00217 else{ 00218 nfails ++ ; 00219 fprintf(stdout, " TEST FPARAM m .................. FAILED \n") ; 00220 } 00221 00222 if( params->asph_max_size <= atof(args[6])+0.001 00223 && params->asph_max_size >= atof(args[6])-0.001) 00224 fprintf(stdout, " TEST FPARAM M .................. OK \n") ; 00225 else{ 00226 nfails ++ ; 00227 fprintf(stdout, " TEST FPARAM M .................. FAILED \n") ; 00228 } 00229 00230 if(atoi(args[8]) == params->min_apol_neigh) 00231 fprintf(stdout, " TEST FPARAM A .................. OK \n") ; 00232 else{ 00233 nfails ++ ; 00234 fprintf(stdout, " TEST FPARAM A .................. FAILED \n") ; 00235 } 00236 00237 if( atof(args[10]) <= params->clust_max_dist + 0.001 && 00238 atof(args[10]) >= params->clust_max_dist - 0.001) 00239 fprintf(stdout, " TEST FPARAM D .................. OK \n") ; 00240 else{ 00241 nfails ++ ; 00242 fprintf(stdout, " TEST FPARAM D .................. FAILED \n") ; 00243 } 00244 00245 if( atof(args[12]) <= params->sl_clust_max_dist + 0.001 && 00246 atof(args[12]) >= params->sl_clust_max_dist - 0.001) 00247 fprintf(stdout, " TEST FPARAM S .................. OK \n") ; 00248 else{ 00249 nfails ++ ; 00250 fprintf(stdout, " TEST FPARAM S .................. FAILED \n") ; 00251 } 00252 00253 if(atoi(args[14]) == params->sl_clust_min_nneigh) 00254 fprintf(stdout, " TEST FPARAM n .................. OK \n") ; 00255 else{ 00256 nfails ++ ; 00257 fprintf(stdout, " TEST FPARAM n .................. FAILED \n") ; 00258 } 00259 00260 if(atoi(args[16]) == params->min_pock_nb_asph) 00261 fprintf(stdout, " TEST FPARAM i .................. OK \n") ; 00262 else{ 00263 nfails ++ ; 00264 fprintf(stdout, " TEST FPARAM i .................. FAILED \n") ; 00265 } 00266 00267 if( atof(args[18]) <= params->refine_clust_dist + 0.001 && 00268 atof(args[18]) >= params->refine_clust_dist - 0.001) 00269 fprintf(stdout, " TEST FPARAM r .................. OK \n") ; 00270 else{ 00271 nfails ++ ; 00272 fprintf(stdout, " TEST FPARAM r .................. FAILED \n") ; 00273 } 00274 00275 if( atof(args[20]) <= params->refine_min_apolar_asphere_prop + 0.001 && 00276 atof(args[20]) >= params->refine_min_apolar_asphere_prop - 0.001) 00277 fprintf(stdout, " TEST FPARAM p .................. OK \n") ; 00278 else{ 00279 nfails ++ ; 00280 fprintf(stdout, " TEST FPARAM p .................. FAILED \n") ; 00281 } 00282 00283 for(i = 0 ; i < N ; i++) my_free(args[i]) ; 00284 my_free(args) ; 00285 00286 return nfails ; 00287 }
int check_fpocket | ( | void | ) |
## FUNCTION: int check_fpocket(void)
## SPECIFICATION: function to check fpocket correct functionality
Definition at line 105 of file check.c.
References c_lst_pocket_free(), free_fparams(), get_fpocket_args(), M_DONT_KEEP_LIG, M_KEEP_LIG, my_free(), my_malloc(), c_lst_pockets::n_pockets, s_fparams::pdb_path, rpdb_open(), rpdb_read(), search_pocket(), and write_out_fpocket().
Referenced by main().
00106 { 00107 fprintf(stdout, "\n--> TESTING FPOCKET ALGORITHM <--\n") ; 00108 /* Setting parameters*/ 00109 int N = 3, i = 0, nfail = 0 ; 00110 char targs[][100] = {"fpocket", "-f", "sample/3LKF.pdb"} ; 00111 00112 char **args = my_malloc(N*sizeof(char*)) ; 00113 for(i = 0 ; i < N ; i++) { 00114 args[i] = my_malloc(sizeof(char)*strlen(targs[i])) ; 00115 strcpy(args[i], targs[i]) ; 00116 } 00117 00118 /* Checking */ 00119 fprintf(stdout, " PARSING COMMAND LINE ........... ") ; 00120 s_fparams *params = get_fpocket_args(N, args) ; 00121 if(!params) { 00122 fprintf(stdout, "FAILED \n") ; 00123 return 1 ; 00124 } 00125 fprintf(stdout, "OK \n") ; 00126 00127 fprintf(stdout, " OPENING PDB FILE................ ") ; 00128 s_pdb *pdb = rpdb_open(params->pdb_path, NULL, M_DONT_KEEP_LIG) ; 00129 s_pdb *pdb_w_lig = rpdb_open(params->pdb_path, NULL, M_KEEP_LIG) ; 00130 00131 if(pdb) { 00132 /* Actual reading of pdb data and then calculation */ 00133 fprintf(stdout, "OK \n") ; 00134 fprintf(stdout, " READING PDB FILE ............... ") ; 00135 rpdb_read(pdb, NULL, M_DONT_KEEP_LIG) ; 00136 rpdb_read(pdb_w_lig, NULL, M_KEEP_LIG) ; 00137 fprintf(stdout, "OK \n") ; 00138 00139 fprintf(stdout, " RUNNING FPOCKET ................ ") ; 00140 c_lst_pockets *pockets = search_pocket(pdb, params,pdb_w_lig); 00141 if(pockets && pockets->n_pockets > 0) { 00142 fprintf(stdout, "OK \n") ; 00143 fprintf(stdout, " WRITING FPOCKET OUTPUT ......... ") ; 00144 write_out_fpocket(pockets, pdb, params->pdb_path); 00145 fprintf(stdout, "OK \n") ; 00146 c_lst_pocket_free(pockets) ; 00147 } 00148 else { 00149 nfail++ ; 00150 fprintf(stdout, "NO POCKET FOUND\n") ; 00151 } 00152 } 00153 else { 00154 nfail++ ; 00155 fprintf(stdout, "FAILED (%s) \n", params->pdb_path) ; 00156 } 00157 00158 for(i = 0 ; i < N ; i++) my_free(args[i]) ; 00159 my_free(args) ; 00160 free_fparams(params) ; 00161 00162 return nfail ; 00163 }
int check_is_valid_element | ( | void | ) |
Definition at line 431 of file check.c.
References is_valid_element().
Referenced by check_pdb_reader().
00432 { 00433 int nfails = 0 ; 00434 00435 /* Testing if the ignore element is taken into account */ 00436 fprintf(stdout, " TEST ELEMENT COMPARATOR (1) .... ") ; 00437 int idx1 = is_valid_element("He", 1) ; 00438 int idx2 = is_valid_element("He", 0) ; 00439 int idx3 = is_valid_element("he", 1) ; 00440 int idx4 = is_valid_element("he", 0) ; 00441 00442 if(idx1 != 2 || idx2 != 2 || idx3 != 2 || idx4 != -1) { 00443 nfails ++ ; 00444 fprintf(stdout, "FAILED \n") ; 00445 } 00446 else fprintf(stdout, "OK \n") ; 00447 00448 /* Testing thje automatic removal of space */ 00449 fprintf(stdout, " TEST ELEMENT COMPARATOR (2) .... ") ; 00450 int idx5 = is_valid_element("Fe ", 1) ; 00451 int idx6 = is_valid_element(" Fe ", 1) ; 00452 int idx7 = is_valid_element(" S", 1) ; 00453 int idx8 = is_valid_element(" S ", 1) ; 00454 if(idx5 == -1 || idx6 == -1 || idx7 == -1 || idx8 == -1) { 00455 nfails ++ ; 00456 fprintf(stdout, "FAILED \n") ; 00457 } 00458 else fprintf(stdout, "OK \n") ; 00459 00460 /* Testing non valid elements */ 00461 fprintf(stdout, " TEST ELEMENT COMPARATOR (3) .... ") ; 00462 int idx9 = is_valid_element(" sdzqqs ", 1) ; 00463 int idx10 = is_valid_element(" 92 ", 1) ; 00464 00465 if(idx9 != -1 || idx10 != -1) { 00466 nfails ++ ; 00467 fprintf(stdout, "FAILED \n") ; 00468 } 00469 else fprintf(stdout, "OK \n") ; 00470 00471 return nfails ; 00472 }
int check_pdb_reader | ( | void | ) |
## FUNCTION: int check_pdb_reader(void)
## SPECIFICATION: function to check pdb parser
Definition at line 297 of file check.c.
References check_is_valid_element(), and test_pdb_line().
Referenced by main().
00298 { 00299 int nfails = 0 ; 00300 00301 fprintf(stdout, "\n--> TESTING PDB READER <--\n") ; 00302 00303 /* Test some routines used by the reader */ 00304 nfails += check_is_valid_element() ; 00305 00306 /* Test several single record cases: */ 00307 /* 00308 "ATOM 1 N BALA A 1 11.104 6.134 -6.504 1.00 0.00 N ", 00309 "ATOM 2 CA ALA A 1 11.639 6.071 -5.147 1.00 0.00 C-1", 00310 "ATOM 293 1HG GLU A 18 -14.861 -4.847 0.361 1.00 0.00 H ", 00311 "HETATM 3835 FE HEM A 1 17.140 3.115 15.066 1.00 14.14 FE ", 00312 "HETATM 8238 S SO4 A2001 10.885 -15.746 -14.404 1.00 47.47 S ", 00313 "HETATM 8239 O1 SO4 A2001 11.191 -14.833 -15.531 1.00 50.12 O " 00314 */ 00315 00316 /* 00317 * FIRST TEST 00318 */ 00319 00320 char test_case1[] = "ATOM 1 N BALA A 1 11.104 6.134 -6.504 1.00 0.00 N " ; 00321 test_pdb_line( test_case1, "ATOM", 1, "N", 'B', 'A', 1, ' ', 00322 11.104, 6.134, -6.504, 1.0, 0.0, "N", 0, 1) ; 00323 00324 char test_case2[] = "ATOM 2 CA ALA A 1 11.639 6.071 -5.147 1.00 0.00 C-1" ; 00325 test_pdb_line( test_case2, "ATOM", 2, "CA", ' ', 'A', 1, ' ', 00326 11.639, 6.071, -5.147, 1.0, 0.0, "C", -1, 2) ; 00327 00328 return nfails ; 00329 00330 }
int check_qhull | ( | void | ) |
COPYRIGHT DISCLAIMER
Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby disclaim all copyright interest in the program “fpocket” (which performs protein cavity detection) written by Vincent Le Guilloux and Peter Schmidtke.
Vincent Le Guilloux 28 November 2008 Peter Schmidtke 28 November 2008 Pierre Tuffery 28 November 2008
GNU GPL
This file is part of the fpocket package.
fpocket is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
fpocket is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with fpocket. If not, see <http://www.gnu.org/licenses/>.
Definition at line 81 of file check.c.
00082 { 00083 fprintf(stdout, "\n--> TESTING QHULL INSTALLATION <--\n") ; 00084 fprintf(stdout, " IS QVORONOI HERE ............... ") ; 00085 int status = system("qvoronoi > /dev/null") ; 00086 if (status != 0) { 00087 fprintf(stdout, "NO -> FPOCKET CANNOT BE TESTED\n") ; 00088 status = 1 ; 00089 } 00090 else{ 00091 fprintf(stdout, "YES\n") ; 00092 } 00093 00094 return status ; 00095 }
void load_pdb_line | ( | s_atm * | atom, | |
char * | line | |||
) |
Definition at line 414 of file check.c.
References s_atm::bfactor, s_atm::chain, s_atm::charge, s_atm::id, s_atm::name, s_atm::occupancy, s_atm::pdb_aloc, s_atm::pdb_insert, s_atm::res_id, s_atm::res_name, rpdb_extract_pdb_atom(), str_trim(), s_atm::symbol, s_atm::type, s_atm::x, s_atm::y, and s_atm::z.
Referenced by test_pdb_line().
00415 { 00416 /*int trash;*/ 00417 int guess_flag=0; 00418 rpdb_extract_pdb_atom(line, atom->type, &(atom->id), 00419 atom->name, &(atom->pdb_aloc), atom->res_name, 00420 atom->chain, &(atom->res_id), &(atom->pdb_insert), 00421 &(atom->x), &(atom->y), &(atom->z), 00422 &(atom->occupancy), &(atom->bfactor), atom->symbol, 00423 &(atom->charge),&guess_flag) ; 00424 00425 str_trim(atom->type) ; 00426 str_trim(atom->name) ; 00427 str_trim(atom->chain) ; 00428 str_trim(atom->symbol) ; 00429 }
void test_pdb_line | ( | char | test_case[], | |
const char | entry[], | |||
int | id, | |||
const char | name[], | |||
char | aloc, | |||
char | chain, | |||
int | resid, | |||
char | insert, | |||
float | x, | |||
float | y, | |||
float | z, | |||
float | occ, | |||
float | bfactor, | |||
const char | symbol[], | |||
int | charge, | |||
int | N | |||
) |
## FUNCTION: int test_pdb_line(void)
## SPECIFICATION: test pdb line parsing
Definition at line 340 of file check.c.
References s_atm::bfactor, s_atm::chain, s_atm::charge, s_atm::id, load_pdb_line(), my_calloc(), my_free(), s_atm::name, s_atm::occupancy, s_atm::pdb_aloc, s_atm::pdb_insert, s_atm::res_id, s_atm::symbol, s_atm::type, s_atm::x, s_atm::y, and s_atm::z.
Referenced by check_pdb_reader().
00344 { 00345 /* 00346 * FIRST TEST 00347 */ 00348 s_atm *atom = my_calloc(1, sizeof(s_atm)) ; 00349 load_pdb_line(atom, test_case) ; 00350 00351 fprintf(stdout, "\n TEST PDB READER (%d) ............ \n", N) ; 00352 00353 fprintf(stdout, " *TEST PDB READER (ENTRY) ..... ") ; 00354 if( strcmp(atom->type, entry) == 0) fprintf(stdout, "OK \n") ; 00355 else fprintf(stdout, "FAILED (%s VS %s)\n", atom->type, entry) ; 00356 00357 00358 fprintf(stdout, " *TEST PDB READER (ID) ........ ") ; 00359 if(atom->id == id) fprintf(stdout, "OK \n") ; 00360 else fprintf(stdout, "FAILED (%d VS %d)\n", atom->id, id) ; 00361 00362 fprintf(stdout, " *TEST PDB READER (NAME) ...... ") ; 00363 if(strcmp(atom->name, name) == 0) fprintf(stdout, "OK \n") ; 00364 else fprintf(stdout, "FAILED (%s VS %s)\n", atom->name, name) ; 00365 00366 fprintf(stdout, " *TEST PDB READER (ALTLOC) .... ") ; 00367 if(atom->pdb_aloc == aloc) fprintf(stdout, "OK \n") ; 00368 else fprintf(stdout, "FAILED (%c VS %c)\n", atom->pdb_aloc, aloc) ; 00369 00370 fprintf(stdout, " *TEST PDB READER (CHAIN) ..... ") ; 00371 if(atom->chain[0] == chain) fprintf(stdout, "OK \n") ; 00372 else fprintf(stdout, "FAILED (%c VS %c)\n", atom->chain[0], chain) ; 00373 00374 fprintf(stdout, " *TEST PDB READER (RESID) ..... ") ; 00375 if(atom->res_id == resid) fprintf(stdout, "OK \n") ; 00376 else fprintf(stdout, "FAILED (%d VS %d)\n", atom->res_id , resid) ; 00377 00378 fprintf(stdout, " *TEST PDB READER (INSERT) .... ") ; 00379 if(atom->pdb_insert == insert) fprintf(stdout, "OK \n") ; 00380 else fprintf(stdout, "FAILED (%c VS %c)\n", atom->pdb_insert, insert) ; 00381 00382 fprintf(stdout, " *TEST PDB READER (X) ......... ") ; 00383 if((atom->x < x+0.001 && atom->x > x-0.001)) fprintf(stdout, "OK \n") ; 00384 else fprintf(stdout, "FAILED (%.2f VS %.2f)\n", atom->x, x) ; 00385 00386 fprintf(stdout, " *TEST PDB READER (Y) ......... ") ; 00387 if((atom->y < y+0.001 && atom->y > y-0.001)) fprintf(stdout, "OK \n") ; 00388 else fprintf(stdout, "FAILED (%.2f VS %.2f)\n", atom->y, y) ; 00389 00390 fprintf(stdout, " *TEST PDB READER (Z) ......... ") ; 00391 if((atom->z < z+0.001 && atom->z > z-0.001)) fprintf(stdout, "OK \n") ; 00392 else fprintf(stdout, "FAILED (%.2f VS %.2f)\n", atom->z, z) ; 00393 00394 fprintf(stdout, " *TEST PDB READER (OCCUPANCY) . ") ; 00395 if((atom->occupancy < occ+0.001 && atom->occupancy > occ-0.001)) fprintf(stdout, "OK \n") ; 00396 else fprintf(stdout, "FAILED (%.2f VS %.2f)\n", atom->occupancy, occ) ; 00397 00398 fprintf(stdout, " *TEST PDB READER (BFACTOR) ... ") ; 00399 if((atom->bfactor < bfactor+0.001 && atom->bfactor > bfactor-0.001)) fprintf(stdout, "OK \n") ; 00400 else fprintf(stdout, "FAILED (%.2f VS %.2f)\n", atom->bfactor, bfactor) ; 00401 00402 fprintf(stdout, " *TEST PDB READER (SYMBOL) .... ") ; 00403 if(strcmp(atom->symbol, symbol) == 0) fprintf(stdout, "OK \n") ; 00404 else fprintf(stdout, "FAILED (%s VS %s)\n", atom->symbol, symbol) ; 00405 00406 fprintf(stdout, " *TEST PDB READER (CHARGE) .... ") ; 00407 if(atom->charge == charge) fprintf(stdout, "OK \n") ; 00408 else fprintf(stdout, "FAILED (%d VS %d)\n", atom->charge, charge) ; 00409 00410 my_free(atom) ; 00411 }