Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PredictedBurialEvaluator.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 /// @author James Thompson
11 
12 // Unit headers
14 
15 // Package headers
16 #include <core/types.hh>
17 #include <ObjexxFCL/string.functions.hh>
19 #include <core/pose/Pose.hh>
21 #include <utility/io/izstream.hh>
22 #include <string>
23 
24 #include <utility/vector1.hh>
25 
26 
27 namespace protocols {
28 namespace simple_filters {
29 
31  std::string const & fn
32 ) : evaluation::SingleValuePoseEvaluator< core::Real >( "burial" )
33 {
34  init_from_file(fn);
35 }
36 
38 
40  core::pose::Pose & pose,
43 ) const {
44  using core::Real;
45  using core::Size;
46 
47  Real score(0.0);
48  for ( Size ii = 1; ii <= pose.total_residue(); ++ii ) {
49  core::conformation::Residue const & resi( pose.residue(ii) );
50  Size countN(0);
51  for ( Size jj = 1; jj <= pose.total_residue(); ++jj ) {
52  core::conformation::Residue const & resj( pose.residue(jj) );
53  core::Real const distance(
54  resi.xyz(resi.nbr_atom()).distance( resj.xyz(resj.nbr_atom()) )
55  );
56 
57  if ( distance < 10 ) countN++;
58  }
59 
60  Real const burial_prediction( predicted_burial_[ii]);
61  Real const score_ii( -1 * burial_prediction * countN );
62  score += score_ii;
63  }
64 
65  ss.add_energy( "burial", score );
66 }
67 
69  std::string const &
70 ) {
71  utility::io::izstream input;
72  std::string line;
73 
74  predicted_burial_.clear();
75  while ( getline(input,line) ) {
76  if ( line.substr(9,1) == "[" ) {
77  std::istringstream line_input(line);
78  std::string token;
79  line_input >> token;
80  while( !line_input.fail() ) line_input >> token;
81 
82  float pred = ObjexxFCL::float_of( token.substr(2,4) );
83  if ( token.substr(1,1) == "1" ) pred *= -1;
84  std::cout << "line = " << line << std::endl;
85  std::cout << "pred = " << pred << std::endl;
86  predicted_burial_.push_back(pred);
87  }
88  }
89 }
90 
91 } // simple_filter
92 } // protocols