writepocket.c File Reference

#include "../headers/writepocket.h"

Go to the source code of this file.

Functions

void write_each_pocket_for_DB (const char out_path[], c_lst_pockets *pockets, s_pdb *pdb)
void write_pocket_pqr_DB (const char out[], s_pocket *pocket)
void write_pocket_pdb_DB (const char out[], s_pocket *pocket, s_pdb *pdb)
void write_pockets_single_pdb (const char out[], s_pdb *pdb, c_lst_pockets *pockets)
void write_pdb_atoms (FILE *f, s_atm *atoms, int natoms)
void write_pockets_single_pqr (const char out[], c_lst_pockets *pockets)
void write_mdpockets_concat_pqr (FILE *f, c_lst_pockets *pockets)
void write_each_pocket (const char out_path[], c_lst_pockets *pockets)
void write_pocket_pqr (const char out[], s_pocket *pocket)
void write_pocket_pdb (const char out[], s_pocket *pocket)


Function Documentation

void write_each_pocket ( const char  out_path[],
c_lst_pockets pockets 
)

## FUNCTION: write_each_pocket

## SPECIFICATION: Write each pocket in a single pqr (vertices) and pdb (atoms) file format.

## PARAMETRES: @ const char out[] : Output file path @ c_lst_pockets *pockets : List of pockets

## RETURN:

Definition at line 392 of file writepocket.c.

References c_lst_pockets::first, node_pocket::next, node_pocket::pocket, write_pocket_pdb(), and write_pocket_pqr().

Referenced by write_out_fpocket().

00393 {
00394         int out_len = strlen(out_path) ;
00395         char out[out_len+20] ;
00396         out[0] = '\0' ;
00397 
00398         node_pocket *pcur ;
00399         
00400         int i = 0 ;
00401         if(pockets){
00402                 pcur = pockets->first ;
00403 
00404                 while(pcur){
00405                         sprintf(out, "%s/pocket%d_vert.pqr", out_path, i) ;
00406                         write_pocket_pqr(out, pcur->pocket) ;
00407 
00408                         sprintf(out, "%s/pocket%d_atm.pdb", out_path, i) ;
00409                         write_pocket_pdb(out, pcur->pocket) ;
00410 
00411                         pcur = pcur->next ;
00412                         i++ ;
00413                 }
00414         }
00415         else {
00416                 fprintf(stderr, "! The file %s could not be opened!\n", out);
00417         }
00418 }

void write_each_pocket_for_DB ( const char  out_path[],
c_lst_pockets pockets,
s_pdb pdb 
)

Definition at line 59 of file writepocket.c.

References c_lst_pockets::first, node_pocket::next, node_pocket::pocket, write_pocket_pdb(), write_pocket_pdb_DB(), and write_pocket_pqr_DB().

Referenced by write_out_fpocket_DB().

00060 {
00061         int out_len = strlen(out_path) ;
00062         char out[out_len+20] ;
00063         out[0] = '\0' ;
00064 
00065         node_pocket *pcur ;
00066 
00067         int i = 0 ;
00068         if(pockets){
00069                 pcur = pockets->first ;
00070 
00071                 while(pcur){
00072                         sprintf(out, "%s/pocket%d_vert.pqr", out_path, i+1) ;
00073                         write_pocket_pqr_DB(out, pcur->pocket) ;
00074 
00075                         sprintf(out, "%s/pocket%d_env_atm.pdb", out_path, i+1) ;
00076                         write_pocket_pdb_DB(out, pcur->pocket,pdb) ;
00077                         sprintf(out, "%s/pocket%d_atm.pdb", out_path, i+1) ;
00078                         write_pocket_pdb(out, pcur->pocket) ;
00079 
00080                         pcur = pcur->next ;
00081                         i++ ;
00082                 }
00083         }
00084         else {
00085                 fprintf(stderr, "! The file %s could not be opened!\n", out);
00086         }
00087 }

void write_mdpockets_concat_pqr ( FILE *  f,
c_lst_pockets pockets 
)

## FUNCTION: write_mdpockets_concat_pqr

## SPECIFICATION: Write only pockets (alpha sphere) given in argument in the pqr format.

!! No atoms writen here, only all pockets in a single pqr file.

## PARAMETRES: @ File *f : File handle for the output file @ c_lst_pockets *pockets : List of pockets

## RETURN:

Definition at line 347 of file writepocket.c.

References c_lst_vertices::current, c_lst_pockets::current, c_lst_vertices::first, c_lst_pockets::first, node_pocket::next, node_vertice::next, node_pocket::pocket, s_pocket::v_lst, node_vertice::vertice, and write_pqr_vert().

00348 {
00349         node_pocket *nextPocket ;
00350         node_vertice *nextVertice ;
00351 
00352         if(f) {
00353 
00354                 if(pockets){
00355                         pockets->current = pockets->first ;
00356 
00357                         while(pockets->current){
00358                                 pockets->current->pocket->v_lst->current = pockets->current->pocket->v_lst->first ;
00359 
00360                                 while(pockets->current->pocket->v_lst->current){
00361                                         write_pqr_vert(f, pockets->current->pocket->v_lst->current->vertice) ;
00362 
00363                                         nextVertice = pockets->current->pocket->v_lst->current->next;
00364                                         pockets->current->pocket->v_lst->current = nextVertice;
00365                                 }
00366 
00367                                 nextPocket=pockets->current->next;
00368                                 pockets->current=nextPocket;
00369                         }
00370                 }
00371         }
00372         else {
00373                 fprintf(stderr, "! The pqr concat output file is not open!\n");
00374         }
00375 }

void write_pdb_atoms ( FILE *  f,
s_atm atoms,
int  natoms 
)

## FUNCTION: write_pdb_atoms

## SPECIFICATION: Print list of atoms as pdb format in given buffer

## PARAMETRES: @ FILE *f : Buffer to write in. @ s_atm *atoms : List of atoms @ int natoms : Number of atoms

## RETURN:

Definition at line 263 of file writepocket.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, s_atm::symbol, s_atm::type, write_pdb_atom_line(), s_atm::x, s_atm::y, and s_atm::z.

Referenced by write_pockets_single_pdb().

00264 {
00265         s_atm *atom = NULL ;
00266         int i = 0 ;
00267         for(i = 0 ; i < natoms ; i++) {
00268                 atom = atoms + i ;
00269                 write_pdb_atom_line(f, atom->type, atom->id, atom->name, atom->pdb_aloc, 
00270                                                         atom->res_name, atom->chain, atom->res_id, 
00271                                                         atom->pdb_insert, atom->x, atom->y, atom->z,
00272                                                         atom->occupancy, atom->bfactor, atom->symbol, 
00273                                                         atom->charge);
00274         }
00275 }

void write_pocket_pdb ( const char  out[],
s_pocket pocket 
)

## FUNCTION: write_pocket_pdb

## SPECIFICATION: Write atoms contacted by vertices of the pocket given in argument in the pdb format.

## PARAMETRES: @ const char out[] : Output file path @ s_pocket *pocket : The pocket to write

## RETURN:

Definition at line 495 of file writepocket.c.

References s_desc::apolar_asphere_prop, s_atm::bfactor, s_atm::chain, s_atm::charge, s_desc::charge_score, s_desc::drug_score, c_lst_vertices::first, s_desc::flex, s_desc::hydrophobicity_score, s_atm::id, is_in_lst_atm(), s_desc::masph_sacc, s_desc::mean_asph_ray, s_desc::mean_loc_hyd_dens, my_free(), my_malloc(), my_realloc(), s_pocket::nAlphaApol, s_atm::name, s_desc::nb_asph, s_vvertice::neigh, node_vertice::next, s_atm::occupancy, s_atm::pdb_aloc, s_atm::pdb_insert, s_pocket::pdesc, s_desc::polarity_score, s_atm::res_id, s_atm::res_name, s_vvertice::resid, s_pocket::score, s_atm::symbol, s_atm::type, s_pocket::v_lst, node_vertice::vertice, s_desc::volume, s_desc::volume_score, write_pdb_atom_line(), s_atm::x, s_atm::y, and s_atm::z.

Referenced by write_each_pocket(), and write_each_pocket_for_DB().

00496 {
00497         node_vertice *vcur = NULL ;
00498         int i = 0 ;
00499         int cur_size = 0,
00500                 cur_allocated = 10 ;
00501 
00502         s_atm **atms = (s_atm**)my_malloc(sizeof(s_atm*)*10) ;
00503         s_atm *atom = NULL ;
00504 
00505         FILE *f = fopen(out, "w") ;
00506         if(f && pocket) {
00507 
00508                 fprintf(f, "HEADER\n") ;
00509                 fprintf(f, "HEADER This is a pdb format file writen by the programm fpocket.                 \n") ;
00510                 fprintf(f, "HEADER It represents the atoms contacted by the voronoi vertices of the pocket.  \n") ;
00511                 fprintf(f, "HEADER                                                                           \n") ;
00512                 fprintf(f, "HEADER Information about the pocket %5d:\n", pocket->v_lst->first->vertice->resid) ;
00513                 fprintf(f, "HEADER 0  - Pocket Score                      : %.4f\n", pocket->score) ;
00514                 fprintf(f, "HEADER 1  - Drug Score                        : %.4f\n", pocket->pdesc->drug_score) ;
00515                 fprintf(f, "HEADER 2  - Number of V. Vertices             : %5d\n", pocket->pdesc->nb_asph) ;
00516                 fprintf(f, "HEADER 3  - Mean alpha-sphere radius          : %.4f\n", pocket->pdesc->mean_asph_ray) ;
00517                 fprintf(f, "HEADER 4  - Mean alpha-sphere SA              : %.4f\n", pocket->pdesc->masph_sacc) ;
00518                 fprintf(f, "HEADER 5  - Mean B-factor                     : %.4f\n", pocket->pdesc->flex) ;
00519                 fprintf(f, "HEADER 6  - Hydrophobicity Score              : %.4f\n", pocket->pdesc->hydrophobicity_score) ;
00520                 fprintf(f, "HEADER 7  - Polarity Score                    : %5d\n", pocket->pdesc->polarity_score) ;
00521                 fprintf(f, "HEADER 8  - Volume Score                      : %.4f\n", pocket->pdesc->volume_score) ;
00522                 fprintf(f, "HEADER 9  - Real volume (approximation)       : %.4f\n", pocket->pdesc->volume) ;
00523                 fprintf(f, "HEADER 10 - Charge Score                      : %5d\n", pocket->pdesc->charge_score) ;
00524                 fprintf(f, "HEADER 11 - Local hydrophobic density Score   : %.4f\n", pocket->pdesc->mean_loc_hyd_dens) ;
00525                 fprintf(f, "HEADER 12 - Number of apolar alpha sphere     : %5d\n", pocket->nAlphaApol) ;
00526                 fprintf(f, "HEADER 13 - Proportion of apolar alpha sphere : %.4f\n", pocket->pdesc->apolar_asphere_prop) ;
00527 
00528         /* First get the list of atoms */
00529                 vcur = pocket->v_lst->first ;
00530 
00531                 while(vcur){
00532                         for(i = 0 ; i < 4 ; i++) {
00533                                 if(!is_in_lst_atm(atms, cur_size, vcur->vertice->neigh[i]->id)) {
00534                                         if(cur_size >= cur_allocated-1) {
00535                                                 cur_allocated *= 2 ;
00536                                                 atms = (s_atm**)my_realloc(atms, sizeof(s_atm)*cur_allocated) ;
00537                                         }
00538                                         atms[cur_size] = vcur->vertice->neigh[i] ;
00539                                         cur_size ++ ;
00540                                 }
00541 
00542                         }
00543                         vcur = vcur->next ;
00544                 }
00545 
00546         /* Then write atoms... */
00547 
00548                 for(i = 0 ; i < cur_size ; i++) {
00549                         atom = atms[i] ;
00550 
00551                         write_pdb_atom_line(f, atom->type, atom->id, atom->name, atom->pdb_aloc, 
00552                                                                         atom->res_name, atom->chain, atom->res_id, 
00553                                                                         atom->pdb_insert, atom->x, atom->y, atom->z,
00554                                                                         atom->occupancy, atom->bfactor, atom->symbol, 
00555                                                                         atom->charge);
00556                 }
00557         
00558                 fprintf(f, "TER\nEND\n") ;
00559                 fclose(f) ;
00560         }
00561         else {
00562                 if(!f) fprintf(stderr, "! The file %s could not be opened!\n", out);
00563                 else fprintf(stderr, "! Invalid pocket to write in write_pocket_pqr !\n");
00564         }
00565 
00566         my_free(atms) ;
00567 }

void write_pocket_pdb_DB ( const char  out[],
s_pocket pocket,
s_pdb pdb 
)

Definition at line 115 of file writepocket.c.

References s_atm::bfactor, s_atm::chain, s_atm::charge, c_lst_vertices::first, get_surrounding_atoms_idx(), s_atm::id, s_pdb::latoms_p, my_free(), my_malloc(), c_lst_vertices::n_vertices, s_atm::name, node_vertice::next, s_atm::occupancy, s_atm::pdb_aloc, s_atm::pdb_insert, s_atm::res_id, s_atm::res_name, s_atm::symbol, s_atm::type, s_pocket::v_lst, node_vertice::vertice, write_pdb_atom_line(), s_atm::x, s_atm::y, and s_atm::z.

Referenced by write_each_pocket_for_DB().

00116 {
00117         int i = 0,nvert=0 ;
00118         s_atm **atms = (s_atm **) my_malloc(sizeof(s_atm*)*10) ;
00119         s_atm *atom = NULL ;
00120         int n_sa=0;
00121         int *sa=NULL;    /*surrounding atoms container*/
00122         s_vvertice **tab_vert =NULL;
00123 
00124         FILE *f = fopen(out, "w") ;
00125         if(f && pocket) {
00126         // First get the list of atoms
00127                         tab_vert = (s_vvertice **) my_malloc(pocket->v_lst->n_vertices*sizeof(s_vvertice*)) ;
00128                 
00129                         node_vertice *nvcur = pocket->v_lst->first ;
00130 
00131 /*
00132                         fprintf(stdout, "A Pocket:\n") ;
00133 */
00134                         while(nvcur) {
00135 /*
00136                                 fprintf(stdout, "Vertice %d: %p %d %f\n", i, nvcur->vertice, nvcur->vertice->id, nvcur->vertice->ray) ;
00137                                 fprintf(stdout, "Atom %s\n", nvcur->vertice->neigh[0]->name) ;
00138 */
00139 
00140                                 tab_vert[nvert] = nvcur->vertice ;
00141                                 nvcur = nvcur->next ;
00142                                 nvert++ ;
00143                         }
00144             sa=(int *)get_surrounding_atoms_idx(tab_vert,nvert,pdb, &n_sa);
00145             for(i=0;i<n_sa;i++){
00146                         //atom = pocket->sou_atoms[i] ;
00147                         atom=pdb->latoms_p[sa[i]];
00148                         write_pdb_atom_line(f, atom->type, atom->id, atom->name, atom->pdb_aloc,
00149                                                                         atom->res_name, atom->chain, atom->res_id,
00150                                                                         atom->pdb_insert, atom->x, atom->y, atom->z,
00151                                                                         atom->occupancy, atom->bfactor, atom->symbol,
00152                                                                         atom->charge);
00153             }
00154 /*
00155             vcur = pocket->v_lst->first ;
00156 
00157                 while(vcur){
00158                         for(i = 0 ; i < 4 ; i++) {
00159                                 if(!is_in_lst_atm(atms, cur_size, vcur->vertice->neigh[i]->id)) {
00160                                         if(cur_size >= cur_allocated-1) {
00161                                                 cur_allocated *= 2 ;
00162                                                 atms = (s_atm**) my_realloc(atms, sizeof(s_atm)*cur_allocated) ;
00163                                         }
00164                                         atms[cur_size] = vcur->vertice->neigh[i] ;
00165                                         cur_size ++ ;
00166                                 }
00167 
00168                         }
00169                         vcur = vcur->next ;
00170                 }
00171 */
00172         // Then write atoms...
00173 /*
00174                 for(i = 0 ; i < cur_size ; i++) {
00175                         atom = atms[i] ;
00176 
00177                         write_pdb_atom_line(f, atom->type, atom->id, atom->name, atom->pdb_aloc,
00178                                                                         atom->res_name, atom->chain, atom->res_id,
00179                                                                         atom->pdb_insert, atom->x, atom->y, atom->z,
00180                                                                         atom->occupancy, atom->bfactor, atom->symbol,
00181                                                                         atom->charge);
00182                 }
00183 */
00184                 fprintf(f, "TER\nEND\n") ;
00185                 fclose(f) ;
00186         }
00187         else {
00188                 if(!f) fprintf(stderr, "! The file %s could not be opened!\n", out);
00189                 else fprintf(stderr, "! Invalid pocket to write in write_pocket_pqr !\n");
00190         }
00191 
00192         my_free(atms) ;
00193 }

void write_pocket_pqr ( const char  out[],
s_pocket pocket 
)

## FUNCTION: void write_pocket_pqr

## SPECIFICATION: Write vertices of the pocket given in argument in the pqr format.

## PARAMETRES: @ const char out[] : Output file path @ s_pocket *pocket : The pocket to write

## RETURN:

Definition at line 435 of file writepocket.c.

References s_desc::apolar_asphere_prop, s_desc::charge_score, s_desc::drug_score, c_lst_vertices::first, s_desc::flex, s_desc::hydrophobicity_score, s_desc::masph_sacc, s_desc::mean_asph_ray, s_desc::mean_loc_hyd_dens, s_pocket::nAlphaApol, s_desc::nb_asph, node_vertice::next, s_pocket::pdesc, s_desc::polarity_score, s_vvertice::resid, s_pocket::score, s_pocket::v_lst, node_vertice::vertice, s_desc::volume, s_desc::volume_score, and write_pqr_vert().

Referenced by write_each_pocket().

00436 {
00437         node_vertice *vcur = NULL ;
00438 
00439         FILE *f = fopen(out, "w") ;
00440         if(f && pocket) {
00441                 fprintf(f, "HEADER\n") ;
00442                 fprintf(f, "HEADER This is a pqr format file writen by the programm fpocket.                 \n") ;
00443                 fprintf(f, "HEADER It represent the voronoi vertices of a single pocket found by the         \n") ;
00444                 fprintf(f, "HEADER algorithm.                                                                \n") ;
00445                 fprintf(f, "HEADER                                                                           \n") ;
00446                 fprintf(f, "HEADER Information about the pocket %5d:\n", pocket->v_lst->first->vertice->resid) ;
00447                 fprintf(f, "HEADER 0  - Pocket Score                      : %.4f\n", pocket->score) ;
00448                 fprintf(f, "HEADER 1  - Drug Score                        : %.4f\n", pocket->pdesc->drug_score) ;
00449                 fprintf(f, "HEADER 2  - Number of V. Vertices             : %5d\n", pocket->pdesc->nb_asph) ;
00450                 fprintf(f, "HEADER 3  - Mean alpha-sphere radius          : %.4f\n", pocket->pdesc->mean_asph_ray) ;
00451                 fprintf(f, "HEADER 4  - Mean alpha-sphere SA              : %.4f\n", pocket->pdesc->masph_sacc) ;
00452                 fprintf(f, "HEADER 5  - Mean B-factor                     : %.4f\n", pocket->pdesc->flex) ;
00453                 fprintf(f, "HEADER 6  - Hydrophobicity Score              : %.4f\n", pocket->pdesc->hydrophobicity_score) ;
00454                 fprintf(f, "HEADER 7  - Polarity Score                    : %5d\n", pocket->pdesc->polarity_score) ;
00455                 fprintf(f, "HEADER 8  - Volume Score                      : %.4f\n", pocket->pdesc->volume_score) ;
00456                 fprintf(f, "HEADER 9  - Real volume (approximation)       : %.4f\n", pocket->pdesc->volume) ;
00457                 fprintf(f, "HEADER 10 - Charge Score                      : %5d\n", pocket->pdesc->charge_score) ;
00458                 fprintf(f, "HEADER 11 - Local hydrophobic density Score   : %.4f\n", pocket->pdesc->mean_loc_hyd_dens) ;
00459                 fprintf(f, "HEADER 12 - Number of apolar alpha sphere     : %5d\n", pocket->nAlphaApol) ;
00460                 fprintf(f, "HEADER 13 - Proportion of apolar alpha sphere : %.4f\n", pocket->pdesc->apolar_asphere_prop) ;
00461 
00462                 vcur = pocket->v_lst->first ;
00463 
00464                 while(vcur){
00465                         write_pqr_vert(f, vcur->vertice) ;
00466 
00467                         vcur = vcur->next ;
00468                 }
00469 
00470                 fprintf(f, "TER\nEND\n") ;
00471                 fclose(f) ;
00472         }
00473         else {
00474                 if(!f) fprintf(stderr, "! The file %s could not be opened!\n", out);
00475                 else fprintf(stderr, "! Invalid pocket to write in write_pocket_pqr !\n");
00476         }
00477 }

void write_pocket_pqr_DB ( const char  out[],
s_pocket pocket 
)

Definition at line 91 of file writepocket.c.

References c_lst_vertices::first, node_vertice::next, s_pocket::v_lst, node_vertice::vertice, and write_pqr_vert().

Referenced by write_each_pocket_for_DB().

00092 {
00093         node_vertice *vcur = NULL ;
00094 
00095         FILE *f = fopen(out, "w") ;
00096         if(f && pocket) {
00097                 vcur = pocket->v_lst->first ;
00098 
00099                 while(vcur){
00100                         write_pqr_vert(f, vcur->vertice) ;
00101 
00102                         vcur = vcur->next ;
00103                 }
00104 
00105                 fprintf(f, "TER\nEND\n") ;
00106                 fclose(f) ;
00107         }
00108         else {
00109                 if(!f) fprintf(stderr, "! The file %s could not be opened!\n", out);
00110                 else fprintf(stderr, "! Invalid pocket to write in write_pocket_pqr !\n");
00111         }
00112 }

void write_pockets_single_pdb ( const char  out[],
s_pdb pdb,
c_lst_pockets pockets 
)

## FUNCTION: write_single_pdb

## SPECIFICATION: Write atoms and vertices given in argument in the following standard v2.2 pdb format.

## PARAMETRES: @ const char out[] : Output file name @ s_pdb *pdb : PDB infos @ c_lst_pockets *pockets : All pockets

## RETURN:

Definition at line 213 of file writepocket.c.

References c_lst_vertices::current, c_lst_pockets::current, c_lst_vertices::first, c_lst_pockets::first, s_pdb::latoms, s_pdb::natoms, node_pocket::next, node_vertice::next, node_pocket::pocket, s_pocket::v_lst, node_vertice::vertice, write_pdb_atoms(), and write_pdb_vert().

Referenced by write_out_fpocket().

00214 {
00215         node_pocket *nextPocket ;
00216         node_vertice *nextVertice ;
00217         FILE *f = fopen(out, "w") ;
00218         if(f) {
00219                 if(pdb) {
00220                         if(pdb->latoms) write_pdb_atoms(f, pdb->latoms, pdb->natoms ) ;
00221                 }
00222 
00223                 if(pockets){
00224                         pockets->current = pockets->first ;
00225 
00226                         while(pockets->current){
00227                                 pockets->current->pocket->v_lst->current = pockets->current->pocket->v_lst->first ;
00228 
00229                                 while(pockets->current->pocket->v_lst->current){
00230                                         write_pdb_vert(f, pockets->current->pocket->v_lst->current->vertice) ;
00231 
00232                                         nextVertice = pockets->current->pocket->v_lst->current->next;
00233                                         pockets->current->pocket->v_lst->current = nextVertice;
00234                                 }
00235 
00236                                 nextPocket=pockets->current->next;
00237                                 pockets->current=nextPocket;
00238                         }
00239                 }
00240 
00241                 fclose(f) ;
00242         }
00243         else {
00244                 fprintf(stderr, "! The file %s could not be opened!\n", out);
00245         }
00246 }

void write_pockets_single_pqr ( const char  out[],
c_lst_pockets pockets 
)

## FUNCTION: write_pockets_single_pqr

## SPECIFICATION: Write only pockets (alpha sphere) given in argument in the pqr format.

!! No atoms writen here, only all pockets in a single pqr file.

## PARAMETRES: @ const char out[] : Output file path @ c_lst_pockets *pockets : List of pockets

## RETURN:

Definition at line 293 of file writepocket.c.

References c_lst_vertices::current, c_lst_pockets::current, c_lst_vertices::first, c_lst_pockets::first, node_pocket::next, node_vertice::next, node_pocket::pocket, s_pocket::v_lst, node_vertice::vertice, and write_pqr_vert().

Referenced by write_out_fpocket().

00294 {
00295         node_pocket *nextPocket ;
00296         node_vertice *nextVertice ;
00297 
00298         FILE *f = fopen(out, "w") ;
00299         if(f) {
00300 
00301                 if(pockets){
00302                 fprintf(f, "HEADER\n") ;
00303                 fprintf(f, "HEADER This is a pqr format file writen by the programm fpocket.                 \n") ;
00304                 fprintf(f, "HEADER It contains all the pockets vertices found by fpocket.                    \n") ;
00305                         pockets->current = pockets->first ;
00306 
00307                         while(pockets->current){
00308                                 pockets->current->pocket->v_lst->current = pockets->current->pocket->v_lst->first ;
00309 
00310                                 while(pockets->current->pocket->v_lst->current){
00311                                         write_pqr_vert(f, pockets->current->pocket->v_lst->current->vertice) ;
00312 
00313                                         nextVertice = pockets->current->pocket->v_lst->current->next;
00314                                         pockets->current->pocket->v_lst->current = nextVertice;
00315                                 }
00316 
00317                                 nextPocket=pockets->current->next;
00318                                 pockets->current=nextPocket;
00319                         }
00320                 }
00321 
00322                 fprintf(f, "TER\nEND\n") ;
00323                 fclose(f) ;
00324         }
00325         else {
00326                 fprintf(stderr, "! The file %s could not be opened!\n", out);
00327         }
00328 }


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