00001 /* 00002 COPYRIGHT DISCLAIMER 00003 00004 Vincent Le Guilloux, Peter Schmidtke and Pierre Tuffery, hereby 00005 disclaim all copyright interest in the program “fpocket” (which 00006 performs protein cavity detection) written by Vincent Le Guilloux and Peter 00007 Schmidtke. 00008 00009 Vincent Le Guilloux 28 November 2008 00010 Peter Schmidtke 28 November 2008 00011 Pierre Tuffery 28 November 2008 00012 00013 GNU GPL 00014 00015 This file is part of the fpocket package. 00016 00017 fpocket is free software: you can redistribute it and/or modify 00018 it under the terms of the GNU General Public License as published by 00019 the Free Software Foundation, either version 3 of the License, or 00020 (at your option) any later version. 00021 00022 fpocket is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 GNU General Public License for more details. 00026 00027 You should have received a copy of the GNU General Public License 00028 along with fpocket. If not, see <http://www.gnu.org/licenses/>. 00029 00030 **/ 00031 00032 00033 #ifndef DH_VORONOI 00034 #define DH_VORONOI 00035 00036 // ---------------------------------INCLUDES----------------------------------*/ 00037 00038 #include <math.h> 00039 #include <stdio.h> 00040 #include <stdlib.h> 00041 #include <string.h> 00042 #include <ctype.h> 00043 #include <sys/types.h> 00044 #include <unistd.h> 00045 00046 #include "rpdb.h" 00047 #include "writepdb.h" 00048 #include "calc.h" 00049 #include "utils.h" 00050 #include "../src/qhull/qvoronoi.h" 00051 00052 #include "memhandler.h" 00053 00054 /* ----------------------------------MACROS--------------------------------- */ 00055 00056 #define M_VORONOI_SUCCESS 0 /**< alpha sphere type - hydrophobic alpha sphere */ 00057 #define M_APOLAR_AS 0 /**< alpha sphere type - hydrophilic alpha sphere */ 00058 #define M_POLAR_AS 1 /**< tolerance for coordinate imprecion during alpha sphere search */ 00059 #define M_PREC_TOLERANCE 1e-5 00060 00061 #define M_BUFSIZE 1e7 /**< buffer size*/ 00062 /* --------------------------------STRUCTURES-------------------------------- */ 00063 00064 /** 00065 Container of the Voronoi vertice 00066 */ 00067 typedef struct s_vvertice 00068 { 00069 int resid ; /**< residue ID*/ 00070 int id, /**< vertice ID*/ 00071 seen, /**< Say if we have seen this vertice during a neighbor search */ 00072 qhullId, /**< ID of the vertice in qhull output*/ 00073 type ; /**< 0 if apolar contacts, 1 if polar */ 00074 00075 float ray ; /**< Ray of voronoi vertice */ 00076 float x, /**< X coord */ 00077 y, /**< Y coord */ 00078 z ; /**< Z coord */ 00079 00080 int sort_x; /**< Index in the sorted tab by X coord */ 00081 int apol_neighbours; /**< number of neighbouring apolar alpha spheres */ 00082 00083 int vneigh[4] ; /**< vertice neighbours (4 contact atoms)*/ 00084 s_atm *neigh[4] ; /**< The theorical 4 contacted atoms */ 00085 00086 float bary[3] ; /**< Barycenter of the pocket */ 00087 00088 } s_vvertice ; 00089 00090 /** 00091 vertice list container 00092 */ 00093 typedef struct s_lst_vvertice 00094 { 00095 s_vvertice *vertices ; /**< List of voronoi vertices */ 00096 s_vvertice **pvertices ; /**< list of pointers to vertices*/ 00097 00098 int *h_tr; /**< translation of voronoi vertice indices*/ 00099 int n_h_tr; /**< size of *h_tr*/ 00100 int *tr, /**< translation of voronoi vertice indices*/ 00101 nvert, /**< no of vertices*/ 00102 qhullSize ; /**< number of vertices in qhull*/ 00103 00104 } s_lst_vvertice ; 00105 00106 /* -----------------------------PROTOTYPES----------------------------------- */ 00107 00108 s_lst_vvertice* load_vvertices(s_pdb *pdb, int min_apol_neigh, 00109 float ashape_min_size, float ashape_max_size) ; 00110 float testVvertice(float xyz[3], int curNbIdx[4], s_atm *atoms, 00111 float min_asph_size, float max_asph_size, 00112 s_lst_vvertice *lvvert); 00113 00114 void set_barycenter(s_vvertice *v) ; 00115 int is_in_lst_vert(s_vvertice **lst_vert, int nb_vert, int v_id) ; 00116 int is_in_lst_vert_p(s_vvertice **lst_vert, int nb_vert, s_vvertice *vert); 00117 00118 void write_pqr_vert(FILE *f, s_vvertice *v) ; 00119 void write_pdb_vert(FILE *f, s_vvertice *v) ; 00120 float get_verts_volume_ptr(s_vvertice **verts, int nvert, int niter,float correct); 00121 00122 void print_vvertices(FILE *f, s_lst_vvertice *lvvert) ; 00123 void free_vert_lst(s_lst_vvertice *lvvert) ; 00124 00125 #endif