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);
260 boost::variant<Eigen::VectorXf, RigidTransformation>
center;
265 #ifdef POSECLUSTERING_DEBUG
268 float current_cluster_id;
272 typedef boost::adjacency_list<boost::vecS,
315 void setConformationSet(
ConformationSet* new_set,
bool precompute_atombijection =
false);
321 void setBaseSystemAndPoses(
System const& base_system, std::vector<PosePointer>
const& poses);
326 void setBaseSystemAndTransformations(
System const& base_system,
String transformation_file_name);
344 const System& getSystem()
const;
357 const std::set<Index>& getCluster(
Index i)
const;
361 std::set<Index>& getCluster(
Index i);
367 float getClusterScore(
Index i)
const;
379 void applyTransformation2System(
Index i,
System& target_system);
382 void convertTransformations2Snaphots();
385 void convertSnaphots2Transformations();
388 float computeCompleteLinkageRMSD(
Index i,
Options options,
bool initialize =
true);
394 boost::shared_ptr<System> getPose(
Index i)
const;
397 std::vector<PosePointer>
const&
getPoses()
const {
return poses_;}
400 boost::shared_ptr<System> getClusterRepresentative(
Index i);
406 boost::shared_ptr<ConformationSet> getClusterConformationSet(
Index i);
409 boost::shared_ptr<ConformationSet> getReducedConformationSet();
424 bool refineClustering(
Options const& refined_options);
436 void setDefaultOptions();
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);
459 static Eigen::Matrix3f computeCovarianceMatrix(
System const& system,
Index rmsd_level_of_detail =
C_ALPHA);
471 std::vector<std::set<Index> > extractClustersForThreshold(
float threshold,
Size min_size = 0);
476 std::vector<std::set<Index> > extractNBestClusters(
Size n);
481 std::vector<std::set<Index> > filterClusters(
Size min_size = 1);
485 void serializeWardClusterTree(std::ostream& out,
bool binary =
false);
489 void deserializeWardClusterTree(std::istream& in,
bool binary =
false);
493 void exportWardClusterTreeToGraphViz(std::ostream& out);
497 void exportClusterTreeToJSON(std::ostream& out);
504 void printClusters(std::ostream& out = std::cout)
const;
508 void printClusterScores(std::ostream& out = std::cout);
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;
599 bool trivialCompute_();
602 bool linearSpaceCompute_();
605 bool althausCompute_();
610 void slinkInner_(
int current_level);
615 void clinkInner_(
int current_level);
621 bool nearestNeighborChainCompute_();
623 void initWardDistance_(
Index rmsd_type);
632 void computeCenterOfMasses_();
635 void precomputeAtomBijection_();
638 bool static isExcludedByLevelOfDetail_(
Atom const* atom,
Index rmsd_level_of_detail);
647 bool readTransformationsFromFile_(
String filename);
653 void storeSnapShotReferences_();
656 void printCluster_(
Size i, std::ostream& out = std::cout)
const;
659 void printVariables_(
int a,
int b,
double c,
int d,
double e,
int current_level);
744 #endif // BALL_DOCKING_POSECLUSTERING_H