IMP  2.0.1
The Integrative Modeling Platform
CnSymmAxisDetector.h
Go to the documentation of this file.
1 /**
2  * \file CnSymmAxisDetector.h
3  * \brief Detect cn symmetry in proteins and density maps.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCNMULTIFIT_CN_SYMM_AXIS_DETECTOR_H
10 #define IMPCNMULTIFIT_CN_SYMM_AXIS_DETECTOR_H
11 
13 #include <IMP/algebra/Vector3D.h>
14 #include <IMP/em/DensityMap.h>
15 #include <IMP/core/XYZ.h>
16 #include <IMP/atom/Hierarchy.h>
17 #include <vector>
18 #include <IMP/cnmultifit/cnmultifit_config.h>
19 
20 IMPCNMULTIFIT_BEGIN_NAMESPACE
21 
22 class IMPCNMULTIFITEXPORT CnSymmAxisDetector {
23 public:
24  CnSymmAxisDetector(int symm_deg, em::DensityMap *dmap,
25  float density_threshold, float top_p=0.8);
26 
27  CnSymmAxisDetector(int symm_deg, const atom::Hierarchies &mhs);
28 
29  algebra::PrincipalComponentAnalysis get_pca() const { return pca_;}
30  float calc_symm_score(int symm_axis_ind) const;
31  algebra::Vector3D get_symmetry_axis() const;
32  int get_symmetry_axis_index() const;
33  int get_non_symmetry_axis_length() const{
34  int symm_axis_ind=get_symmetry_axis_index();
35  int non_ind;
36  if(symm_axis_ind == 0 || symm_axis_ind == 2) {
37  non_ind=1;
38  } else {
39  non_ind=0;
40  }
41  return std::sqrt(pca_.get_principal_value(non_ind));
42  }
43  void show(std::ostream& out=std::cout) const {
44  out<<"symm degree:"<<symm_deg_<<std::endl;
45  out<<"symm axis:"<<get_symmetry_axis_index()<<std::endl;
46  pca_.show(out);
47  }
48 protected:
49  Float symm_avg(const algebra::Vector3D &start_p,
50  const algebra::Vector3D &symm_vec) const;
51  algebra::Vector3Ds vecs_;
52  OwnerPointer<em::DensityMap> dmap_;
53  algebra::PrincipalComponentAnalysis pca_;
54  int symm_deg_;
55  algebra::Transformation3D to_native_,from_native_;
56  Floats values_;
57 };
58 IMP_VALUES(CnSymmAxisDetector, CnSymmAxisDetectors);
59 
60 IMPCNMULTIFIT_END_NAMESPACE
61 
62 #endif /* IMPCNMULTIFIT_CN_SYMM_AXIS_DETECTOR_H */