12 #ifndef IMPCORE_MS_CONNECTIVITY_RESTRAINT_H
13 #define IMPCORE_MS_CONNECTIVITY_RESTRAINT_H
17 #include <IMP/core/core_config.h>
24 IMPCORE_BEGIN_NAMESPACE
30 #define GCC_VERSION (__GNUC__ * 10000 \
31 + __GNUC_MINOR__ * 100 \
32 + __GNUC_PATCHLEVEL__)
33 #if GCC_VERSION >= 40100
34 #define IMPCORE_FRIEND_IS_OK
38 #define IMPCORE_FRIEND_IS_OK
61 IMP::OwnerPointer<PairScore> ps_;
62 IMP::OwnerPointer<SingletonContainer> sc_;
80 unsigned int add_type(
const ParticlesTemp &ps);
81 unsigned int add_composite(
const Ints &components);
82 unsigned int add_composite(
const Ints &components,
unsigned int parent);
108 #ifdef IMPCORE_FRIEND_IS_OK
119 ParticleData(
Particle *p,
unsigned int id)
129 unsigned int get_id()
const
138 ParticleMatrix(
unsigned int number_of_classes)
139 : protein_by_class_(number_of_classes)
140 , min_distance_(std::numeric_limits<double>::max())
146 : min_distance_(std::numeric_limits<double>::max())
151 void resize(
unsigned int number_of_classes)
153 protein_by_class_.resize(number_of_classes);
157 unsigned int add_type(
const ParticlesTemp &ps);
158 void create_distance_matrix(
const PairScore *ps);
159 void clear_particles()
162 for (
unsigned int i = 0; i < protein_by_class_.size(); ++i )
163 protein_by_class_[i].clear();
165 unsigned int size()
const
167 return particles_.size();
169 unsigned int get_number_of_classes()
const
171 return protein_by_class_.size();
173 double get_distance(
unsigned int p1,
unsigned int p2)
const
175 return dist_matrix_[p1*size() + p2];
177 Ints const &get_ordered_neighbors(
unsigned int p)
const
181 ParticleData
const &get_particle(
unsigned int p)
const
183 return particles_[p];
185 Ints const &get_all_proteins_in_class(
186 unsigned int id)
const
188 return protein_by_class_[id];
190 double max_distance()
const
192 return max_distance_;
194 double min_distance()
const
196 return min_distance_;
202 DistCompare(
unsigned int source, ParticleMatrix
const &parent)
207 bool operator()(
unsigned int p1,
unsigned int p2)
const
209 return parent_.get_distance(source_, p1) <
210 parent_.get_distance(source_, p2);
213 ParticleMatrix
const &parent_;
214 unsigned int source_;
217 base::Vector<ParticleData> particles_;
219 base::Vector< Ints > order_;
220 base::Vector< Ints > protein_by_class_;
221 double min_distance_;
222 double max_distance_;
223 unsigned int current_id_;
226 class ExperimentalTree
234 void connect(
unsigned int parent,
unsigned int child);
236 unsigned int add_composite(
const Ints &components);
237 unsigned int add_composite(
const Ints &components,
unsigned int parent);
245 unsigned int get_number_of_parents()
const
247 return parents_.size();
251 return get_number_of_parents() == 0;
253 unsigned int get_number_of_children()
const
255 return children_.size();
259 return get_number_of_children() == 0;
261 unsigned int get_parent(
unsigned int idx)
const
263 return parents_[idx];
265 unsigned int get_child(
unsigned int idx)
const
267 return children_[idx];
269 typedef base::Vector< std::pair<unsigned int, int> > Label;
270 const Label &get_label()
const
276 base::Vector<unsigned int> parents_;
277 base::Vector<unsigned int> children_;
282 bool find_cycle(
unsigned int node_index);
283 bool is_consistent(
unsigned int node_index)
const;
285 const Node *get_node(
unsigned int index)
const
287 return &nodes_[index];
289 unsigned int get_number_of_nodes()
const
291 return nodes_.size();
297 void desc_to_label(
const Ints &components,
300 base::Vector<Node> nodes_;
305 ParticleMatrix particle_matrix_;
306 mutable ExperimentalTree tree_;
308 friend class MSConnectivityScore;
312 IMPCORE_END_NAMESPACE