Loading...
Searching...
No Matches
geometricFit.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_DOCKING_GEOMETRICFIT_H
#define BALL_DOCKING_GEOMETRICFIT_H
#ifndef BALL_DATATYPE_REGULARDATA3D_H
#include <BALL/DATATYPE/regularData3D.h>
#endif
#ifndef BALL_KERNEL_SYSTEM_H
#include <BALL/KERNEL/system.h>
#endif
#ifndef BALL_MATHS_COMPLEX_H
#include <BALL/MATHS/complex.h>
#endif
#ifndef BALL_MATHS_FFT3D_H
#include <BALL/MATHS/FFT3D.h>
#endif
#ifndef BALL_DOCKING_COMMON_DOCKINGALGORITHM_H
#include <BALL/DOCKING/COMMON/dockingAlgorithm.h>
#endif
namespace BALL
{
class BALL_EXPORT GeometricFit
: public DockingAlgorithm
{
public:
BALL_CREATE(GeometricFit)
struct BALL_EXPORT Option
{
// the parameter r,
// "Any grid point is considered inside the molecule if there is at
// least one atom nucleus within a distance r from it."
// Default value is 1.8 Angstrom
static const String NEAR_RADIUS;
// Default grid spacing.
// Default value is 1.0 Angstrom
static const String GRID_SPACING;
// grid size = (ceil)(molecule size / grid spacing);
static const String GRID_SIZE;
// The thickness of the surface of the protein
// Default value is 1.0 Angstrom
static const String SURFACE_THICKNESS;
// Degree interval is the delta parameter,
// which is the degrees that protein B rotates every time
// Default value is 20 degrees
static const String DEGREE_INTERVAL;
// How many peaks should the program keep for each rotation
static const String TOP_N;
static const String SURFACE_TYPE;
// How many results should be kept in total (also in DockingAlgorithms)
static const String BEST_NUM;
// Verbosity of the Algorithm (also in DockingAlgorithm)
static const String VERBOSITY;
// Euler angels for redocking
static const String PHI_MIN;
static const String PHI_MAX;
static const String DEG_PHI;
static const String THETA_MIN;
static const String THETA_MAX;
static const String DEG_THETA;
static const String PSI_MIN;
static const String PSI_MAX;
static const String DEG_PSI;
// penalty value of the inside points
// Default value for static protein is -15, for mobile protein 1
static const String PENALTY_STATIC;
static const String PENALTY_MOBILE;
// Number of processes in total for a parallel run
static const String NUMBER_OF_PROCESSES;
// Full path to the slave to spawn
static const String SLAVE_PATH;
};
struct BALL_EXPORT Default
{
// Default parameter r,
// Default value is 1.8 Angstrom
static const float NEAR_RADIUS;
// Default grid spacing.
// Default value is 1.0 Angstrom
static const float GRID_SPACING;
// grid size = (ceil)(molecule size / grid spacing);
static const int GRID_SIZE;
// Default thickness of the surface of the protein
// Default value is 1.0 Angstrom
static const float SURFACE_THICKNESS;
// Degree interval is the delta parameter,
// which is the degrees that protein B rotates every time
// Default value is 20 degrees
static const double DEGREE_INTERVAL;
static const int SURFACE_TYPE;
// How many peaks should the program keep for each rotation
static const int TOP_N;
// How many overall top best peaks should the program keep
// after doing all rotations.
static const int BEST_NUM;
// Verbosity of the algorithm
// Default value is 0
// For values > 1, some information is printed on Log
// For values > 5, timing information is included
static const int VERBOSITY;
// Euler angels for redocking
static const float PHI_MIN;
static const float PHI_MAX;
static const float DEG_PHI;
static const float THETA_MIN;
static const float THETA_MAX;
static const float DEG_THETA;
static const float PSI_MIN;
static const float PSI_MAX;
static const float DEG_PSI;
// penalty value of the inside points
// Default value for static protein is -15, for mobile protein 1
static const int PENALTY_STATIC;
static const int PENALTY_MOBILE;
// number of processes for a parallel run
static const int NUMBER_OF_PROCESSES;
// Full path to the slave to spawn
static const String SLAVE_PATH;
};
class BALL_EXPORT Peak_
{
public:
// constructor
Peak_();
// destructor
~Peak_();
// Operator <
bool operator < (const Peak_& p) const;
double value;
Vector3 orientation;
Vector3 translation;
};
class BALL_EXPORT RotationAngles_
{
public:
// constructor
RotationAngles_();
// constructor
RotationAngles_( int step );
// destructor
~RotationAngles_() {};
// generate all non-degenerate rotation angles.
// This algorithm is based on ???
bool generateSomeAngles( const float deg_phi, const float deg_psi, const float deg_theta,
const float phi_min, const float phi_max,
const float psi_min, const float psi_max,
const float theta_min, const float theta_max );
// generate all non-degenerate rotation angles.
// This algorithm is based on ???
bool generateAllAngles( const int deg );
int getRotationNum()
{
return ang_num_;
}
int getXAng( int n ) // get the euler angle rotate around x axis
{
return phi_[n];
}
int getYAng( int n ) // get the euler angle rotate around y axis
{
return theta_[n];
}
int getZAng( int n ) // get the euler angle rotate around z axis
{
return psi_[n];
}
// TODO: This class is a bit strange...
vector<int> phi_;
vector<int> theta_;
vector<int> psi_;
private:
int ang_num_;
int max_rotation_;
};
// PROTEIN_A is the static protein, i.e., the bigger one;
// PROTEIN_B is the mobile protein, i.e., the smaller one.
enum ProteinIndex{ PROTEIN_A = 1, PROTEIN_B = 2 };
// The surface type to use for construction of the grids.
enum SurfaceType { CONNOLLY = 1, VAN_DER_WAALS = 2, FTDOCK = 3 };
GeometricFit();
GeometricFit(System &system1, System &system2);
GeometricFit(Options& new_options);
GeometricFit(System &system1,System &system2 ,Options& new_options);
GeometricFit( const GeometricFit& geo_fit );
// Destructor
~GeometricFit();
virtual void setup(System& system1, System& system2, Options& new_options);
virtual void setup(System& system1, System& system2);
void start();
#ifdef BALL_HAS_MPI
void MPI_Slave_start(int argc, char**argv);
#endif
// return the overall docking progress as a percentage
float getProgress() const;
//
bool hasFinished() const;
Vector3 getTranslation(Index con_num) const;
Vector3 getOrientation(Index con_num) const;
ConformationSet getConformationSet(Index total_number = 0);
// the member variables
Options options;
protected:
// Free all allocated memory and destroys the options and results
void destroy_();
// find the inside points
void findInsidePoints_( System& system, ProteinIndex pro_idx );
// find out the surface points according to the Connolly's surface definition.
void findConnollySurfacePoints_( System& system, ProteinIndex pro_idx );
// find out the surface points according to the van der Waal's surface definition.
void findVanDerWaalsSurfacePoints_( System& system, ProteinIndex pro_idx );
// find the inside points using the same algorithm as FTDock
void findFTDockInsidePoints_( System& system, ProteinIndex pro_idx );
// find out the surface points according to the FTDock surface definition.
void findFTDockSurfacePoints_( System& system, ProteinIndex pro_idx );
Vector3 getMassCenter_( System& system );
float getRadius_( System& system );
void doPreTranslation_( ProteinIndex pro_idx );
void initGridSizes_();
int optimizeGridSize_( int raw_size );
void initFFTGrid_( ProteinIndex pro_idx );
// make grid from System
void makeFFTGrid_( ProteinIndex pro_idx );
// get the global peaks and put them into a list
void getGlobalPeak_(Peak_* peak_list);
// change the orientation of protein around its center according to euler_ang
void changeProteinOrientation_( System& system, Vector3 euler_ang );
// calculate the conjugate of each point in FFT grid
void calcConjugate_( ProteinIndex pro_idx );
// calculate the product of the two FFT grids
void FFTGridMulti_();
// get the transformation of the peak value according to its position in matrix
Vector3 getTranslation_( const Vector3& mat_pos );
Vector3 getSeparation_( const Vector3& mat_pos );
// here we have two units for the size
// index : in the unit of grid points
// coord : in the unit of Angstrom
// the FFT grid for protein A
FFT3D* FFT_grid_a_;
// the FFT grid for protein B
FFT3D* FFT_grid_b_;
float radius_a_;
float radius_b_;
Vector3 FFT_grid_lower_index_;
Vector3 FFT_grid_upper_index_;
Vector3 FFT_grid_lower_coord_;
Vector3 FFT_grid_upper_coord_;
Vector3 FFT_grid_size_index_;
// the translation we do to the system b before FFT
// it is to reduse the size of the FFT_grid
Vector3 pre_translation_a_;
Vector3 pre_translation_b_;
Vector3 FFT_grid_origin_;
// current execution progress
int current_round_;
// execution round of whole work
int total_round_;
// ordered set of the top_n peaks
std::multiset<Peak_> peak_set_;
// Needed to produce the correct results in getRankedConformations
System system_backup_a_;
System system_backup_b_;
// Vectors to store orientation and translation of the results in the ranked conformations
vector<Vector3> translations_;
vector<Vector3> orientations_;
}; // class GeometricFit
} // namespace BALL
#endif
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
FFT3D.h
system.h
BALL::ConformationSet
Definition conformationSet.h:33
BALL::DockingAlgorithm::DockingAlgorithm
DockingAlgorithm()
BALL::GeometricFit::Peak_
Definition geometricFit.h:183
BALL::GeometricFit::Peak_::value
double value
Definition geometricFit.h:195
BALL::GeometricFit::Peak_::orientation
Vector3 orientation
Definition geometricFit.h:196
BALL::GeometricFit::Peak_::translation
Vector3 translation
Definition geometricFit.h:197
BALL::GeometricFit::Peak_::Peak_
Peak_()
BALL::GeometricFit::Peak_::~Peak_
~Peak_()
BALL::GeometricFit::RotationAngles_::generateSomeAngles
bool generateSomeAngles(const float deg_phi, const float deg_psi, const float deg_theta, const float phi_min, const float phi_max, const float psi_min, const float psi_max, const float theta_min, const float theta_max)
BALL::GeometricFit::RotationAngles_::~RotationAngles_
~RotationAngles_()
Definition geometricFit.h:213
BALL::GeometricFit::RotationAngles_::phi_
vector< int > phi_
Definition geometricFit.h:247
BALL::GeometricFit::RotationAngles_::RotationAngles_
RotationAngles_(int step)
BALL::GeometricFit::RotationAngles_::getZAng
int getZAng(int n)
Definition geometricFit.h:241
BALL::GeometricFit::RotationAngles_::theta_
vector< int > theta_
Definition geometricFit.h:248
BALL::GeometricFit::RotationAngles_::getXAng
int getXAng(int n)
Definition geometricFit.h:231
BALL::GeometricFit::RotationAngles_::getYAng
int getYAng(int n)
Definition geometricFit.h:236
BALL::GeometricFit::RotationAngles_::generateAllAngles
bool generateAllAngles(const int deg)
BALL::GeometricFit::RotationAngles_::psi_
vector< int > psi_
Definition geometricFit.h:249
BALL::GeometricFit::RotationAngles_::getRotationNum
int getRotationNum()
Definition geometricFit.h:226
BALL::GeometricFit::RotationAngles_::RotationAngles_
RotationAngles_()
BALL::GeometricFit::GeometricFit
GeometricFit(System &system1, System &system2, Options &new_options)
BALL::GeometricFit::FFT_grid_upper_index_
Vector3 FFT_grid_upper_index_
Definition geometricFit.h:414
BALL::GeometricFit::GeometricFit
GeometricFit()
BALL::GeometricFit::findInsidePoints_
void findInsidePoints_(System &system, ProteinIndex pro_idx)
BALL::GeometricFit::destroy_
void destroy_()
BALL::GeometricFit::changeProteinOrientation_
void changeProteinOrientation_(System &system, Vector3 euler_ang)
BALL::GeometricFit::getConformationSet
ConformationSet getConformationSet(Index total_number=0)
BALL::GeometricFit::getMassCenter_
Vector3 getMassCenter_(System &system)
BALL::GeometricFit::GeometricFit
GeometricFit(const GeometricFit &geo_fit)
BALL::GeometricFit::getSeparation_
Vector3 getSeparation_(const Vector3 &mat_pos)
BALL::GeometricFit::pre_translation_b_
Vector3 pre_translation_b_
Definition geometricFit.h:423
BALL::GeometricFit::FFT_grid_lower_coord_
Vector3 FFT_grid_lower_coord_
Definition geometricFit.h:415
BALL::GeometricFit::start
void start()
BALL::GeometricFit::FFT_grid_lower_index_
Vector3 FFT_grid_lower_index_
Definition geometricFit.h:413
BALL::GeometricFit::initFFTGrid_
void initFFTGrid_(ProteinIndex pro_idx)
BALL::GeometricFit::calcConjugate_
void calcConjugate_(ProteinIndex pro_idx)
BALL::GeometricFit::optimizeGridSize_
int optimizeGridSize_(int raw_size)
BALL::GeometricFit::findConnollySurfacePoints_
void findConnollySurfacePoints_(System &system, ProteinIndex pro_idx)
BALL::GeometricFit::SurfaceType
SurfaceType
Definition geometricFit.h:261
BALL::GeometricFit::FTDOCK
@ FTDOCK
Definition geometricFit.h:261
BALL::GeometricFit::VAN_DER_WAALS
@ VAN_DER_WAALS
Definition geometricFit.h:261
BALL::GeometricFit::CONNOLLY
@ CONNOLLY
Definition geometricFit.h:261
BALL::GeometricFit::total_round_
int total_round_
Definition geometricFit.h:431
BALL::GeometricFit::GeometricFit
GeometricFit(System &system1, System &system2)
BALL::GeometricFit::initGridSizes_
void initGridSizes_()
BALL::GeometricFit::FFT_grid_size_index_
Vector3 FFT_grid_size_index_
Definition geometricFit.h:418
BALL::GeometricFit::FFT_grid_a_
FFT3D * FFT_grid_a_
Definition geometricFit.h:405
BALL::GeometricFit::radius_b_
float radius_b_
Definition geometricFit.h:411
BALL::GeometricFit::findFTDockInsidePoints_
void findFTDockInsidePoints_(System &system, ProteinIndex pro_idx)
BALL::GeometricFit::system_backup_a_
System system_backup_a_
Definition geometricFit.h:437
BALL::GeometricFit::getRadius_
float getRadius_(System &system)
BALL::GeometricFit::pre_translation_a_
Vector3 pre_translation_a_
Definition geometricFit.h:422
BALL::GeometricFit::peak_set_
std::multiset< Peak_ > peak_set_
Definition geometricFit.h:434
BALL::GeometricFit::makeFFTGrid_
void makeFFTGrid_(ProteinIndex pro_idx)
BALL::GeometricFit::FFTGridMulti_
void FFTGridMulti_()
BALL::GeometricFit::getTranslation
Vector3 getTranslation(Index con_num) const
BALL::GeometricFit::radius_a_
float radius_a_
Definition geometricFit.h:410
BALL::GeometricFit::~GeometricFit
~GeometricFit()
BALL::GeometricFit::findFTDockSurfacePoints_
void findFTDockSurfacePoints_(System &system, ProteinIndex pro_idx)
BALL::GeometricFit::translations_
vector< Vector3 > translations_
Definition geometricFit.h:441
BALL::GeometricFit::doPreTranslation_
void doPreTranslation_(ProteinIndex pro_idx)
BALL::GeometricFit::FFT_grid_upper_coord_
Vector3 FFT_grid_upper_coord_
Definition geometricFit.h:416
BALL::GeometricFit::hasFinished
bool hasFinished() const
BALL::GeometricFit::GeometricFit
GeometricFit(Options &new_options)
BALL::GeometricFit::current_round_
int current_round_
Definition geometricFit.h:428
BALL::GeometricFit::options
Options options
Definition geometricFit.h:334
BALL::GeometricFit::setup
virtual void setup(System &system1, System &system2, Options &new_options)
BALL::GeometricFit::ProteinIndex
ProteinIndex
Definition geometricFit.h:258
BALL::GeometricFit::PROTEIN_A
@ PROTEIN_A
Definition geometricFit.h:258
BALL::GeometricFit::PROTEIN_B
@ PROTEIN_B
Definition geometricFit.h:258
BALL::GeometricFit::orientations_
vector< Vector3 > orientations_
Definition geometricFit.h:442
BALL::GeometricFit::system_backup_b_
System system_backup_b_
Definition geometricFit.h:438
BALL::GeometricFit::getGlobalPeak_
void getGlobalPeak_(Peak_ *peak_list)
BALL::GeometricFit::setup
virtual void setup(System &system1, System &system2)
BALL::GeometricFit::FFT_grid_origin_
Vector3 FFT_grid_origin_
Definition geometricFit.h:425
BALL::GeometricFit::FFT_grid_b_
FFT3D * FFT_grid_b_
Definition geometricFit.h:408
BALL::GeometricFit::findVanDerWaalsSurfacePoints_
void findVanDerWaalsSurfacePoints_(System &system, ProteinIndex pro_idx)
BALL::GeometricFit::getTranslation_
Vector3 getTranslation_(const Vector3 &mat_pos)
BALL::GeometricFit::getProgress
float getProgress() const
BALL::GeometricFit::getOrientation
Vector3 getOrientation(Index con_num) const
BALL::Options
Definition options.h:48
BALL::String
Definition string.h:57
BALL::System
Definition KERNEL/system.h:40
complex.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
dockingAlgorithm.h
BALL
Definition constants.h:13
BALL::FFT3D
TFFT3D< BALL_FFTW_DEFAULT_TRAITS > FFT3D
Definition FFT3D.h:347
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
regularData3D.h
BALL::GeometricFit::Default
Definition geometricFit.h:114
BALL::GeometricFit::Default::SURFACE_THICKNESS
static const float SURFACE_THICKNESS
Definition geometricFit.h:128
BALL::GeometricFit::Default::THETA_MIN
static const float THETA_MIN
Definition geometricFit.h:158
BALL::GeometricFit::Default::GRID_SPACING
static const float GRID_SPACING
Definition geometricFit.h:121
BALL::GeometricFit::Default::BEST_NUM
static const int BEST_NUM
Definition geometricFit.h:145
BALL::GeometricFit::Default::NUMBER_OF_PROCESSES
static const int NUMBER_OF_PROCESSES
Definition geometricFit.h:172
BALL::GeometricFit::Default::PSI_MAX
static const float PSI_MAX
Definition geometricFit.h:163
BALL::GeometricFit::Default::TOP_N
static const int TOP_N
Definition geometricFit.h:141
BALL::GeometricFit::Default::VERBOSITY
static const int VERBOSITY
Definition geometricFit.h:151
BALL::GeometricFit::Default::GRID_SIZE
static const int GRID_SIZE
Definition geometricFit.h:124
BALL::GeometricFit::Default::DEGREE_INTERVAL
static const double DEGREE_INTERVAL
Definition geometricFit.h:133
BALL::GeometricFit::Default::PENALTY_STATIC
static const int PENALTY_STATIC
Definition geometricFit.h:168
BALL::GeometricFit::Default::PSI_MIN
static const float PSI_MIN
Definition geometricFit.h:162
BALL::GeometricFit::Default::DEG_PHI
static const float DEG_PHI
Definition geometricFit.h:156
BALL::GeometricFit::Default::DEG_THETA
static const float DEG_THETA
Definition geometricFit.h:160
BALL::GeometricFit::Default::PHI_MAX
static const float PHI_MAX
Definition geometricFit.h:155
BALL::GeometricFit::Default::PHI_MIN
static const float PHI_MIN
Definition geometricFit.h:154
BALL::GeometricFit::Default::DEG_PSI
static const float DEG_PSI
Definition geometricFit.h:164
BALL::GeometricFit::Default::PENALTY_MOBILE
static const int PENALTY_MOBILE
Definition geometricFit.h:169
BALL::GeometricFit::Default::SURFACE_TYPE
static const int SURFACE_TYPE
Definition geometricFit.h:138
BALL::GeometricFit::Default::SLAVE_PATH
static const String SLAVE_PATH
Definition geometricFit.h:175
BALL::GeometricFit::Default::NEAR_RADIUS
static const float NEAR_RADIUS
Definition geometricFit.h:117
BALL::GeometricFit::Default::THETA_MAX
static const float THETA_MAX
Definition geometricFit.h:159
BALL::GeometricFit::Option
Definition geometricFit.h:48
BALL::GeometricFit::Option::GRID_SIZE
static const String GRID_SIZE
Definition geometricFit.h:60
BALL::GeometricFit::Option::DEGREE_INTERVAL
static const String DEGREE_INTERVAL
Definition geometricFit.h:69
BALL::GeometricFit::Option::NUMBER_OF_PROCESSES
static const String NUMBER_OF_PROCESSES
Definition geometricFit.h:107
BALL::GeometricFit::Option::THETA_MIN
static const String THETA_MIN
Definition geometricFit.h:93
BALL::GeometricFit::Option::DEG_THETA
static const String DEG_THETA
Definition geometricFit.h:95
BALL::GeometricFit::Option::PHI_MIN
static const String PHI_MIN
Definition geometricFit.h:89
BALL::GeometricFit::Option::THETA_MAX
static const String THETA_MAX
Definition geometricFit.h:94
BALL::GeometricFit::Option::TOP_N
static const String TOP_N
Definition geometricFit.h:72
BALL::GeometricFit::Option::DEG_PHI
static const String DEG_PHI
Definition geometricFit.h:91
BALL::GeometricFit::Option::PSI_MAX
static const String PSI_MAX
Definition geometricFit.h:98
BALL::GeometricFit::Option::DEG_PSI
static const String DEG_PSI
Definition geometricFit.h:99
BALL::GeometricFit::Option::GRID_SPACING
static const String GRID_SPACING
Definition geometricFit.h:57
BALL::GeometricFit::Option::PENALTY_MOBILE
static const String PENALTY_MOBILE
Definition geometricFit.h:104
BALL::GeometricFit::Option::BEST_NUM
static const String BEST_NUM
Definition geometricFit.h:83
BALL::GeometricFit::Option::SLAVE_PATH
static const String SLAVE_PATH
Definition geometricFit.h:110
BALL::GeometricFit::Option::PENALTY_STATIC
static const String PENALTY_STATIC
Definition geometricFit.h:103
BALL::GeometricFit::Option::PHI_MAX
static const String PHI_MAX
Definition geometricFit.h:90
BALL::GeometricFit::Option::PSI_MIN
static const String PSI_MIN
Definition geometricFit.h:97
BALL::GeometricFit::Option::NEAR_RADIUS
static const String NEAR_RADIUS
Definition geometricFit.h:53
BALL::GeometricFit::Option::SURFACE_TYPE
static const String SURFACE_TYPE
Definition geometricFit.h:80
BALL::GeometricFit::Option::VERBOSITY
static const String VERBOSITY
Definition geometricFit.h:86
BALL::GeometricFit::Option::SURFACE_THICKNESS
static const String SURFACE_THICKNESS
Definition geometricFit.h:64