Go to the documentation of this file.
5 #ifndef BALL_DOCKING_POSECLUSTERING_H
6 #define BALL_DOCKING_POSECLUSTERING_H
8 #ifndef BALL_DATATYPE_OPTIONS_H
12 #ifndef BALL_DOCKING_COMMON_CONFORMATIONSET_H
16 #ifndef BALL_MOLMEC_COMMON_SNAPSHOT_H
20 #ifndef BALL_STRUCTURE_ATOMBIJECTION_H
24 #ifndef BALL_KERNEL_SYSTEM_H
28 #ifndef BALL_DATATYPE_STRING_H
32 #ifndef BALL_MATHS_VECTOR3_H
36 #ifndef BALL_MATHS_MATRIX44_H
42 #include <boost/shared_ptr.hpp>
43 #include <boost/variant.hpp>
48 #ifndef BALL_HAS_NOEXCEPT
49 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
50 # include <boost/graph/adjacency_list.hpp>
51 # undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
53 # include <boost/graph/adjacency_list.hpp>
60 # include <tbb/parallel_reduce.h>
61 # include <tbb/blocked_range.h>
65 #undef POSECLUSTERING_DEBUG
172 CENTER_OF_MASS_DISTANCE
181 PROPERTY_BASED_ATOM_BIJECTION
199 : translation(new_trans),
241 template <class Archive>
242 void serialize(Archive& ar, const
unsigned int version);
265 #ifdef POSECLUSTERING_DEBUG
268 float current_cluster_id;
272 typedef boost::adjacency_list<boost::vecS,
397 std::vector<PosePointer>
const&
getPoses()
const {
return poses_;}
448 static float getRigidRMSD(Eigen::Vector3f
const& t_ab, Eigen::Matrix3f
const& M_ab, Eigen::Matrix3f
const& covariance_matrix);
455 static float getSquaredRigidRMSD(Eigen::Vector3f
const& t_ab, Eigen::Matrix3f
const& M_ab, Eigen::Matrix3f
const& covariance_matrix);
516 class ComputeNearestClusterTask_
521 const std::vector<ClusterTreeNode>& active_clusters,
526 ComputeNearestClusterTask_(ComputeNearestClusterTask_& cnct, tbb::split);
529 void join(ComputeNearestClusterTask_
const& cnct);
532 void operator() (
const tbb::blocked_range<size_t>& r);
535 Position getMinIndex() {
return my_min_index_;}
538 float getMinValue() {
return my_min_value_;}
542 PoseClustering* parent_;
545 const std::vector<ClusterTreeNode>& active_clusters_;
567 : cluster_tree_(cluster_tree)
582 : cluster_tree_(&cluster_tree)
587 float first_value = (*cluster_tree_)[ first].merged_at;
588 float second_value = (*cluster_tree_)[second].merged_at;
590 return first_value < second_value;
744 #endif // BALL_DOCKING_POSECLUSTERING_H
ClusterProperties(const ClusterProperties &)
boost::shared_ptr< ConformationSet > getReducedConformationSet()
returns a ConformationSet containing one structure per cluster
std::vector< double > mu_
Size getNumberOfPoses() const
returns the number of poses
void convertTransformations2Snaphots()
convert the poses to SnapShots
void printClusterScores(std::ostream &out=std::cout)
float computeCompleteLinkageRMSD(Index i, Options options, bool initialize=true)
returns the complete linkage RMSD of cluster i
void computeCenterOfMasses_()
PosePointer(RigidTransformation const *new_trafo, SnapShot const *new_snap=0)
bool nearestNeighborChainCompute_()
ClusterProperties & operator=(const ClusterProperties &)
void slinkInner_(int current_level)
AtomBijection atom_bijection_
const std::vector< RigidTransformation > & getRigidTransformations() const
returns the poses as rigid transformations
void deserializeWardClusterTree(std::istream &in, bool binary=false)
SnapShot base_conformation_
Computation of clusters of docking poses.
static const float DISTANCE_THRESHOLD
void initWardDistance_(Index rmsd_type)
void updateWardDistance_(ClusterTreeNode parent, ClusterTreeNode i, ClusterTreeNode j, Index rmsd_type)
bool refineClustering(Options const &refined_options)
bool delete_conformation_set_
void setBaseSystemAndPoses(System const &base_system, std::vector< PosePointer > const &poses)
std::vector< Vector3 > & getCentersOfMass()
returns the centers of mass-vector (non-empty only for CENTER_OF_MASS_DISTANCE)
PoseClustering(ConformationSet *poses, float rmsd)
static const bool USE_CENTER_OF_MASS_PRECLINK
static float getRigidRMSD(Eigen::Vector3f const &t_ab, Eigen::Matrix3f const &M_ab, Eigen::Matrix3f const &covariance_matrix)
System & getSystem()
returns the reference pose
const std::set< Index > & getCluster(Index i) const
float getClusterRMSD_(Index i, Index j, Index rmsd_type)
AtomBijection & getAtomBijection()
returns a reference to the cached AtomBijection
void printClusters(std::ostream &out=std::cout) const
Size getClusterSize(Index i) const
returns the size of cluster i
bool linearSpaceCompute_()
void exportWardClusterTreeToGraphViz(std::ostream &out)
static const Index RMSD_LEVEL_OF_DETAIL
virtual ~PoseClustering()
void applyTransformation2System(Index i, System &target_system)
apply a transformation to a given system
std::vector< float > cluster_scores_
the scores of the clusters
void exportToJSONDFS_(ClusterTreeNode const ¤t, String &result)
void printCluster_(Size i, std::ostream &out=std::cout) const
static const String RMSD_LEVEL_OF_DETAIL
Eigen::MatrixXd pairwise_scores_
std::set< Index > collectClusterBelow_(ClusterTreeNode const &v)
std::vector< Vector3 > const & getCentersOfMass() const
returns the centers of mass-vector, const version (non-empty only for CENTER_OF_MASS_DISTANCE)
static const String RUN_PARALLEL
std::vector< std::set< Index > > filterClusters(Size min_size=1)
float getClusterScore(Index i) const
returns the score of cluster i
static const Index RMSD_TYPE
const System & getSystem() const
returns the reference pose
std::vector< PosePointer > poses_
Eigen::Matrix3f covariance_matrix_
static const bool RUN_PARALLEL
std::vector< std::set< Index > > extractClustersForThreshold(float threshold, Size min_size=0)
ClusterTree const * cluster_tree_
BALL_EXTERN_VARIABLE const double c
PosePointer(SnapShot const *new_snap)
RigidTransformation(Eigen::Vector3f const &new_trans, Eigen::Matrix3f const &new_rot)
static Eigen::Matrix3f computeCovarianceMatrix(System const &system, Index rmsd_level_of_detail=C_ALPHA)
void precomputeAtomBijection_()
void convertSnaphots2Transformations()
convert the poses to rigid transformations
static const Index CLUSTER_METHOD
static const String DISTANCE_THRESHOLD
ClusterTreeWriter_(ClusterTree const *cluster_tree)
std::vector< PosePointer > const & getPoses() const
returns poses as PosePointer
boost::shared_ptr< System > getClusterRepresentative(Index i)
returns the "central cluster" conformation of cluster i as system
std::vector< Index > cluster_representatives_
void printVariables_(int a, int b, double c, int d, double e, int current_level)
NEAREST_NEIGHBOR_CHAIN_WARD
boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, ClusterProperties, boost::no_property, unsigned int > ClusterTree
static const String RMSD_TYPE
static float getSquaredRigidRMSD(Eigen::Vector3f const &t_ab, Eigen::Matrix3f const &M_ab, Eigen::Matrix3f const &covariance_matrix)
void exportClusterTreeToJSON(std::ostream &out)
ConformationSet * getConformationSet()
returns the poses to be clustered as ConformationSet
std::set< Index > & getCluster(Index i)
ClusterProperties(ClusterProperties &&) BALL_NOEXCEPT
std::vector< std::set< Index > > clusters_
the clusters: sets of pose indices
PoseClustering(System const &base_system, String transformation_file_name)
PoseClustering for a given set of rigid transformations of a base structure.
boost::shared_ptr< System > getPose(Index i) const
returns the complete linkage RMSD of a pose set
void storeSnapShotReferences_()
void serializeWardClusterTree(std::ostream &out, bool binary=false)
static const String CLUSTER_METHOD
Default values for options.
float computeWardDistance_(ClusterTreeNode i, ClusterTreeNode j, Index rmsd_type)
bool readTransformationsFromFile_(String filename)
std::vector< std::set< Index > > extractNBestClusters(Size n)
void setBaseSystemAndTransformations(System const &base_system, String transformation_file_name)
RigidTransformation const * trafo
void setConformationSet(ConformationSet *new_set, bool precompute_atombijection=false)
sets the poses to be clustered, the conformation set's reference system will the base system
std::vector< RigidTransformation > transformations_
Index rmsd_level_of_detail_
the RMSD definition used for clustering
static bool isExcludedByLevelOfDetail_(Atom const *atom, Index rmsd_level_of_detail)
AtomBijection const & getAtomBijection() const
returns a const reference to the cached AtomBijection
Index findClusterRepresentative(Index i)
returns the index of the cluster representative
ConformationSet * current_set_
the ConformationSet we wish to cluster
float getRMSD_(Index i, Index j, Index rmsd_type)
BALL_CREATE(PoseClustering)
boost::shared_ptr< ConformationSet > getClusterConformationSet(Index i)
returns cluster i as ConformationSet
ClusterTree::vertex_descriptor ClusterTreeNode
ClusterTree * cluster_tree_
Size number_of_selected_atoms_
Size getNumberOfClusters() const
returns the number of clusters found
Eigen::Vector3f translation
PoseClustering()
Default constructor.
ClusterTree cluster_tree_
The tree built during hierarchical clustering.
bool has_rigid_transformations_
float getScore(const System sys_a, const System sys_b, Options options) const
returns the score between two poses given as systems
std::vector< Vector3 > com_
ClusterTreeNodeComparator(ClusterTree &cluster_tree)
std::vector< double > lambda_
void clinkInner_(int current_level)
const ConformationSet * getConformationSet() const
returns the poses to be clustered as ConformationSet