/** * \file IMP/multifit/anchor_graph.h * \brief anchor graph utilities * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #ifndef IMPMULTIFIT_ANCHOR_GRAPH_H #define IMPMULTIFIT_ANCHOR_GRAPH_H #include #include #include #include #include "FittingSolutionRecord.h" #include IMPMULTIFIT_BEGIN_NAMESPACE class IMPMULTIFITEXPORT ProbabilisticAnchorGraph : public IMP::base::Object { // Property types typedef boost::property EdgeWeightProperty; typedef boost::property VertexIndexProperty; // Graph type typedef boost::adjacency_list AnchorGraph; typedef boost::graph_traits GTraits; typedef boost::graph_traits Const_GTraits; typedef GTraits::vertex_descriptor GVertex; typedef GTraits::edge_descriptor GEdge; public: ProbabilisticAnchorGraph(algebra::Vector3Ds anchor_positions); void add_edge(int i,int j) { boost::add_edge(id2node_[i],id2node_[j],g_); } //! Set the probability of a component to be located at each acnhor position /** \param[in] comp_ind the component index \param[in] comp_cen the position of the component centroid \param[in] sols the fitting solutions of the component */ void set_particle_probabilities_on_anchors( Particle *p, multifit::FittingSolutionRecords sols); void show(std::ostream& out=std::cout) const; unsigned int get_number_of_anchors() const {return boost::num_vertices(g_);} unsigned int get_number_of_edges() const {return boost::num_edges(g_);} IntRanges get_edge_list() const; algebra::Vector3Ds get_anchors() const {return positions_;} algebra::Vector3Ds get_particle_anchors(Particle *p,float min_prob=0) const; bool get_are_probabilities_for_particle_set(Particle *p) const { return particle_to_anchor_probabilities_.find(p) != particle_to_anchor_probabilities_.end(); } Floats get_particle_probabilities(Particle *p) const; IMP_OBJECT_INLINE(ProbabilisticAnchorGraph, show(out),{}); private: AnchorGraph g_; std::map particle_to_anchor_probabilities_; algebra::Vector3Ds positions_; std::vector id2node_; }; IMP_OBJECTS(ProbabilisticAnchorGraph,ProbabilisticAnchorGraphs); IMPMULTIFIT_END_NAMESPACE #endif /* IMPMULTIFIT_ANCHOR_GRAPH_H */