Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SasaCalculator.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/pose/metrics/SasaCalculator.cc
11 /// @brief SasaCalculator class
12 /// @author John Karanicolas
13 
14 // Unit headers
16 // AUTO-REMOVED #include <core/pose/Pose.hh>
17 
18 // Utility headers
19 #include <basic/Tracer.hh>
20 #include <utility/exit.hh>
21 #include <utility/stream_util.hh>
22 #include <utility/string_util.hh>
23 #include <basic/MetricValue.hh>
24 #include <core/scoring/sasa.hh>
25 
26 #include <cassert>
27 
28 #include <utility/vector1.hh>
29 
30 
31 using namespace core;
32 using namespace core::pose;
33 using namespace core::pose::metrics;
34 
35 namespace core{
36 namespace pose {
37 namespace metrics {
38 namespace simple_calculators {
39 
40 void SasaCalculator::lookup( std::string const & key, basic::MetricValueBase * valptr ) const {
41 
42  if ( key == "total_sasa" ) {
43  basic::check_cast( valptr, &total_sasa_, "total_sasa expects to return a Real" );
44  (static_cast<basic::MetricValue<Real> *>(valptr))->set( total_sasa_ );
45 
46  } else if ( key == "atom_sasa" ) {
47  basic::check_cast( valptr, &atom_sasa_, "atom_sasa expects to return a id::AtomID_Map< Real >" );
48  (static_cast<basic::MetricValue<id::AtomID_Map< Real > > *>(valptr))->set( atom_sasa_ );
49 
50  } else if ( key == "residue_sasa" ) {
51  basic::check_cast( valptr, &residue_sasa_, "residue_sasa expects to return a utility::vector1< Real >" );
52  (static_cast<basic::MetricValue<utility::vector1< Real > > *>(valptr))->set( residue_sasa_ );
53 
54  } else {
55  basic::Error() << "This Calculator cannot compute metric " << key << std::endl;
56  utility_exit();
57  }
58 
59 }
60 
61 
62 std::string SasaCalculator::print( std::string const & key ) const {
63 
64  if ( key == "total_sasa" ) {
65  return utility::to_string( total_sasa_ );
66  } else if ( key == "atom_sasa" ) {
67  basic::Error() << "id::AtomID_Map< Real > has no output operator, for metric " << key << std::endl;
68  utility_exit();
69  } else if ( key == "residue_sasa" ) {
70  return utility::to_string( residue_sasa_ );
71  }
72 
73  basic::Error() << "This Calculator cannot compute metric " << key << std::endl;
74  utility_exit();
75  return "";
76 
77 }
78 
79 
80 void SasaCalculator::recompute( Pose const & this_pose ) {
81  total_sasa_ = core::scoring::calc_per_atom_sasa( this_pose, atom_sasa_, residue_sasa_, probe_radius_);
82 }
83 
84 
85 } // simple_calculators
86 } // metrics
87 } // pose
88 } // core