Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnzdesJobOutputter.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 protocols/enzdes/EnzdesJobOutputter.cc
12 /// @brief implementation for EnzdesJobOutputter
13 /// @author Florian Richter (floric@u.washington.edu), september 2010
14 
15 
16 
17 //unit headers
20 
21 //package headers
22 #include <protocols/jd2/Job.hh>
24 
25 //project headers
29 #include <basic/options/option.hh>
30 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
31 #include <basic/options/keys/out.OptionKeys.gen.hh>
32 #include <core/pose/Pose.hh>
33 
38 
39 //utility headers
40 #include <utility/file/FileName.hh>
41 #include <utility/file/file_sys_util.hh>
42 #include <utility/io/ozstream.hh>
43 
44 #include <utility/vector1.hh>
45 
46 
47 namespace protocols {
48 namespace enzdes {
49 
50 
51 
53 : parent(),
54  scorefile_writer_(NULL),
55  enz_scofile_(NULL),
56  silent_output_(false),
57  silent_job_outputter_(NULL)
58 {
59 
60  if( basic::options::option[ basic::options::OptionKeys::out::file::silent_struct_type ].user() ){
61  silent_output_ = true;
63  silent_job_outputter_->set_write_separate_scorefile( false );
64  silent_job_outputter_->set_silent_file_name( utility::file::FileName( basic::options::option[ basic::options::OptionKeys::out::file::o ]) );
65  }
66 
67  if( !this->write_scorefile() ) return;
70  if( basic::options::option[ basic::options::OptionKeys::out::overwrite ].user() ){
71  if( utility::file::file_exists( scorefile_name().name() ) ) utility::file::file_delete( scorefile_name().name() );
72  }
73 }
74 
76 
77 void
79 {
80  if( silent_output_){
81  silent_job_outputter_->final_pose(job, pose);
82  this->scorefile( job, pose );
83  }
84  else parent::final_pose(job, pose);
85 }
86 
87 bool
89 {
90  if( silent_output_ ) return silent_job_outputter_->job_has_completed( job );
91  return parent::job_has_completed( job );
92 }
93 
94 void
97  core::pose::Pose const & pose,
98  std::string, //tag,
99  std::string //scorefile
100 )
101 {
102  if( !this->write_scorefile() ) return;
103 
105  if( enz_obs ){
106  if( enz_obs->cst_cache() ) enz_scofile_->set_cstio( enz_obs->cst_cache()->enzcst_io() );
107  }
108 
109  enz_scofile_->examine_pose( pose );
111 
112  //also add eventual filter reports to the scorefile
113  for( protocols::jd2::Job::StringRealPairs::const_iterator it(job->output_string_real_pairs_begin()), it_end(job->output_string_real_pairs_end());
114  it != it_end; ++it){
115  silent_Es.push_back( core::io::silent::SilentEnergy( it->first, it->second, 1.0, std::max( 10, (int) (it->first).length() + 3 ) ) );
116  }
117 
118  std::string outstruct_name( this->output_name( job ) );
120  ss->precision( 2 );
121  ss->scoreline_prefix( "" );
122  ss->silent_energies( silent_Es );
123 
124  scorefile_writer_->write_silent_struct( *ss, scorefile_name().name(), true );
125 
126  if( basic::options::option[ basic::options::OptionKeys::enzdes::final_repack_without_ligand] &&
127  basic::options::option[ basic::options::OptionKeys::enzdes::dump_final_repack_without_ligand_pdb ] ){
128  utility::io::ozstream out( output_name(job)+"_nlrepack.pdb" );
129  if ( !out.good() ) utility_exit_with_message( "Unable to open file: " + output_name(job)+"_nlrepack.pdb" + "\n" );
130  this->dump_pose( job, *(enz_scofile_->rnl_pose()) , out);
131  out.close();
132  enz_scofile_->clear_rnl_pose();
133  }
134 }
135 
136 //CREATOR SECTION
139 {
140  return "EnzdesJobOutputter";
141 }
142 
145  return new EnzdesJobOutputter;
146 }
147 
148 }//enzdes
149 }//protocols
150 
151 
152 
153