Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LazySilentFilePoseInputStream.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 src/core/import_pose/pose_stream/LazySilentFilePoseInputStream.hh
11 /// @brief
12 /// @author James Thompson
13 
14 // libRosetta headers
15 
16 #include <core/types.hh>
17 
19 
20 #include <core/pose/Pose.hh>
22 
25 #include <core/pose/util.hh>
26 
27 #include <utility/vector1.hh>
28 #include <utility/file/FileName.hh>
29 // AUTO-REMOVED #include <utility/file/file_sys_util.hh>
30 
34 
35 #include <basic/Tracer.hh>
36 #include <basic/datacache/BasicDataCache.hh>
37 #include <basic/datacache/CacheableString.hh>
38 
39 #include <basic/options/option.hh>
40 #include <basic/options/keys/run.OptionKeys.gen.hh>
41 
42 // C++ headers
43 #include <string>
44 
45 //Auto Headers
46 
47 namespace core {
48 namespace import_pose {
49 namespace pose_stream {
50 
51 static basic::Tracer tr( "core.io.pose_stream" );
52 
55 
57  bool has_another(true);
58  if ( current_filename_ == filenames_.end() && current_struct_ == sfd_.end() ) {
59  has_another = false;
60  }
61  return has_another;
62 }
63 
65  core::pose::Pose & pose,
66  core::chemical::ResidueTypeSet const & residue_set
67 ) {
68  // check to make sure that we have more poses!
69  if ( !has_another_pose() ) {
70  utility_exit_with_message(
71  "LazySilentFilePoseInputStream: called fill_pose, but I have no more Poses!"
72  );
73  }
74 
75  static basic::Tracer tr( "core.io.pose_stream.lazy_silent_file" );
76 
77  using namespace basic::options;
78  using namespace basic::options::OptionKeys;
79  if ( option[ run::debug ]() ) {
80  core::Real debug_rmsd = current_struct_->get_debug_rmsd();
81  tr.Debug << "RMSD to original coordinates for tag "
82  << current_struct_->decoy_tag() << " = " << debug_rmsd << std::endl;
83  }
84 
85  current_struct_->fill_pose( pose, residue_set );
86  pose.data().set(
88  new basic::datacache::CacheableString( current_struct_->decoy_tag() )
89  );
90  tr.Debug << "decoy_tag() == " << current_struct_->decoy_tag() << std::endl;
91 
92  core::pose::setPoseExtraScores( pose, "silent_score", current_struct_->get_energy( "score" ) );
93  preprocess_pose( pose );
94 
95  // increment counters
97  if ( current_struct_ == sfd_.end() && current_filename_ != filenames_.end() ) {
99  if ( current_filename_ != filenames_.end() ) {
100  sfd_.clear();
101  tr.Debug << "reading silent-file named " << *current_filename_ << std::endl;
104  }
105  }
106 
107  tr.flush_all_channels();
108 } // fill_pose
109 
111  core::pose::Pose & pose
112 ) {
113  // check to make sure that we have more poses!
114  if ( !has_another_pose() ) {
115  utility_exit_with_message(
116  "LazySilentFilePoseInputStream: called fill_pose, but I have no more Poses!"
117  );
118  }
119 
120  static basic::Tracer tr( "core.io.pose_stream.lazy_silent_file" );
121 
122  using namespace basic::options;
123  using namespace basic::options::OptionKeys;
124  if ( option[ run::debug ]() ) {
125  core::Real debug_rmsd = current_struct_->get_debug_rmsd();
126  tr.Debug << "RMSD to original coordinates for tag "
127  << current_struct_->decoy_tag() << " = " << debug_rmsd << std::endl;
128  }
129 
130  current_struct_->fill_pose( pose );
131  pose.data().set(
133  new basic::datacache::CacheableString( current_struct_->decoy_tag() )
134  );
135  tr.Debug << "decoy_tag() == " << current_struct_->decoy_tag() << std::endl;
136 
137  core::pose::setPoseExtraScores( pose, "silent_score", current_struct_->get_energy( "score" ) );
138  preprocess_pose( pose );
139 
140  // increment counters
141  ++current_struct_;
142  if ( current_struct_ == sfd_.end() && current_filename_ != filenames_.end() ) {
144  if ( current_filename_ != filenames_.end() ) {
145  sfd_.clear();
146  tr.Debug << "reading silent-file named " << *current_filename_ << std::endl;
149  }
150  }
151 
152  tr.flush_all_channels();
153 } // fill_pose
154 
159 }
160 
162  return filenames_;
163 }
164 
165 } // pose_stream
166 } // import_pose
167 } // core