Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BurialEnergy.cc
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/methods/BurialEnergy.cc
11 /// @author James Thompson
12 
15 
18 
19 #include <core/pose/Pose.hh>
20 
21 #include <basic/prof.hh>
22 #include <core/scoring/Energies.hh>
24 // AUTO-REMOVED #include <core/scoring/EnergyGraph.hh>
27 
28 #include <basic/options/option.hh>
29 #include <basic/options/keys/in.OptionKeys.gen.hh>
30 
31 #include <utility/io/izstream.hh>
32 #include <utility/file/FileName.hh>
33 #include <ObjexxFCL/string.functions.hh>
34 
35 #include <utility/vector1.hh>
36 
37 
38 namespace core {
39 namespace scoring {
40 namespace methods {
41 
42 /// @details This must return a fresh instance of the BurialEnergy class,
43 /// never an instance already in use
47 ) const {
48  return new BurialEnergy;
49 }
50 
53  ScoreTypes sts;
54  sts.push_back(burial);
55  return sts;
56 }
57 
58 void
60  pose::Pose & pose, ScoreFunction const &
61 ) const {
63 }
64 
65 /// clone
68  return new BurialEnergy;
69 }
70 
71 /////////////////////////////////////////////////////////////////////////////
72 // scoring
73 /////////////////////////////////////////////////////////////////////////////
74 
75 void
77  core::conformation::Residue const & rsd,
78  core::pose::Pose const & pose,
79  EnergyMap & emap
80 ) const {
81  static const core::Real dist_sq_cutoff(100);
82  static const core::Size NN_cutoff(16);
83 
84  TwelveANeighborGraph const & graph ( pose.energies().twelveA_neighbor_graph() );
85 
86  core::conformation::Atom const & atom_i = rsd.atom(rsd.nbr_atom());
87 
88  // iterate across neighbors within 12 angstroms, count number <10A
89  Size countN(0);
91  ir = graph.get_node( rsd.seqpos() )->const_edge_list_begin(),
92  ire = graph.get_node( rsd.seqpos() )->const_edge_list_end();
93  ir != ire; ++ir ) {
94  Size const j( (*ir)->get_other_ind( rsd.seqpos() ) );
95  core::conformation::Residue const & rsd_j( pose.residue(j) );
96 
97  core::conformation::Atom const & atom_j = rsd_j.atom(rsd_j.nbr_atom());
98  Real sqdist = atom_i.xyz().distance_squared( atom_j.xyz() );
99  if ( sqdist < dist_sq_cutoff ) {
100  countN++;
101  }
102  }
103  //std::cout << "countN(" << ii << ") = " << countN << std::endl;
104 
105  Real const & burial_prediction( pred_burial_[rsd.seqpos()] );
106  Real score = burial_prediction;
107  if ( countN < NN_cutoff ) {
108  emap[ burial ] += -1 * score;
109  } else {
110  emap[ burial ] += score;
111  }
112 }
113 
116 {
117  return 1;
118 }
119 
120 void
122 {
123  context_graphs_required[ twelve_A_neighbor_graph ] = true;
124 }
125 
127  using namespace basic::options;
128  using namespace basic::options::OptionKeys;
129 
130  std::string const & burial_fn( option[ in::file::burial ]()[1] );
131  //utility::vector1< core::Real > pred_burial_;
132  utility::io::izstream input(burial_fn);
133  if ( !input.good() ) {
134  std::string const msg( "Error opening file: " + burial_fn );
135  utility_exit_with_message( msg );
136  }
137 
138  using std::string;
139  string line;
140  getline(input,line); // header
141  while (getline(input,line) ) {
142  std::istringstream ss(line);
143  core::Size resi;
144  char aa;
145  ss >> resi >> aa;
146  string last_token;
147  while ( ss.good() ) ss >> last_token;
148  std::istringstream dbl_reader( last_token.substr(2,4) );
149  Real burial(0);
150  dbl_reader >> burial;
151  if ( last_token.substr(0,1) == "0" ) burial *= -1;
152  pred_burial_.push_back( burial );
153  //std::cout << "line = " << line << std::endl;
154  //std::cout << "burial = " << burial << std::endl;
155  }
156 }
157 
158 } // methods
159 } // scoring
160 } // core