IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
embeddings.h
Go to the documentation of this file.
1 /**
2  * \file IMP/statistics/embeddings.h
3  * \brief Cluster sets of points.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSTATISTICS_EMBEDDINGS_H
10 #define IMPSTATISTICS_EMBEDDINGS_H
11 
12 #include <IMP/statistics/statistics_config.h>
13 #include "Embedding.h"
14 #include <IMP/object_macros.h>
15 #include <IMP/ConfigurationSet.h>
16 #include <IMP/SingletonContainer.h>
17 #include <IMP/algebra/VectorD.h>
18 
19 IMPSTATISTICS_BEGIN_NAMESPACE
20 
21 //! Embed a configuration using the XYZ coordinates of a set of particles
22 /** The point for each configuration of the model is a concatenation of
23  the Cartesian coordinates of the particles contained in the passed
24  SingletonContainer.
25 
26  See ConfigurationSet for more information about the input.
27 */
28 class IMPSTATISTICSEXPORT ConfigurationSetXYZEmbedding : public Embedding {
29  mutable Pointer<ConfigurationSet> cs_;
31  bool align_;
32 
33  public:
34  /** If align is true, all the configurations are rigidly aligned with
35  the first before generating their coordinates.
36  */
39  bool align = false);
40  algebra::VectorKD get_point(unsigned int i) const override;
41  unsigned int get_number_of_items() const override;
43 };
44 
45 /** Embed particles using the values of some of their attributes.
46  By default, the Cartesian coordinates are used, but another
47  set of attributes can be chosen. When using attributes that
48  are not equivalent (for example, angular degrees of freedom),
49  it is probably useful to rescale the attributes according
50  to their ranges (see IMP::Model::get_range()). This is
51  done by passing rescale=true to the constructor.
52 */
53 class IMPSTATISTICSEXPORT ParticleEmbedding : public Embedding {
54  Particles ps_;
55  FloatKeys ks_;
56  bool rescale_;
57  Vector<FloatRange> ranges_;
58 
59  public:
60  ParticleEmbedding(const ParticlesTemp &ps, const FloatKeys &ks
61 #if defined(IMP_DOXYGEN)
62  = core::XYZ::get_xyz_keys()
63 #else
64  = FloatKeys(
65  IMP::internal::
66  xyzr_keys,
67  IMP::internal::
68  xyzr_keys +
69  3)
70 #endif
71  ,
72  bool rescale = false);
73  algebra::VectorKD get_point(unsigned int i) const override;
74  unsigned int get_number_of_items() const override;
76 };
77 
78 //! Simply return the coordinates of a VectorD
79 class IMPSTATISTICSEXPORT VectorDEmbedding : public Embedding {
81 
82  public:
83  template <class C>
84  VectorDEmbedding(const C &vs)
85  : Embedding("VectorDs") {
86  vectors_.resize(vs.size());
87  for (unsigned int i = 0; i < vs.size(); ++i) {
88  vectors_[i] = algebra::VectorKD(vs[i].begin(), vs[i].end());
89  }
90  }
91 #ifdef SWIG
98 #endif
99  algebra::VectorKD get_point(unsigned int i) const override;
100  unsigned int get_number_of_items() const override;
102 };
103 
104 IMPSTATISTICS_END_NAMESPACE
105 
106 #endif /* IMPSTATISTICS_EMBEDDINGS_H */
Embed a configuration using the XYZ coordinates of a set of particles.
Definition: embeddings.h:28
Helper macros for implementing IMP Objects.
A container for Singletons.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A smart pointer to a reference counted object.
Definition: Pointer.h:87
IMP::Vector< FloatKey > FloatKeys
Definition: base_types.h:33
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:143
Simple D vector class.
A class to store a set of configurations of a model.
Store data to be clustered for embedding based algorithms.
Store a set of configurations of the model.
Cluster sets of points.
VectorD<-1 > VectorKD
Definition: VectorD.h:424
Simply return the coordinates of a VectorD.
Definition: embeddings.h:79