IMP  2.1.0
The Integrative Modeling Platform
anchor_graph.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/anchor_graph.h
3  * \brief anchor graph utilities
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_ANCHOR_GRAPH_H
10 #define IMPMULTIFIT_ANCHOR_GRAPH_H
11 
12 #include <boost/graph/adjacency_list.hpp>
13 #include <vector>
14 #include <IMP/algebra/Vector3D.h>
15 #include <IMP/multifit/multifit_config.h>
16 #include "FittingSolutionRecord.h"
17 #include <IMP/base/Object.h>
18 
19 IMPMULTIFIT_BEGIN_NAMESPACE
20 
21 //! Probabilistic anchor graph.
22 class IMPMULTIFITEXPORT ProbabilisticAnchorGraph : public IMP::base::Object {
23 // Property types
24 typedef boost::property<boost::edge_weight_t, float> EdgeWeightProperty;
25 typedef boost::property<boost::vertex_index_t, int> VertexIndexProperty;
26 // Graph type
27 typedef boost::adjacency_list<boost::vecS, boost::vecS,
28  boost::undirectedS,
29  VertexIndexProperty,
30  EdgeWeightProperty> AnchorGraph;
31 typedef boost::graph_traits<AnchorGraph> GTraits;
32 typedef boost::graph_traits<AnchorGraph const> Const_GTraits;
33 typedef GTraits::vertex_descriptor GVertex;
34 typedef GTraits::edge_descriptor GEdge;
35 public:
37 
38  void add_edge(int i,int j) {
39  boost::add_edge(id2node_[i],id2node_[j],g_);
40  }
41  //! Set the probability of a component to be located at each anchor position
42  /**
43  \param[in] p
44  \param[in] sols the fitting solutions of the component
45  */
46  void set_particle_probabilities_on_anchors(
49  void show(std::ostream& out=std::cout) const;
50  unsigned int get_number_of_anchors() const {return boost::num_vertices(g_);}
51  unsigned int get_number_of_edges() const {return boost::num_edges(g_);}
52  IntRanges get_edge_list() const;
53  algebra::Vector3Ds get_anchors() const {return positions_;}
54  algebra::Vector3Ds get_particle_anchors(kernel::Particle *p,
55  float min_prob=0) const;
56  bool get_are_probabilities_for_particle_set(kernel::Particle *p) const {
57  return particle_to_anchor_probabilities_.find(p) !=
58  particle_to_anchor_probabilities_.end();
59  }
60  Floats get_particle_probabilities(kernel::Particle *p) const;
62 private:
63  AnchorGraph g_;
64  std::map<kernel::Particle *,Floats> particle_to_anchor_probabilities_;
65  algebra::Vector3Ds positions_;
66  std::vector<GVertex> id2node_;
67 };
68 
70 IMPMULTIFIT_END_NAMESPACE
71 #endif /* IMPMULTIFIT_ANCHOR_GRAPH_H */
stored a multifit fitting solution
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Class to handle individual model particles.
Common base class for heavy weight IMP objects.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Simple 3D vector class.
A shared base class to help in debugging and things.
Probabilistic anchor graph.
Definition: anchor_graph.h:22