IMP  2.1.1
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-2013 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/base/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 {
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  */
38  SingletonContainerAdaptor pi,
39  bool align = false);
40  algebra::VectorKD get_point(unsigned int i) const IMP_OVERRIDE;
41  unsigned int get_number_of_items() const IMP_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::kernel::Model::get_range()). This is
51  done by passing rescale=true to the constructor.
52 */
53 class IMPSTATISTICSEXPORT ParticleEmbedding : public Embedding {
55  FloatKeys ks_;
56  bool rescale_;
58 
59  public:
61  const FloatKeys &ks
62 #if defined(IMP_DOXYGEN)
63  = core::XYZ::get_xyz_keys()
64 #else
65  = FloatKeys(IMP::kernel::internal::xyzr_keys,
66  IMP::kernel::internal::xyzr_keys + 3)
67 #endif
68  ,
69  bool rescale = false);
70  algebra::VectorKD get_point(unsigned int i) const IMP_OVERRIDE;
71  unsigned int get_number_of_items() const IMP_OVERRIDE;
73 };
74 
75 //! Simply return the coordinates of a VectorD
76 class IMPSTATISTICSEXPORT VectorDEmbedding : public Embedding {
78 
79  public:
80  template <class C>
81  VectorDEmbedding(const C &vs)
82  : Embedding("VectorDs") {
83  vectors_.resize(vs.size());
84  for (unsigned int i = 0; i < vs.size(); ++i) {
85  vectors_[i] =
86  algebra::VectorKD(vs[i].coordinates_begin(), vs[i].coordinates_end());
87  }
88  }
89 #ifdef SWIG
96 #endif
97  algebra::VectorKD get_point(unsigned int i) const IMP_OVERRIDE;
98  unsigned int get_number_of_items() const IMP_OVERRIDE;
100 };
101 
102 IMPSTATISTICS_END_NAMESPACE
103 
104 #endif /* IMPSTATISTICS_EMBEDDINGS_H */
A class to store a set of configurations of a model.
Embed a configuration using the XYZ coordinates of a set of particles.
Definition: embeddings.h:28
Import IMP/kernel/SingletonContainer.h in the namespace.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:147
IMP::kernel::FloatKeys FloatKeys
A smart pointer to a reference counted object.
Definition: base/Pointer.h:87
A Cartesian vector in D-dimensions.
Definition: VectorD.h:48
Simple D vector class.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Store data to be clustered for embedding based algorithms.
Various general useful macros for IMP.
Import IMP/kernel/ConfigurationSet.h in the namespace.
Cluster sets of points.
VectorD<-1 > VectorKD
Definition: VectorD.h:603
Simply return the coordinates of a VectorD.
Definition: embeddings.h:76