IMP  2.1.1
The Integrative Modeling Platform
anchors_reader.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/anchors_reader.h
3  * \brief handles reading of anchors data
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_ANCHORS_READER_H
10 #define IMPMULTIFIT_ANCHORS_READER_H
11 
14 #include <IMP/kernel/Model.h>
15 #include <IMP/core/Hierarchy.h>
16 #include <IMP/multifit/multifit_config.h>
17 #include "DataPointsAssignment.h"
18 IMPMULTIFIT_BEGIN_NAMESPACE
19 
20 //! Storage of anchors (points and edges)
21 class IMPMULTIFITEXPORT AnchorsData {
22  public:
23  AnchorsData(){}
25  points_=points;edges_=edges;
26  secondary_structure_ps_=Particles();
27  //set true to consider all points
28  for (unsigned int i=0;i<points_.size();i++) {
29  consider_point_.push_back(true);
30  }
31  }
32 
33  void remove_edges_for_node(int node_ind) {
34  //iterate over edges and remove edges including node_ind
35  IntPairs new_edges;
36  for(int i=0;i<(int)edges_.size();i++) {
37  if (! ((edges_[i].first==node_ind) || (edges_[i].second==node_ind))) {
38  new_edges.push_back(edges_[i]);
39  }
40  }
41  consider_point_[node_ind]=false;
42  edges_=new_edges;
43  }
44  int get_number_of_points() const {return points_.size();}
45  int get_number_of_edges() const {return edges_.size();}
46  bool get_is_point_considered(int node_ind) const {
47  return consider_point_[node_ind];}
48  void show(std::ostream& out=std::cout) const {
49  out<<"==== "<<points_.size()<<" Anchors:"<<std::endl;
50  for(int i=0;i<(int)points_.size();i++) {
51  out<<points_[i]<<std::endl;
52  }
53  out<<"===="<<edges_.size()<<" Edges:"<<std::endl;
54  for(int i=0;i<(int)edges_.size();i++) {
55  out<<"("<<edges_[i].first<<","<<edges_[i].second<<") ";
56  }
57  out<<std::endl;
58  }
59 
60 
61  //!Check if secondary structure is setup
63  return (secondary_structure_ps_.size()==points_.size());
64  }
65 
66  //!Sets up default secondary structure particles for every anchor (run first)
67  void setup_secondary_structure(kernel::Model *mdl);
68 
69  //!Assign secondary structure particles. Provide indices if out of order.
70  /**
71  \param[in] ssres_ps The particles which you will be assigning to anchors
72  \param[in] indices (Optional) List of which anchor point numbers the
73  provided ssres_ps belong to.
74  */
75  void set_secondary_structure_probabilities(const kernel::Particles &ssres_ps,
76  const Ints &indices=Ints());
77 
78  inline kernel::Particles get_secondary_structure_particles() const {
79  return secondary_structure_ps_;
80  }
81  algebra::Vector3Ds points_;
82  std::vector<bool> consider_point_;
83  IntPairs edges_;
84  protected:
85  kernel::Particles secondary_structure_ps_;
86 };
88 
89 IMPMULTIFITEXPORT AnchorsData read_anchors_data(const char *txt_filename);
90 IMPMULTIFITEXPORT
91 void write_txt(const std::string &txt_filename,
92  const AnchorsData &ad);
93 IMPMULTIFITEXPORT
94 void write_cmm(const std::string &cmm_filename,
95  const std::string &marker_set_name,
96  const AnchorsData &dpa);
97 
98 IMPMULTIFIT_END_NAMESPACE
99 #endif /* IMPMULTIFIT_ANCHORS_READER_H */
Decorator for helping deal with a hierarchy.
A decorator for storing secondary structure probabilities. Copyright 2007-2013 IMP Inventors...
bool get_secondary_structure_is_set()
Check if secondary structure is setup.
Storage of anchors (points and edges)
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Tools for data points assignment, after anchor point segmentation.
Storage of a model, its restraints, constraints and particles.
Simple 3D transformation class.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Class for storing model, its restraints, constraints, and particles.
IMP::base::Vector< Int > Ints
Standard way to pass a bunch of Int values.
Definition: base/types.h:49