IMP  2.0.0
The Integrative Modeling Platform
AlignmentParams.h
Go to the documentation of this file.
1 /**
2  * \file AlignmentParams.h
3  * \brief Parameters for alignments.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPMULTIFIT_ALIGNMENT_PARAMS_H
9 #define IMPMULTIFIT_ALIGNMENT_PARAMS_H
10 
11 #include <vector>
12 #include <string>
13 #include <IMP/multifit/multifit_config.h>
14 #include <IMP/base/value_macros.h>
15 #include <boost/property_tree/ptree.hpp>
16 #include <iostream>
17 #include <stdio.h>
18 
19 IMPMULTIFIT_BEGIN_NAMESPACE
20 
21 struct DominoParams {
22  DominoParams() : max_value_threshold_(10.),
23  max_anchor_penetration_(0.1),
24  heap_size_(10000),cache_size_(50000){}
25  void add(const boost::property_tree::ptree &pt) {
26  max_value_threshold_ = pt.get<float>("domino.max_value_threshold");
27  max_num_states_for_subset_ =
28  pt.get<int>("domino.max_num_states_for_subset");
29  max_anchor_penetration_ = pt.get<float>("domino.max_anchor_penetration");
30  heap_size_ = pt.get<int>("domino.heap_size");
31  cache_size_ = pt.get<int>("domino.cache_size");
32  }
33  void show(std::ostream& s=std::cout) const{
34  s<<"domino parameters: max_val_thr="<<max_value_threshold_
35  <<" max_num_states4subset="<<max_num_states_for_subset_
36  <<" max_anchor_penetration="<<max_anchor_penetration_
37  <<" heap_size="<<heap_size_
38  <<"cache_size="<<cache_size_<<std::endl;
39  }
40  float max_value_threshold_;
41  int max_num_states_for_subset_;
42  float max_anchor_penetration_;
43  int heap_size_;
44  int cache_size_;
45 };
47 
48 struct XlinkParams {
49  XlinkParams() : upper_bound_(10.),
50  k_(0.05),
51  max_xlink_val_(3.),
52  treat_between_residues_(true)
53  {}
54  void add(const boost::property_tree::ptree &pt) {
55  upper_bound_ = pt.get<float>("xlink.upper_bound");
56  k_ = pt.get<float>("xlink.k");
57  max_xlink_val_ = pt.get<float>("xlink.max_value");
58  treat_between_residues_ = pt.get<bool>("xlink.between_residues");
59  }
60 
61  void show(std::ostream& s=std::cout) const{
62  s<<"xlink parameters: upper_bound:"<<upper_bound_<<" k:"<<k_<<
63  "max_xlink_val_="<<max_xlink_val_
64  <<" treat_between_residues_="<<treat_between_residues_
65  <<std::endl;
66  }
67  float upper_bound_,k_;
68  float max_xlink_val_;
69  bool treat_between_residues_;
70 };
72 
73 struct ConnectivityParams {
74  ConnectivityParams() : upper_bound_(10.),
75  k_(0.05),//corresponding to 3.5A
76  max_conn_rest_val_(2.){}
77  void add(const boost::property_tree::ptree &pt) {
78  upper_bound_ = pt.get<float>("connectivity.upper_bound");
79  k_ = pt.get<float>("connectivity.k");
80  max_conn_rest_val_ = pt.get<float>("connectivity.max_value");
81  }
82  void show(std::ostream& s=std::cout) const{
83  s<<"connectivity parameters: upper_bound="<<upper_bound_
84  <<" k="<<k_
85  <<" max_conn_val="<<max_conn_rest_val_;
86  }
87  //upper bound for the connectivity restraint
88  float upper_bound_;
89  //k used for the connectivity restraint
90  float k_;
91  //maximum value allowed for the protein connectivity restraint
92  float max_conn_rest_val_;
93 };
94 IMP_VALUES(ConnectivityParams, ConnectivityParamsList);
95 
96 
97 struct FragmentsParams {
98  FragmentsParams() : frag_len_(30),bead_radius_scale_(1.),
99  load_atomic_(false),subunit_rigid_(false){}
100  void add(const boost::property_tree::ptree &pt) {
101  frag_len_ = pt.get<int>("fragments.length");
102  bead_radius_scale_ = pt.get<float>("fragments.radius_scale");
103  load_atomic_ = pt.get<bool>("fragments.atomic");
104  subunit_rigid_ = pt.get<bool>("fragments.rigid");
105  }
106  void show(std::ostream& s=std::cout) const{
107  s<<"fragment parameters: frag_len="<<frag_len_
108  <<" bead_rad_scale="<<bead_radius_scale_
109  <<" load_atomic="<<load_atomic_
110  <<" rigid="<<subunit_rigid_;
111  }
112  //number of residues for each fragment
113  int frag_len_;
114  //approximate radius value will be multiplied by this number
115  float bead_radius_scale_;
116  //true if we should load atomic structures
117  bool load_atomic_;
118  //true if the subunits are rigid
119  bool subunit_rigid_;
120 };
121 IMP_VALUES(FragmentsParams, FragmentsParamsList);
122 
123 struct RogParams {
124 public:
125  RogParams() : max_score_(5),scale_(1.6){}
126  void add(const boost::property_tree::ptree &pt) {
127  scale_ = pt.get<float>("radius_of_gyration.scale");
128  max_score_ = pt.get<float>("radius_of_gyration.max_score");
129  }
130  float get_max_score()const{return max_score_;}
131  float get_scale() const {return scale_;}
132  void show(std::ostream& s=std::cout) const{
133  s<<"rog params: scale="<<scale_<<" max_score:"<<max_score_<<std::endl;
134  }
135 private:
136  //maximum score
137  float max_score_,scale_;
138 };
140 
141 struct EVParams {
142 public:
143  EVParams():pair_distance_(3.),
144  pair_slack_(1.),
145  hlb_mean_(2.),
146  hlb_k_(0.59),
147  maximum_ev_score_for_pair_(0.3),
148  allowed_percentage_of_bad_pairs_(0.05),
149  scoring_mode_(1){}
150  void add(const boost::property_tree::ptree &pt) {
151  pair_distance_ = pt.get<float>("excluded_volume.distance");
152  pair_slack_ = pt.get<float>("excluded_volume.slack");
153  hlb_mean_ = pt.get<float>("excluded_volume.lower_bound");
154  hlb_k_ = pt.get<float>("excluded_volume.k");
155  maximum_ev_score_for_pair_
156  = pt.get<float>("excluded_volume.max_score_for_pair");
157  allowed_percentage_of_bad_pairs_
158  = pt.get<float>("excluded_volume.allowed_percentage_of_bad_pairs");
159  scoring_mode_ = pt.get<int>("excluded_volume.scoring_mode");
160  //possible scoring modes are 0-2
161  if (scoring_mode_ < 0 || scoring_mode_ > 2) {
162  throw boost::property_tree::ptree_bad_data(
163  "excluded_volume.scoring_mode should be 0, 1, or 2",
164  scoring_mode_);
165  }
166  }
167  void show(std::ostream& s=std::cout) const{
168  s<<"EV params: pair_distance="<<pair_distance_<<
169  " pair_slack="<<pair_slack_<<
170  " mean="<<hlb_mean_<<" k="<<hlb_k_<<
171  " maximum_ev_score_for_pair:"<<maximum_ev_score_for_pair_<<
172  " allowed_percentage_of_bad_pairs:"<<allowed_percentage_of_bad_pairs_<<
173  " scoing_mode:"<<scoring_mode_<<std::endl;
174  }
175  float pair_distance_,pair_slack_,hlb_mean_,hlb_k_,maximum_ev_score_for_pair_;
176  float allowed_percentage_of_bad_pairs_;
177  int scoring_mode_;//0 means EV restraints are OFF
178  //1 means EV between all pairs is calculated
179  //2 means EV only between selected pairs is calculated
180 };
182 
183 struct FiltersParams {
184 public:
185  FiltersParams() : max_num_violated_xlink_(4),
186  max_num_violated_conn_(4),
187  max_num_violated_ev_(3){}
188  void add(const boost::property_tree::ptree &pt) {
189  max_num_violated_conn_ = pt.get<int>("filters.conn_max_violations");
190  max_num_violated_xlink_ = pt.get<int>("filters.xlink_max_violations");
191  max_num_violated_ev_ = pt.get<int>("filters.ev_max_violations");
192  }
193  void show(std::ostream& s=std::cout) const{
194  s<<"filters params: max_num_violated_xlink="<<max_num_violated_xlink_
195  <<" max_num_violated_conn:"<<max_num_violated_conn_
196  <<"max num_violated_ev:"<<max_num_violated_ev_<<std::endl;
197  }
198 public:
199  int max_num_violated_xlink_,max_num_violated_conn_;
200  int max_num_violated_ev_;
201 };
203 
204 
205 
206 struct FittingParams {
207 public:
208  FittingParams() : pca_max_angle_diff_(15.),
209  pca_max_size_diff_(10.),
210  pca_max_cent_dist_diff_(10.), max_asmb_fit_score_(.5){}
211  void add(const boost::property_tree::ptree &pt) {
212  pca_max_angle_diff_ = pt.get<float>("fitting.pca_max_angle_diff");
213  pca_max_size_diff_ = pt.get<float>("fitting.pca_max_size_diff");
214  pca_max_cent_dist_diff_ = pt.get<float>("fitting.pca_max_cent_dist_diff");
215  max_asmb_fit_score_ = pt.get<float>("fitting.max_asmb_fit_score");
216  }
217  void show(std::ostream& s=std::cout) const{
218  s<<"filters params: pca_max_angle_diff="<<pca_max_angle_diff_
219  <<" pca_max_size_diff:"<<pca_max_size_diff_
220  <<"pca_max_cent_dist_diff:"<<pca_max_cent_dist_diff_
221  <<"max_asmb_fit_score:"<<max_asmb_fit_score_<<std::endl;
222  }
223 public:
224  float pca_max_angle_diff_,pca_max_size_diff_;
225  float pca_max_cent_dist_diff_,max_asmb_fit_score_;
226 };
228 
229 
230 struct ComplementarityParams {
231 public:
232  ComplementarityParams() : max_score_(100000),
233  max_penetration_(200),
234  interior_layer_thickness_(2),
235  boundary_coef_(-3),comp_coef_(1),penetration_coef_(2){}
236  void add(const boost::property_tree::ptree &pt) {
237  max_score_ = pt.get<float>("complementarity.max_score");
238  max_penetration_ = pt.get<float>("complementarity.max_penetration");
239  interior_layer_thickness_
240  = pt.get<float>("complementarity.interior_layer_thickness");
241  boundary_coef_ = pt.get<float>("complementarity.boundary_coef");
242  comp_coef_ = pt.get<float>("complementarity.comp_coef");
243  penetration_coef_ = pt.get<float>("complementarity.penetration_coef");
244  }
245  void show(std::ostream& s=std::cout) const{
246  s<<"complementarity params: max_score="<<max_score_
247  <<" max penetration:"<<max_penetration_
248  <<" interior layer thickness:"<<interior_layer_thickness_
249  <<" boundary coeffiecent:"<<boundary_coef_
250  <<" complementarity coefficient: "<<comp_coef_
251  <<" penetration coefficient: "<<penetration_coef_<<std::endl;
252  }
253 public:
254  float max_score_,max_penetration_;
255  float interior_layer_thickness_;
256  float boundary_coef_, comp_coef_, penetration_coef_;
257 };
258 IMP_VALUES(ComplementarityParams, ComplementarityParamsList);
259 
260 class IMPMULTIFITEXPORT AlignmentParams {
261  public:
262  AlignmentParams(const char* param_filename);
263  const DominoParams& get_domino_params() const { return domino_params_;}
264  const FittingParams& get_fitting_params() const { return fitting_params_;}
265  const ComplementarityParams& get_complementarity_params() const {
266  return complementarity_params_;}
267  const XlinkParams& get_xlink_params() const { return xlink_params_;}
268  const ConnectivityParams& get_connectivity_params() const {
269  return conn_params_;
270  }
271  const RogParams& get_rog_params() const { return rog_params_;}
272  const FragmentsParams& get_fragments_params() const {
273  return fragments_params_;
274  }
275  const FiltersParams& get_filters_params() const { return filters_params_;}
276  const EVParams& get_ev_params() const { return ev_params_;}
277  void show(std::ostream& s=std::cout) const {
278  s<<"alignment parameters"<<std::endl;
279  fitting_params_.show(s);s<<std::endl;
280  complementarity_params_.show(s);s<<std::endl;
281  domino_params_.show(s);s<<std::endl;
282  fragments_params_.show(s);s<<std::endl;
283  rog_params_.show(s);s<<std::endl;
284  conn_params_.show(s);s<<std::endl;
285  xlink_params_.show(s);s<<std::endl;
286  filters_params_.show(s);s<<std::endl;
287  ev_params_.show(s);s<<std::endl;
288 }
289 private:
290  DominoParams domino_params_;
291  FittingParams fitting_params_;
292  ComplementarityParams complementarity_params_;
293  XlinkParams xlink_params_;
294  ConnectivityParams conn_params_;
295  FragmentsParams fragments_params_;
296  RogParams rog_params_;
297  FiltersParams filters_params_;
298  EVParams ev_params_;
299 };
300 IMP_VALUES(AlignmentParams, AlignmentParamsList);
301 
302 IMPMULTIFIT_END_NAMESPACE
303 
304 #endif /* IMPMULTIFIT_ALIGNMENT_PARAMS_H */