Skip to content

Commit

Permalink
Merge pull request #97 from Discngine/mypocket
Browse files Browse the repository at this point in the history
Adding support for definition of explicit pockets
  • Loading branch information
pschmidtke authored Feb 22, 2023
2 parents a0bbee6 + 115128d commit f05cdb7
Show file tree
Hide file tree
Showing 11 changed files with 554 additions and 539 deletions.
3 changes: 2 additions & 1 deletion doc/GETTINGSTARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,11 @@ The simplest way to run fpocket is either by providing a single pdb file, or by
-b (none): (NOT USED BY DEFAULT) This option allows the user to choose a discrete algorithm to calculate the volume of each pocket instead of the Monte Carlo method. This algorithm puts each pocket into a grid of dimension (1/N*X ; 1/N*Y ; 1/N*Z), N being the value given using this option, and X, Y and Z being the box dimensions, determined using coordinates of vertices. Then, a triple iteration on each dimensions is used to estimate the volume, checking if each points given by the iteration is in one of the pocket’s vertices. This parameter defines the grid discretization. If this parameter is used, this algorithm will be used instead of the Monte Carlo algorithm.
Warning: Although this algorithm could be more accurate, a high value might dramatically slow down the program, as this algorithm has a maximum complexity of N*N*N*nb_vertices, and a minimum of N*N*N !!!


-d (none): Option allowing you to output pockets and properties in a condensed format. This will put to the stdout pocket properties in a tab separated string and write pocket files in a subfolder

-r string: (None) This parameter allows you to run fpocket in a restricted mode. Let's suppose you have a very shallow or large pocket with a ligand inside and the automatic pocket prediction always splits up you pocket or you have only a part of the pocket found. Specifying your ligand residue with -r allows you to detect and characterize you ligand binding site explicitly. For instance for `1UYD.pdb` you can specify `-r 1224:PU8:A` (residue number of the ligand: residue name of the ligand: chain of the ligand)

-P string: (None) Binding site delimited by the user through the input. You can inidcate which amino-acids are part of the binding site you'd like to "identify" and calculate descriptors for. fpocket will run its usual alpha-sphere detection and clustering will be guided to collect all alpha spheres in contact with residues of interest. You should enter a string of residues with residue numbers, insertion codes & chain codes: 'residuenumber1:insertioncode1:chaincode1.residuenumber2:insertioncode2:chaincode2.residuenumber3:insertioncode3:chaincode3'. Insertion codes can be empty. `-P 107::A.138::A.51::A.98::A.55::A.93::A` for instance for part of the HSP90 binding site of 4cwr. NB: If you use an mmcif file as input, you need to use the automatically assigned residue number instead of author defined number for this to work.

-y string: (filename) EXPERIMENTAL: here you can specify a topology filename in the Amber prmtop format. This can then be used by fpocket & mdpocket to calculate energy grids for your pockets. NB: you have to specify the -x flag to run energy calculations

Expand Down
3 changes: 1 addition & 2 deletions doc/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,5 @@ If you manage to build for other architectures and it works, I'd be happy to acc

## Read next

* [Getting Started](GETTINGSTARTED.md)
* [Getting Started & Advanced Features](GETTINGSTARTED.md)

* [Advanced Features](ADVANCED.md)
4 changes: 1 addition & 3 deletions doc/INTRODUCTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ We are happy about positive, negative, in any way constructive feedback.

* [Installation](INSTALLATION.md)

* [Getting Started](GETTINGSTARTED.md)

* [Advanced Features](ADVANCED.md)
* [Getting Started](GETTINGSTARTED.md)
194 changes: 101 additions & 93 deletions headers/fparams.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion headers/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
/* ------------------------------- PUBLIC MACROS ---------------------------- */

#define M_MAX_PDB_NAME_LEN 200 /**< maximum pdb filename length*/

#define M_MAX_CUSTOM_PÖCKET_LEN 8000 /** maximum length for a custom pocket string*/
#define M_SIGN 1
#define M_NO_SIGN 0

Expand Down
139 changes: 65 additions & 74 deletions headers/voronoi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
*/


#ifndef DH_VORONOI
#define DH_VORONOI

Expand All @@ -27,7 +26,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include "calc.h"
#include "utils.h"


#include "../src/qhull/src//qvoronoi/qvoronoi.h"
#include "../src/qhull/src/qconvex/qconvex.h"

Expand All @@ -36,126 +34,119 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
/* ----------------------------------MACROS--------------------------------- */

#define M_VORONOI_SUCCESS 0 /**< alpha sphere type - hydrophobic alpha sphere */
#define M_APOLAR_AS 0 /**< alpha sphere type - hydrophilic alpha sphere */
#define M_POLAR_AS 1
#define M_APOLAR_AS 0 /**< alpha sphere type - hydrophilic alpha sphere */
#define M_POLAR_AS 1
#define M_PREC_TOLERANCE 1e-3 /**< tolerance for coordinate imprecion during alpha sphere search*/

#define M_BUFSIZE 1e6 /**< buffer size*/
#define M_N_REPLICAS 1 /**< currently not used anymore : number of times we do the voronoi tesselation for translated coordinates to avoid precision problems with qhull */
#define M_BUFSIZE 1e6 /**< buffer size*/
#define M_N_REPLICAS 1 /**< currently not used anymore : number of times we do the voronoi tesselation for translated coordinates to avoid precision problems with qhull */

/* --------------------------------STRUCTURES-------------------------------- */

/**
Container of the Voronoi vertice
*/
typedef struct s_vvertice
typedef struct s_vvertice
{
int resid ; /**< residue ID*/
int id, /**< vertice ID*/
seen, /**< Say if we have seen this vertice during a neighbor search */
qhullId, /**< ID of the vertice in qhull output*/
type ; /**< 0 if apolar contacts, 1 if polar */

float ray ; /**< Ray of voronoi vertice */
float x, /**< X coord */
y, /**< Y coord */
z ; /**< Z coord */
int sort_x; /**< Index in the sorted tab by X coord */
int apol_neighbours; /**< number of neighbouring apolar alpha spheres */

int vneigh[4] ; /**< vertice neighbours (4 contact atoms)*/
s_atm *neigh[4] ; /**< The theorical 4 contacted atoms */
float bary[3] ; /**< Barycenter of the pocket */
float electrostatic_energy; /**<estimate of electrostatic energy around the alpha sphere */

} s_vvertice ;
int resid; /**< residue ID*/
int id, /**< vertice ID*/
seen, /**< Say if we have seen this vertice during a neighbor search */
qhullId, /**< ID of the vertice in qhull output*/
type; /**< 0 if apolar contacts, 1 if polar */

float ray; /**< Ray of voronoi vertice */
float x, /**< X coord */
y, /**< Y coord */
z; /**< Z coord */

int sort_x; /**< Index in the sorted tab by X coord */
int apol_neighbours; /**< number of neighbouring apolar alpha spheres */

int vneigh[4]; /**< vertice neighbours (4 contact atoms)*/
s_atm *neigh[4]; /**< The theorical 4 contacted atoms */

float bary[3]; /**< Barycenter of the pocket */
float electrostatic_energy; /**<estimate of electrostatic energy around the alpha sphere */

} s_vvertice;

/**
vertice list container
*/
typedef struct s_lst_vvertice
{
s_vvertice *vertices ; /**< List of voronoi vertices */
s_vvertice **pvertices ; /**< list of pointers to vertices*/
s_vvertice *vertices; /**< List of voronoi vertices */
s_vvertice **pvertices; /**< list of pointers to vertices*/

/* Indexes of heavy atoms used as input for qhull in the s_pdb list of atoms */
int *h_tr;
int *h_tr;

/* Size of h_tr */
int n_h_tr;

int *tr, /**< translation of voronoi vertice indices*/
nvert, /**< no of vertices*/
qhullSize ; /**< number of vertices in qhull*/
int n_h_tr;

} s_lst_vvertice ;
int *tr, /**< translation of voronoi vertice indices*/
nvert, /**< no of vertices*/
qhullSize; /**< number of vertices in qhull*/

} s_lst_vvertice;

/**
* clusterlib vertice info container
*/

typedef struct s_clusterlib_vertices
{
double ** pos; /**< Positions (xyz) of Voronoi vertices*/
int ** mask; /**< Mask for position array*/
double weight[3]; /**< column (coordinate weights for distance matrix calculation*/
int transpose; /**< cluster by rows (transpose=0) or column(transpose=1)*/
char dist; /**< char defining distance measure used*/
char method; /**< char defining method used (clustering)*/

double **pos; /**< Positions (xyz) of Voronoi vertices*/
int **mask; /**< Mask for position array*/
double weight[3]; /**< column (coordinate weights for distance matrix calculation*/
int transpose; /**< cluster by rows (transpose=0) or column(transpose=1)*/
char dist; /**< char defining distance measure used*/
char method; /**< char defining method used (clustering)*/


} s_clusterlib_vertices ;
} s_clusterlib_vertices;

/* -----------------------------PROTOTYPES----------------------------------- */

s_lst_vvertice* load_vvertices_DEPRECATED(s_pdb *pdb, int min_apol_neigh,
float ashape_min_size, float ashape_max_size,
float xshift,float yshift, float zshift) ;
s_lst_vvertice* load_vvertices(s_pdb *pdb, int min_apol_neigh, float asph_min_size, float asph_max_size,float xshift,float yshift,float zshift);

s_lst_vvertice *load_vvertices(s_pdb *pdb, s_fparams *params, float xshift, float yshift, float zshift);

void fill_vvertices(s_lst_vvertice *lvvert, const char fpath[], s_atm *atoms, int natoms,
int min_apol_neigh, float asph_min_size, float asph_max_size,
float xshift, float yshift, float zshift,float avg_bfactor,s_pdb *pdb) ;
s_fparams *params,
float xshift, float yshift, float zshift, float avg_bfactor, s_pdb *pdb);


void add_missing_vvertices(s_lst_vvertice *lvvert, const char fpath[], s_atm *atoms,
int min_apol_neigh, float asph_min_size, float asph_max_size,
float xshift, float yshift,float zshift, float avg_bfactor,s_pdb *pdb);
void add_missing_vvertices(s_lst_vvertice *lvvert, const char fpath[], s_atm *atoms,
s_fparams *params,
float xshift, float yshift, float zshift, float avg_bfactor, s_pdb *pdb);

unsigned short check_if_similar_vertice_in_list(s_vvertice *v, s_lst_vvertice *lvvert);
void add_vertice_to_vertice_list(s_lst_vvertice *lvvert,s_vvertice *v);
void copy_vertice(s_vvertice *v1,s_vvertice *v2, int n);
void add_vertice_to_vertice_list(s_lst_vvertice *lvvert, s_vvertice *v);
void copy_vertice(s_vvertice *v1, s_vvertice *v2, int n);

float testVvertice(float xyz[3], int curNbIdx[4], s_atm *atoms,
float min_asph_size, float max_asph_size,
s_lst_vvertice *lvvert,
float xshift, float yshift, float zshift,float avg_bfactor,s_pdb *pdb);
float testVvertice(float xyz[3], int curNbIdx[4], s_atm *atoms,
s_fparams *params,
s_lst_vvertice *lvvert,
float xshift, float yshift, float zshift, float avg_bfactor, s_pdb *pdb);

s_lst_vvertice *compare_vvertice_shifted_lists(s_lst_vvertice *lvvert,
s_lst_vvertice *list_shifted,float xshift,float yshift,float zshift);
float atom_in_explicit_pocket(s_atm *cura, s_fparams *params);

s_lst_vvertice *compare_vvertice_shifted_lists(s_lst_vvertice *lvvert,
s_lst_vvertice *list_shifted, float xshift, float yshift, float zshift);

double **get_3d_array_from_vvertice_list(s_lst_vvertice *lvvert);
s_clusterlib_vertices *prepare_vertices_for_cluster_lib(s_lst_vvertice *lvvert,char c_method,char d_method);
void set_barycenter(s_vvertice *v) ;
int is_in_lst_vert(s_vvertice **lst_vert, int nb_vert, int v_id) ;
s_clusterlib_vertices *prepare_vertices_for_cluster_lib(s_lst_vvertice *lvvert, char c_method, char d_method);
void set_barycenter(s_vvertice *v);
int is_in_lst_vert(s_vvertice **lst_vert, int nb_vert, int v_id);
int is_in_lst_vert_p(s_vvertice **lst_vert, int nb_vert, s_vvertice *vert);

void write_pqr_vert(FILE *f, s_vvertice *v, int i) ;
void write_pdb_vert(FILE *f, s_vvertice *v, int i) ;
void write_pqr_vert(FILE *f, s_vvertice *v, int i);
void write_pdb_vert(FILE *f, s_vvertice *v, int i);
void write_mmcif_vert(FILE *f, s_vvertice *v, int i);
float get_verts_volume_ptr(s_vvertice **verts, int nvert, int niter,float correct);
float get_verts_volume_ptr(s_vvertice **verts, int nvert, int niter, float correct);
float get_convex_hull_volume(s_vvertice **verts, int nvert);

void print_vvertices(FILE *f, s_lst_vvertice *lvvert) ;
void free_vert_lst(s_lst_vvertice *lvvert) ;
void print_vvertices(FILE *f, s_lst_vvertice *lvvert);
void free_vert_lst(s_lst_vvertice *lvvert);

void transferClustersToVertices(int **clusterIds,s_lst_vvertice *lvert);
void transferClustersToVertices(int **clusterIds, s_lst_vvertice *lvert);

double frand_a_b(double a, double b);
int free_cluster_lib_vertices(s_clusterlib_vertices *clusterlib_vertices, int nvert);
Expand Down
Loading

0 comments on commit f05cdb7

Please sign in to comment.