IMP  2.3.0
The Integrative Modeling Platform
SettingsData.h
Go to the documentation of this file.
1 /**
2  * \file IMP/multifit/SettingsData.h
3  * \brief stored multifit settings data
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_SETTINGS_DATA_H
10 #define IMPMULTIFIT_SETTINGS_DATA_H
11 #include <IMP/multifit/multifit_config.h>
12 #include <IMP/base_types.h>
13 #include <IMP/container_macros.h>
14 #include <IMP/base/Pointer.h>
15 #include <IMP/kernel/Model.h>
16 #include <IMP/base/Pointer.h>
18 
19 IMPMULTIFIT_BEGIN_NAMESPACE
20 
21 //! Holds data about a component needed for optimization
22 class IMPMULTIFITEXPORT ComponentHeader : public IMP::base::Object {
23  public:
24  ComponentHeader() : Object("ComponentHeader%1%") {
25  name_ = "";
26  filename_ = "";
27  surface_fn_ = "";
28  pdb_ap_fn_ = "";
29  pdb_fine_ap_fn_ = "";
30  num_ap_ = 0;
31  transformations_fn_ = "";
32  reference_fn_ = "";
33  }
34  void set_name(const std::string &name) { name_ = name; }
35  inline std::string get_name() const { return name_; }
36  inline std::string get_filename() const { return filename_; }
37  void set_filename(const std::string &filename) { filename_ = filename; }
38  inline std::string get_surface_fn() const { return surface_fn_; }
39  void set_surface_fn(const std::string &fn) { surface_fn_ = fn; }
40  void set_txt_ap_fn(const std::string &pdb_ap_fn) { pdb_ap_fn_ = pdb_ap_fn; }
41  inline std::string get_txt_ap_fn() const { return pdb_ap_fn_; }
42  void set_txt_fine_ap_fn(const std::string &pdb_ap_fn) {
43  pdb_fine_ap_fn_ = pdb_ap_fn;
44  }
45  inline std::string get_txt_fine_ap_fn() const { return pdb_fine_ap_fn_; }
46  void set_num_ap(int num_ap) { num_ap_ = num_ap; }
47  inline int get_num_ap() const { return num_ap_; }
48  void set_num_fine_ap(int num_ap) { num_fine_ap_ = num_ap; }
49  inline int get_num_fine_ap() const { return num_fine_ap_; }
50  void set_transformations_fn(std::string transformations_fn) {
51  transformations_fn_ = transformations_fn;
52  }
53  std::string get_transformations_fn() const { return transformations_fn_; }
54  void set_reference_fn(const std::string &ref_fn) { reference_fn_ = ref_fn; }
55  std::string get_reference_fn() const { return reference_fn_; }
57  /*IMP_OBJECT_INLINE(ComponentHeader, {
58  out<<name_<<"|"<<filename_<<"|"<<surface_fn_<<"|";
59  out<<pdb_ap_fn_<<"|"<<num_ap_<<"|";
60  out<<pdb_fine_ap_fn_<<"|"<<num_fine_ap_<<"|";
61  out<<transformations_fn_<<"|"<<reference_fn_<<"|"<<std::endl; }, {});*/
62  protected:
63  std::string name_;
64  std::string filename_;
65  std::string surface_fn_;
66  std::string pdb_ap_fn_;
67  int num_ap_;
68  std::string pdb_fine_ap_fn_;
69  int num_fine_ap_;
70  std::string transformations_fn_;
71  std::string reference_fn_;
72 };
74 
75 //! Holds data about the assembly density needed for optimization
76 class IMPMULTIFITEXPORT AssemblyHeader : public IMP::base::Object {
77  public:
78  AssemblyHeader() : Object("AssemblyHeader%1%") {
79  dens_fn_ = "";
80  resolution_ = 0.;
81  spacing_ = 0.;
82  threshold_ = 0.;
83  coarse_ap_fn_ = "";
84  coarse_over_sampled_ap_fn_ = "";
85  fine_ap_fn_ = "";
86  fine_over_sampled_ap_fn_ = "";
87  }
88  void set_dens_fn(const std::string &dens_fn) { dens_fn_ = dens_fn; }
89  std::string get_dens_fn() const { return dens_fn_; }
90  void set_resolution(float res) { resolution_ = res; }
91  float get_resolution() const { return resolution_; }
92  float get_spacing() const { return spacing_; }
93  void set_spacing(float spacing) { spacing_ = spacing; }
94  void set_threshold(float t) { threshold_ = t; }
95  float get_threshold() const { return threshold_; }
96  algebra::Vector3D get_origin() const { return origin_; }
97  void set_origin(algebra::Vector3D origin) { origin_ = origin; }
98  std::string get_coarse_ap_fn() const { return coarse_ap_fn_; }
99  void set_coarse_ap_fn(const std::string &new_fn) { coarse_ap_fn_ = new_fn; }
100  std::string get_coarse_over_sampled_ap_fn() const {
101  return coarse_over_sampled_ap_fn_;
102  }
103  void set_coarse_over_sampled_ap_fn(const std::string &new_fn) {
104  coarse_over_sampled_ap_fn_ = new_fn;
105  }
106  std::string get_fine_ap_fn() const { return fine_ap_fn_; }
107  void set_fine_ap_fn(const std::string &new_fn) { fine_ap_fn_ = new_fn; }
108  std::string get_fine_over_sampled_ap_fn() const {
109  return fine_over_sampled_ap_fn_;
110  }
111  void set_fine_over_sampled_ap_fn(const std::string &new_fn) {
112  fine_over_sampled_ap_fn_ = new_fn;
113  }
115  /*IMP_OBJECT_INLINE(AssemblyHeader, {
116  out<<dens_fn_<<"|"<<resolution_<<"|"<<spacing_<<"|"<<threshold_
117  <<"|"<<origin_[0]<<"|";
118  out<<origin_[1]<<"|"<<origin_[2]<<"|"<<coarse_ap_fn_;
119  out<<"|"<<coarse_over_sampled_ap_fn_<<"|";
120  out<<fine_ap_fn_<<"|"<<fine_over_sampled_ap_fn_<<"|\n";
121  }, {});*/
122  protected:
123  std::string dens_fn_;
124  float resolution_;
125  float spacing_;
126  float threshold_;
127  algebra::Vector3D origin_;
128  std::string coarse_ap_fn_;
129  std::string coarse_over_sampled_ap_fn_;
130  std::string fine_ap_fn_;
131  std::string fine_over_sampled_ap_fn_;
132 };
133 
134 //! Holds header data for optimization
135 class IMPMULTIFITEXPORT SettingsData : public IMP::base::Object {
136  public:
137  SettingsData() : Object("SettingsData%1%") { data_path_ = "./"; }
138  static void show_component_header_line(std::ostream &out = std::cout) {
139  out << get_component_header_line();
140  }
141  static std::string get_component_header_line() {
142  std::stringstream ss;
143  ss << "name|protein|surface|pdb_anchor_points|number of anchor points|"
144  << "fine pdb_anchor_points|number of fine anchor points|"
145  << "transformations|ref filename|" << std::endl;
146  return ss.str();
147  }
148  static void show_density_header_line(std::ostream &out = std::cout) {
149  out << get_density_header_line();
150  }
151  static std::string get_density_header_line() {
152  std::stringstream ss;
153  ss << "map| resolution| spacing| threshold|x-origin| y-origin| z-origin|";
154  ss << "coarse anchor points|coarse over sampled anchor points|";
155  ss << "fine anchor points|fine over sampled anchor points|" << std::endl;
156  return ss.str();
157  }
158  void set_assembly_filename(const std::string &fn) { asmb_fn_ = fn; }
159  const char *get_assembly_filename() const { return asmb_fn_.c_str(); }
160  void set_assembly_header(AssemblyHeader *h) { dens_data_ = h; }
161  AssemblyHeader *get_assembly_header() const { return dens_data_; }
162  void set_data_path(const std::string &fn) { data_path_ = fn; }
163  std::string get_data_path() const { return data_path_; }
164 
166 
167  IMP_LIST_ACTION(public, ComponentHeader, ComponentHeaders, component_header,
168  component_headers, ComponentHeader *, ComponentHeaders,
169  obj->set_was_used(true);
170  , , );
171 
172  protected:
174  std::string asmb_fn_;
175  std::string data_path_;
176 };
177 
178 IMPMULTIFITEXPORT SettingsData *read_settings(const char *filename);
179 IMPMULTIFITEXPORT void write_settings(const char *filename,
180  const SettingsData *sd);
181 IMPMULTIFIT_END_NAMESPACE
182 #endif /* IMPMULTIFIT_SETTINGS_DATA_H */
Import IMP/kernel/base_types.h in the namespace.
A smart pointer to a ref-counted Object that is a class member.
Definition: Pointer.h:147
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
double get_resolution(kernel::Model *m, kernel::ParticleIndex pi)
std::string get_data_path(std::string file_name)
Return the full path to installed data.
Import IMP/kernel/container_macros.h in the namespace.
Object(std::string name)
Construct an object with the given name.
Holds header data for optimization.
Definition: SettingsData.h:135
Holds data about the assembly density needed for optimization.
Definition: SettingsData.h:76
Storage of a model, its restraints, constraints and particles.
Holds data about a component needed for optimization.
Definition: SettingsData.h:22
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Simple 3D transformation class.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition: object_macros.h:52
A nullptr-initialized pointer to an IMP Object.
VectorD< 3 > Vector3D
Definition: VectorD.h:395