IMP  2.1.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-2013 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 
24 IMPMULTIFIT_BEGIN_NAMESPACE
25 typedef std::map<IntPair, int> CEdges;
26 
27 //! Sets the assignment of particles data points into clusters according
28 //! to the clustering engine.
29 class IMPMULTIFITEXPORT DataPointsAssignment {
30 public:
32  (const IMP::statistics::internal::XYZDataPoints *data,
33  const IMP::statistics::internal::ClusteringEngine *cluster_engine);
34 
36  int get_number_of_clusters() const {return cluster_sets_.size();}
37  algebra::Vector3Ds get_cluster_vectors(int cluster_id) const;
38  //Float get_cluster_xyz_diameter(int cluster_ind) const;
39  const IntPairs *get_edges() const {return &edges_;}
40  algebra::Vector3Ds get_centers() const {
41  algebra::Vector3Ds vecs;
42  for(int i=0;i<get_number_of_clusters();i++) {
43  IMP::statistics::internal::Array1DD xyz =cluster_engine_->get_center(i);
44  vecs.push_back(algebra::Vector3D(xyz[0],xyz[1],xyz[2]));
45  }
46  return vecs;
47  }
48  const IMP::statistics::internal::ClusteringEngine *get_cluster_engine()
49  const {return cluster_engine_;};
50  IMP::algebra::Vector3Ds get_cluster_xyz(int cluster_ind) const;
51 protected:
52  algebra::Vector3Ds set_cluster(int cluster_ind);
53  void set_clusters();
54  void connect_clusters(int c1, int c2);
55  void set_edges(double voxel_size=3.);
56  /* bool are_particles_close(core::RigidBody rb1,
57  core::RigidBody rb2);*/
59  std::vector<algebra::Vector3Ds> cluster_sets_;
60  const IMP::statistics::internal::ClusteringEngine *cluster_engine_;
61  IntPairs edges_;
62  CEdges edges_map_;
63 };
64 
65 IMPMULTIFITEXPORT void write_chimera(
66  const std::string &chimera_filename,
67  const DataPointsAssignment &dpa);
68 
69 IMPMULTIFITEXPORT std::pair<algebra::Vector3Ds,
70  CEdges> read_cmm(const std::string &cmm_filename);
71 /*IMPMULTIFITEXPORT void write_cmm(const std::string &cmm_filename,
72  const std::string &marker_set_name,
73  const DataPointsAssignment &dpa);*/
74 IMPMULTIFITEXPORT std::pair<algebra::Vector3Ds,
75  CEdges> read_cmm(const std::string &cmm_filename);
76 
77 /*IMPMULTIFITEXPORT void write_max_cmm(const std::string &cmm_filename,
78  em::DensityMap *dmap,
79  const std::string &marker_set_name,
80  const DataPointsAssignment &dpa);*/
81 
82 IMPMULTIFITEXPORT void write_pdb(const std::string &pdb_filename,
83  const DataPointsAssignment &dpa);
84 
85 void write_segments_as_pdb(const DataPointsAssignment &dpa,
86  const std::string &filename);
87 
88 void write_segment_as_pdb(const DataPointsAssignment &dpa,
89  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,
100  Float resolution, Float apix,
101  Float threshold,
102  const std::string &filename);
103 
104 IMPMULTIFITEXPORT
105 void write_segment_as_mrc(em::DensityMap *dmap,
106 const DataPointsAssignment &dpa,int segment_id,
107 Float resolution, Float apix,const std::string &filename);
108 
109 algebra::Vector3D get_segment_maximum(const DataPointsAssignment &dpa,
110  em::DensityMap *dmap, int segment_id);
111 algebra::Vector3D get_segment_maximum(const DataPointsAssignment &dpa,
112  DensGrid *dmap, int segment_id);
113 
114 IMPMULTIFIT_END_NAMESPACE
115 #endif /* IMPMULTIFIT_DATA_POINTS_ASSIGNMENT_H */
Functions to read pdbs.
void write_pdb(const Selection &mhd, base::TextOutput out, unsigned int model=1)
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:271
Simple xyz decorator.
Decorator for helping deal with a hierarchy of molecules.
Class for handling density maps.
Definition: DensityMap.h:98
base::Vector< VectorD< 3 > > Vector3Ds
Definition: VectorD.h:589
functionality for defining rigid bodies
Store the chain ID.
Handling of data for anchor points segmentation.
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20