Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HolesParamsRes.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/scoring/packing/HolesParamsRes.cc
11 /// @brief Packing Score Params
12 /// @author Will Sheffler
13 
14 #ifndef INCLUDED_core_scoring_packing_HolesParamsRes_hh
15 #define INCLUDED_core_scoring_packing_HolesParamsRes_hh
16 
17 #include <core/types.hh>
18 
19 #include <basic/database/open.hh>
20 #include <basic/options/option.hh>
21 
22 #include <utility/io/izstream.hh>
23 #include <utility/exit.hh>
24 
25 // option key includes
26 
27 #include <basic/options/keys/holes.OptionKeys.gen.hh>
28 
29 #include <utility/vector1.hh>
30 
31 
32 
33 
34 namespace core {
35 namespace scoring {
36 namespace packing {
37 
38 
40 public:
41 
43  read_data_file( fname );
44  }
45 
46  void read_data_file( std::string fname ) {
47  using namespace std;
48  using namespace utility;
49  using namespace basic::options;
50  using namespace basic::options::OptionKeys;
51  using namespace utility;
52 
53  res_size_["ALA"] = 5;
54  res_size_["ARG"] = 11;
55  res_size_["ASN"] = 8;
56  res_size_["ASP"] = 8;
57  res_size_["CYS"] = 6;
58  res_size_["GLN"] = 9;
59  res_size_["GLU"] = 9;
60  res_size_["GLY"] = 4;
61  res_size_["HIS"] = 10;
62  res_size_["ILE"] = 8;
63  res_size_["LEU"] = 8;
64  res_size_["LYS"] = 9;
65  res_size_["MET"] = 8;
66  res_size_["PHE"] = 11;
67  res_size_["PRO"] = 8;
68  res_size_["SER"] = 6;
69  res_size_["THR"] = 7;
70  res_size_["TRP"] = 14;
71  res_size_["TYR"] = 12;
72  res_size_["VAL"] = 7;
73 
74  utility::io::izstream in;
75  if( "" != fname ) {
76  in.close();
77  in.clear();
78  in.open( fname.c_str() );
79  } else {
80  std::string paramfile = (std::string)( basic::options::option[ basic::options::OptionKeys::holes::params ]() );
81  if( paramfile[0] == '/' || paramfile[0] == '.' || paramfile[0] == '~' ) {
82  in.close();
83  in.clear();
84  in.open( paramfile.c_str() );
85  } else {
86  basic::database::open( in, paramfile );
87  }
88  }
89  string s;
90  core::Real r;
91  in >> s;
92  while( s != "END" ) {
93  if( s == "INTERCEPT" ) {
94  in >> r;
95  rho_ = r;
96  } else {
97  if( res_size_.find(s) == res_size_.end() ) {
98  std::cerr << "HOLES: can't find res type '" << s << "'" << endl;
99  utility_exit_with_message( "HOLES: can't find res type" );
100  }
101  residues_.push_back(s);
102  int size = res_size_[s];
103  params_[s].reserve(24*size+1);
104  for( int i = 1; i <= 24*size+1; i++ ) {
105  in >> r;
106  params_[s].push_back(r);
107  }
108  }
109  in >> s;
110  }
111  }
112 
114  return params_.find(res)->second;
115  }
116 
117  core::Real rho() const { return rho_; }
118 
119  core::Real rho( std::string res ) const {
120  if( have_params(res) )
121  return params_.find(res)->second[params_.find(res)->second.size()];
122  else return 0;
123  }
124 
126  return residues_[i];
127  }
128 
129  bool have_params( std::string res ) const {
130  return params_.find(res) != params_.end();
131  }
132 
133 private:
135  std::map<std::string,core::Size> res_size_;
136  std::map<std::string,utility::vector1<core::Real> > params_;
138 };
139 
140 } // end packing
141 } // end scoring
142 } // end core
143 
144 #endif // INCLUDED_core_scoring_packing_HolesParamsRes_HH