IMP logo
IMP Reference Guide  2.20.2
The Integrative Modeling Platform
CnSymmAxisDetector.h
Go to the documentation of this file.
1 /**
2  * \file IMP/cnmultifit/CnSymmAxisDetector.h
3  * \brief Detect cn symmetry in proteins and density maps.
4  *
5  * Copyright 2007-2022 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 //! Detect cn symmetry in proteins and density maps.
23 class IMPCNMULTIFITEXPORT CnSymmAxisDetector {
24  public:
25  CnSymmAxisDetector(int symm_deg, em::DensityMap *dmap,
26  float density_threshold, float top_p = 0.8);
27 
28  CnSymmAxisDetector(int symm_deg, const atom::Hierarchies &mhs);
29 
30  algebra::PrincipalComponentAnalysis get_pca() const { return pca_; }
31  float calc_symm_score(int symm_axis_ind) const;
32  algebra::Vector3D get_symmetry_axis() const;
33  int get_symmetry_axis_index() const;
34  int get_non_symmetry_axis_length() const {
35  int symm_axis_ind = get_symmetry_axis_index();
36  int non_ind;
37  if (symm_axis_ind == 0 || symm_axis_ind == 2) {
38  non_ind = 1;
39  } else {
40  non_ind = 0;
41  }
42  return std::sqrt(pca_.get_principal_value(non_ind));
43  }
44  void show(std::ostream &out = std::cout) const {
45  out << "symm degree:" << symm_deg_ << std::endl;
46  out << "symm axis:" << get_symmetry_axis_index() << std::endl;
47  pca_.show(out);
48  }
49 
50  protected:
51  Float symm_avg(const algebra::Vector3D &start_p,
52  const algebra::Vector3D &symm_vec) const;
53  algebra::Vector3Ds vecs_;
55  algebra::PrincipalComponentAnalysis pca_;
56  int symm_deg_;
57  algebra::Transformation3D to_native_, from_native_;
58  Floats values_;
59 };
61 
62 IMPCNMULTIFIT_END_NAMESPACE
63 
64 #endif /* IMPCNMULTIFIT_CN_SYMM_AXIS_DETECTOR_H */
Detect cn symmetry in proteins and density maps.
Simple 3D transformation class.
Simple XYZ decorator.
Class for handling density maps.
Decorator for helping deal with a hierarchy of molecules.
Class for handling density maps.
Definition: DensityMap.h:95
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
VectorD< 3 > Vector3D
Definition: VectorD.h:425
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Simple 3D vector class.
Principal component analysis of a set of points.