Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RawFileData.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/silent/RawFileData.cc
12 ///
13 /// @brief FileData base class
14 /// @author James Thompson, Monica Berrondo
15 
16 // C++ Headers
17 #include <vector>
18 #include <string>
19 #include <map>
20 
21 // mini headers
24 #include <utility/io/izstream.hh>
25 #include <utility/io/ozstream.hh>
26 
27 // AUTO-REMOVED #include <core/pose/Pose.hh>
28 
29 #include <utility/vector1.hh>
30 #include <utility/file/file_sys_util.hh>
31 
32 
33 namespace core {
34 namespace io {
35 namespace raw_data {
36 
39  utility::io::izstream data( filename.c_str() );
40  if ( !data ) {
41  std::cerr << "ERROR:: Unable to open silent_input file: " << filename << std::endl;
42  return tags_in_file;
43  }
44 
45  std::string line,tag;
46  getline( data, line ); // sequence line
47  getline( data, line ); // score line
48 
49  while( getline(data,line) ) {
50  if ( line.substr(0,7) == "SCORE: " ) {
51  std::istringstream l( line );
52 
53  std::string current_word;
54  while ( !l.fail() ) {
55  l >> current_word;
56  }
57  tags_in_file.push_back( current_word );
58  }
59  } // while( getline(data,line) )
60 
61  return tags_in_file;
62  } // read_tags_fast
63 
65  const std::string filename,
66  std::map < std::string, core::Real > const & score_map
67  ) {
68  bool print_header( true );
69  utility::io::ozstream output;
70  if ( !utility::file::file_exists( filename ) ) {
71  output.open( filename );
72  print_header = true;
73  } else {
74  output.open_append( filename );
75  }
76 
77  for ( core::io::raw_data::RawFileData::iterator iter = begin(), it_end = end(); iter != it_end; ++iter ) {
78  if ( print_header ) {
79  iter->print_header( output, score_map );
80  print_header = false;
81  }
82 
83  iter->print_scores ( output, score_map );
84  iter->print_conformation( output );
85  }
86  } // write_all
87 
88 } // namespace silent
89 } // namespace io
90 } // namespace core