Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RawStruct.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file core/io/raw_data/RawStruct.cc
12 ///
13 /// @brief Struct base class
14 /// @author James Thompson, Monica Berrondo
15 
16 // C++ Headers
17 #include <string>
18 #include <map>
19 
20 // mini headers
22 // AUTO-REMOVED #include <core/pose/Pose.hh>
23 // AUTO-REMOVED #include <core/chemical/ResidueTypeSet.hh>
24 
25 #include <ObjexxFCL/format.hh>
26 
27 #include <utility/vector1.hh>
28 #include <basic/Tracer.hh>
29 
30 namespace core {
31 namespace io {
32 namespace raw_data {
33 
34 using namespace ObjexxFCL::fmt;
35 
36 static int precision (3);
37 
39 }
40 
41 // Print the energy line/header into silent files
42 // You must supply a score_map (from the CachedData in the pose)
43 // which is customized in the protocol and returned to the job distributor
44 // (or to your main function)
45 void
47  std::ostream& out,
48  std::map < std::string, core::Real > const & score_map,
49  std::map < std::string, std::string > const & string_map,
50  bool print_sequence // = true
51 ) const {
52  using namespace ObjexxFCL;
53 
54  std::map< std::string, Real >::const_iterator pair;
55  std::map< std::string, std::string>::const_iterator string_pair;
56  Size width (8);
57 
58  if (print_sequence) out << "SEQUENCE: " << sequence_ << std::endl;
59  out << "SCORE:";
60 
61  // show score first
62  pair = score_map.find( "total_score" );
63  if (pair != score_map.end()) {
64  if ( pair->first.length() > 8 ) width = pair->first.length();
65  out << ' ' << A( width, pair->first );
66  }
67  pair = score_map.find( "score" );
68  if (pair != score_map.end()) {
69  if ( pair->first.length() > 8 ) width = pair->first.length();
70  out << ' ' << A( width, pair->first );
71  }
72  pair = score_map.find( "rms" );
73  if (pair != score_map.end()) {
74  if ( pair->first.length() > 8 ) width = pair->first.length();
75  out << ' ' << A( width, pair->first );
76  }
77 
78  for ( pair=score_map.begin(); pair!=score_map.end(); ++pair )
79  {
80  if (pair->first == "total_score" || pair->first == "score" || pair->first == "rms") continue;
81  if ( pair->first.length() > 8 ) width = pair->first.length();
82  out << ' ' << A( width, pair->first );
83  }
84  for ( string_pair=string_map.begin(); string_pair!=string_map.end(); ++string_pair )
85  {
86  width = std::max( Size( std::max(string_pair->first.length(), string_pair->second.length() ) ), Size(8) );
87  out << ' ' << A( width, string_pair->first );
88  }
89  out << " description " << std::endl;
90 }
91 
92 void
94  std::ostream& out,
95  std::map < std::string, core::Real > const & score_map,
96  std::map < std::string, std::string > const & string_map
97 ) const {
98  std::map< std::string, Real >::const_iterator pair;
99  std::map< std::string, std::string>::const_iterator string_pair;
100  Size width (8);
101 
102  out << "SCORE:";
103 
104  // show score first
105  pair = score_map.find( "total_score" );
106  if (pair != score_map.end()) {
107  if ( pair->first.length() > 8 ) width = pair->first.length();
108  out << ' ' << F( width, precision, pair->second );
109  }
110  pair = score_map.find( "score" );
111  if (pair != score_map.end()) {
112  if ( pair->first.length() > 8 ) width = pair->first.length();
113  out << ' ' << F( width, precision, pair->second );
114  }
115  pair = score_map.find( "rms" );
116  if (pair != score_map.end()) {
117  if ( pair->first.length() > 8 ) width = pair->first.length();
118  out << ' ' << F( width, precision, pair->second );
119  }
120 
121  for ( pair=score_map.begin(); pair!=score_map.end(); ++pair )
122  {
123  if (pair->first == "total_score" || pair->first == "score" || pair->first == "rms") continue;
124  if ( pair->first.length() > 8 ) width = pair->first.length();
125  out << ' ' << F( width, precision, pair->second );
126  }
127  for ( string_pair=string_map.begin(); string_pair!=string_map.end(); ++string_pair )
128  {
129  width = std::max( Size( std::max(string_pair->first.length(), string_pair->second.length() ) ), Size(8) );
130  out << ' ' << A( width, string_pair->second );
131  }
132  out << " " << decoy_tag_ << std::endl;
133 }
134 
135 void
136 RawStruct::print_conformation( std::ostream& out ) const {
137  out << "Don't know how to print_conformation from RawStruct! Use a derived class!" << decoy_tag_ << std::endl;
138 }
139 
141  basic::T("core.io.silent.RawStruct")
142  << "Warning: calling get_debug_rmsd() method of RawStruct!";
143  return 0;
144 }
145 
146 
147 } // namespace silent
148 } // namespace io
149 } // namespace core