#include "../headers/fpmain.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
void | process_pdb (char *pdbname, s_fparams *params) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
## FUNCTION: int main(int argc, char *argv[])
## SPECIFICATION: Main program!
Definition at line 71 of file fpmain.c.
References s_fparams::db_run, free_all(), free_fparams(), get_fpocket_args(), s_fparams::npdb, s_fparams::pdb_lst, s_fparams::pdb_path, print_pocket_usage(), and process_pdb().
00072 { 00073 00074 00075 s_fparams *params = get_fpocket_args(argc, argv) ; 00076 if(!params->db_run) fprintf(stdout, "***** POCKET HUNTING BEGINS ***** \n") ; 00077 /* If parameters parsing is ok */ 00078 if(params) { 00079 if(params->pdb_lst != NULL) { 00080 /* Handle a list of pdb */ 00081 int i ; 00082 for (i = 0 ; i < params->npdb ; i++) { 00083 00084 printf("> Protein %d / %d : %s", i, params->npdb, 00085 params->pdb_lst[i]) ; 00086 if(i == params->npdb - 1) fprintf(stdout, "\n") ; 00087 else fprintf(stdout, "\r") ; 00088 fflush(stdout) ; 00089 process_pdb(params->pdb_lst[i], params) ; 00090 } 00091 } 00092 else { 00093 if(params->pdb_path == NULL || strlen(params->pdb_path) <= 0) { 00094 fprintf(stdout, "! Invalid pdb name given.\n"); 00095 print_pocket_usage(stdout) ; 00096 } 00097 else { 00098 00099 process_pdb(params->pdb_path, params) ; 00100 } 00101 } 00102 00103 free_fparams(params) ; 00104 } 00105 else { 00106 print_pocket_usage(stdout) ; 00107 } 00108 00109 if(!params->db_run)fprintf(stdout, "***** POCKET HUNTING ENDS ***** \n") ; 00110 free_all() ; 00111 00112 return 0; 00113 }
void process_pdb | ( | char * | pdbname, | |
s_fparams * | params | |||
) |
## FUNCTION: process_pdb
## SPECIFICATION: Handle a single pdb: check the pdb name, load data, and launch fpocket if the pdb file have been successfully read.
## PARAMETRES: @ char *pdbname : Name of the pdb @ s_fparams *params : Parameters of the algorithm. See fparams.c/.h
## RETURN: void
Definition at line 130 of file fpmain.c.
References c_lst_pocket_free(), s_fparams::db_run, s_pdb::fpdb, M_DONT_KEEP_LIG, M_KEEP_LIG, M_MAX_PDB_NAME_LEN, rpdb_open(), rpdb_read(), search_pocket(), write_descriptors_DB(), write_out_fpocket(), and write_out_fpocket_DB().
Referenced by main().
00131 { 00132 /* Check the PDB file */ 00133 if(pdbname == NULL) return ; 00134 00135 int len = strlen(pdbname) ; 00136 if(len >= M_MAX_PDB_NAME_LEN || len <= 0) { 00137 fprintf(stderr, "! Invalid length for the pdb file name. (Max: %d, Min 1)\n", 00138 M_MAX_PDB_NAME_LEN) ; 00139 return ; 00140 } 00141 00142 /* Try to open it */ 00143 s_pdb *pdb = rpdb_open(pdbname, NULL, M_DONT_KEEP_LIG) ; 00144 s_pdb *pdb_w_lig = rpdb_open(pdbname, NULL, M_KEEP_LIG) ; 00145 00146 if(pdb) { 00147 /* Actual reading of pdb data and then calculation */ 00148 rpdb_read(pdb, NULL, M_DONT_KEEP_LIG) ; 00149 rpdb_read(pdb_w_lig, NULL, M_KEEP_LIG) ; 00150 c_lst_pockets *pockets = search_pocket(pdb, params,pdb_w_lig); 00151 if(pockets) { 00152 00153 if(params->db_run) { 00154 write_descriptors_DB(pockets,stdout); 00155 write_out_fpocket_DB(pockets, pdb, pdbname); 00156 } 00157 else write_out_fpocket(pockets, pdb, pdbname); 00158 c_lst_pocket_free(pockets) ; 00159 } 00160 fclose(pdb->fpdb); 00161 } 00162 else fprintf(stderr, "! PDB reading failed!\n"); 00163 }