IMP  2.2.1
The Integrative Modeling Platform
DataPointsAssignment.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/DataPointsAssignment.h
3  * \brief Tools for data points assignment, after anchor point segmentation
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_DATA_POINTS_ASSIGNMENT_H
10 #define IMPMULTIFIT_DATA_POINTS_ASSIGNMENT_H
11 
12 #include <IMP/atom/pdb.h>
13 #include <IMP/atom/Hierarchy.h>
14 #include <IMP/atom/Atom.h>
15 #include <IMP/atom/Chain.h>
16 #include <IMP/core/XYZ.h>
17 #include <IMP/core/rigid_bodies.h>
18 #include <IMP/statistics/internal/ClusteringEngine.h>
19 #include <IMP/statistics/internal/DataPoints.h>
21 #include <IMP/multifit/multifit_config.h>
22 
23 IMPMULTIFIT_BEGIN_NAMESPACE
24 typedef std::map<IntPair, int> CEdges;
25 
26 //! Sets the assignment of particles data points into clusters according
27 //! to the clustering engine.
28 class IMPMULTIFITEXPORT DataPointsAssignment {
29  public:
31  const IMP::statistics::internal::XYZDataPoints *data,
32  const IMP::statistics::internal::ClusteringEngine *cluster_engine);
33 
35  int get_number_of_clusters() const { return cluster_sets_.size(); }
36  algebra::Vector3Ds get_cluster_vectors(int cluster_id) const;
37  // Float get_cluster_xyz_diameter(int cluster_ind) const;
38  const IntPairs *get_edges() const { return &edges_; }
39  algebra::Vector3Ds get_centers() const {
40  algebra::Vector3Ds vecs;
41  for (int i = 0; i < get_number_of_clusters(); i++) {
42  IMP::statistics::internal::Array1DD xyz = cluster_engine_->get_center(i);
43  vecs.push_back(algebra::Vector3D(xyz[0], xyz[1], xyz[2]));
44  }
45  return vecs;
46  }
47  const IMP::statistics::internal::ClusteringEngine *get_cluster_engine()
48  const {
49  return cluster_engine_;
50  };
51  IMP::algebra::Vector3Ds get_cluster_xyz(int cluster_ind) const;
52 
53  protected:
54  algebra::Vector3Ds set_cluster(int cluster_ind);
55  void set_clusters();
56  void connect_clusters(int c1, int c2);
57  void set_edges(double voxel_size = 3.);
58  /* bool are_particles_close(core::RigidBody rb1,
59  core::RigidBody rb2);*/
61  std::vector<algebra::Vector3Ds> cluster_sets_;
62  const IMP::statistics::internal::ClusteringEngine *cluster_engine_;
63  IntPairs edges_;
64  CEdges edges_map_;
65 };
66 
67 IMPMULTIFITEXPORT void write_chimera(const std::string &chimera_filename,
68  const DataPointsAssignment &dpa);
69 
70 IMPMULTIFITEXPORT std::pair<algebra::Vector3Ds, CEdges> read_cmm(
71  const std::string &cmm_filename);
72 /*IMPMULTIFITEXPORT void write_cmm(const std::string &cmm_filename,
73  const std::string &marker_set_name,
74  const DataPointsAssignment &dpa);*/
75 IMPMULTIFITEXPORT std::pair<algebra::Vector3Ds, CEdges> read_cmm(
76  const std::string &cmm_filename);
77 
78 /*IMPMULTIFITEXPORT void write_max_cmm(const std::string &cmm_filename,
79  em::DensityMap *dmap,
80  const std::string &marker_set_name,
81  const DataPointsAssignment &dpa);*/
82 
83 IMPMULTIFITEXPORT void write_pdb(const std::string &pdb_filename,
84  const DataPointsAssignment &dpa);
85 
86 void write_segments_as_pdb(const DataPointsAssignment &dpa,
87  const std::string &filename);
88 
89 void write_segment_as_pdb(const DataPointsAssignment &dpa, int segment_id,
90  const std::string &filename);
91 //! Write segments in MRC format
92 /**
93 \note segments are written as filename_0.mrc
94 \note an additional file filename.cmd is generated for easy
95  loading of all segments
96  */
97 IMPMULTIFITEXPORT
99  const DataPointsAssignment &dpa, Float resolution,
100  Float apix, Float threshold,
101  const std::string &filename);
102 
103 IMPMULTIFITEXPORT
104 void write_segment_as_mrc(em::DensityMap *dmap, const DataPointsAssignment &dpa,
105  int segment_id, Float resolution, Float apix,
106  const std::string &filename);
107 
108 algebra::Vector3D get_segment_maximum(const DataPointsAssignment &dpa,
109  em::DensityMap *dmap, int segment_id);
110 algebra::Vector3D get_segment_maximum(const DataPointsAssignment &dpa,
111  DensGrid *dmap, int segment_id);
112 
113 IMPMULTIFIT_END_NAMESPACE
114 #endif /* IMPMULTIFIT_DATA_POINTS_ASSIGNMENT_H */
Functions to read pdbs.
void write_segments_as_mrc(em::DensityMap *dmap, const DataPointsAssignment &dpa, Float resolution, Float apix, Float threshold, const std::string &filename)
Write segments in MRC format.
Simple atom decorator.
IntPairs get_edges(const BoundingBoxD< 3 > &)
Return the edges of the box as indices into the vertices list.
Definition: BoundingBoxD.h:289
Simple xyz decorator.
Decorator for helping deal with a hierarchy of molecules.
Class for handling density maps.
Definition: DensityMap.h:94
functionality for defining rigid bodies
Store the chain ID.
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Handling of data for anchor points segmentation.
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20