IMP  2.1.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-2013 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  inline std::string get_txt_fine_ap_fn() const {
45  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  std::string get_transformations_fn() const {return transformations_fn_;}
53  void set_reference_fn(const std::string &ref_fn){reference_fn_=ref_fn;}
54  std::string get_reference_fn() const {return reference_fn_;}
56  /*IMP_OBJECT_INLINE(ComponentHeader, {
57  out<<name_<<"|"<<filename_<<"|"<<surface_fn_<<"|";
58  out<<pdb_ap_fn_<<"|"<<num_ap_<<"|";
59  out<<pdb_fine_ap_fn_<<"|"<<num_fine_ap_<<"|";
60  out<<transformations_fn_<<"|"<<reference_fn_<<"|"<<std::endl; }, {});*/
61  protected:
62  std::string name_;
63  std::string filename_;
64  std::string surface_fn_;
65  std::string pdb_ap_fn_;
66  int num_ap_;
67  std::string pdb_fine_ap_fn_;
68  int num_fine_ap_;
69  std::string transformations_fn_;
70  std::string reference_fn_;
71 };
73 
74 //! Holds data about the assembly density needed for optimization
75 class IMPMULTIFITEXPORT AssemblyHeader : public IMP::base::Object {
76  public:
77  AssemblyHeader(): Object("AssemblyHeader%1%") {
78  dens_fn_="";
79  resolution_=0.;
80  spacing_=0.;
81  threshold_=0.;
82  coarse_ap_fn_="";
83  coarse_over_sampled_ap_fn_="";
84  fine_ap_fn_="";
85  fine_over_sampled_ap_fn_="";
86  }
87  void set_dens_fn(const std::string &dens_fn) {dens_fn_=dens_fn;}
88  std::string get_dens_fn() const {return dens_fn_;}
89  void set_resolution(float res) {resolution_=res;}
90  float get_resolution() const {return resolution_;}
91  float get_spacing() const {return spacing_;}
92  void set_spacing(float spacing) {spacing_=spacing;}
93  void set_threshold(float t) {threshold_=t;}
94  float get_threshold() const {return threshold_;}
95  algebra::Vector3D get_origin() const {return origin_;}
96  void set_origin(algebra::Vector3D origin) {origin_=origin;}
97  std::string get_coarse_ap_fn () const {return coarse_ap_fn_;}
98  void set_coarse_ap_fn (const std::string &new_fn) {
99  coarse_ap_fn_ = new_fn;}
100  std::string get_coarse_over_sampled_ap_fn () const {
101  return coarse_over_sampled_ap_fn_;}
102  void set_coarse_over_sampled_ap_fn (const std::string &new_fn) {
103  coarse_over_sampled_ap_fn_=new_fn;}
104  std::string get_fine_ap_fn () const {return fine_ap_fn_;}
105  void set_fine_ap_fn (const std::string &new_fn) {
106  fine_ap_fn_ = new_fn;}
107  std::string get_fine_over_sampled_ap_fn () const {
108  return fine_over_sampled_ap_fn_;}
109  void set_fine_over_sampled_ap_fn (const std::string &new_fn) {
110  fine_over_sampled_ap_fn_=new_fn;}
112  /*IMP_OBJECT_INLINE(AssemblyHeader, {
113  out<<dens_fn_<<"|"<<resolution_<<"|"<<spacing_<<"|"<<threshold_
114  <<"|"<<origin_[0]<<"|";
115  out<<origin_[1]<<"|"<<origin_[2]<<"|"<<coarse_ap_fn_;
116  out<<"|"<<coarse_over_sampled_ap_fn_<<"|";
117  out<<fine_ap_fn_<<"|"<<fine_over_sampled_ap_fn_<<"|\n";
118  }, {});*/
119  protected:
120  std::string dens_fn_;
121  float resolution_;
122  float spacing_;
123  float threshold_;
124  algebra::Vector3D origin_;
125  std::string coarse_ap_fn_;
126  std::string coarse_over_sampled_ap_fn_;
127  std::string fine_ap_fn_;
128  std::string fine_over_sampled_ap_fn_;
129  };
130 
131 //! Holds header data for optimization
132 class IMPMULTIFITEXPORT SettingsData : public IMP::base::Object {
133 public:
134  SettingsData(): Object("SettingsData%1%"){
135  data_path_="./";}
136  static void show_component_header_line(std::ostream& out = std::cout) {
137  out<<get_component_header_line();
138  }
139  static std::string get_component_header_line(){
140  std::stringstream ss;
141  ss<<"name|protein|surface|pdb_anchor_points|number of anchor points|"<<
142  "fine pdb_anchor_points|number of fine anchor points|"<<
143  "transformations|ref filename|"<<std::endl;
144  return ss.str();
145  }
146  static void show_density_header_line(std::ostream& out = std::cout) {
147  out <<get_density_header_line();
148  }
149  static std::string get_density_header_line() {
150  std::stringstream ss;
151  ss <<"map| resolution| spacing| threshold|x-origin| y-origin| z-origin|";
152  ss<<"coarse anchor points|coarse over sampled anchor points|";
153  ss<<"fine anchor points|fine over sampled anchor points|"<<std::endl;
154  return ss.str();
155  }
156  void set_assembly_filename(const std::string &fn) {
157  asmb_fn_ = fn;
158  }
159  const char * get_assembly_filename() const {
160  return asmb_fn_.c_str();
161  }
162  void set_assembly_header(AssemblyHeader *h) {
163  dens_data_=h;
164  }
165  AssemblyHeader *get_assembly_header() const {
166  return dens_data_;
167  }
168  void set_data_path(const std::string &fn) {
169  data_path_ = fn;
170  }
171  std::string get_data_path() const {return data_path_;}
172 
174 
175  IMP_LIST_ACTION(public, ComponentHeader, ComponentHeaders,
176  component_header, component_headers,
178  ComponentHeaders, obj->set_was_used(true);,,);
179 
180 protected:
182  std::string asmb_fn_;
183  std::string data_path_;
184 };
185 
186 IMPMULTIFITEXPORT SettingsData *read_settings(const char *filename);
187 IMPMULTIFITEXPORT void write_settings(
188  const char *filename, const SettingsData *sd);
189 IMPMULTIFIT_END_NAMESPACE
190 #endif /* IMPMULTIFIT_SETTINGS_DATA_H */
Import IMP/kernel/base_types.h in the namespace.
A nullptr-initialized pointer to an IMP Object.
A smart pointer to a ref-counted Object that is a class memeber.
Definition: base/Pointer.h:146
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.
Holds header data for optimization.
Definition: SettingsData.h:132
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Holds data about the assembly density needed for optimization.
Definition: SettingsData.h:75
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.
Simple 3D transformation class.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.