Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NativeEvaluatorCreator.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 protocols/simple_filters/NativeEvaluatorCreator.hh
11 /// @brief Header for NativeEvaluatorCreator
12 /// @author Matthew O'Meara
13 
14 // Unit Headers
16 
17 // Package Headers
19 
20 // Package Headers
25 #include <protocols/loops/Loop.hh>
26 #include <protocols/loops/Loops.hh>
28 
30 
32 #include <core/pose/Pose.hh>
33 
35 
36 // ObjexxFCL Headers
37 #include <ObjexxFCL/string.functions.hh>
38 
39 // Utility headers
40 #include <utility/pointer/ReferenceCount.hh>
41 #include <utility/vector1.hh>
42 #include <utility/file/FileName.hh>
43 
44 #include <basic/options/option.hh>
45 #include <basic/Tracer.hh>
46 
47 // due to template function
49 
50 // option key includes
51 #include <basic/options/option_macros.hh>
52 #include <basic/options/keys/evaluation.OptionKeys.gen.hh>
53 #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
54 #include <basic/options/keys/in.OptionKeys.gen.hh>
55 
57 #include <utility/vector0.hh>
58 
59 #ifdef WIN32
61 #endif
62 
63 #include <utility/exit.hh>
64 #include <fstream>
65 
66 static basic::Tracer tr("protocols.evalution.NativeEvaluatorCreator");
67 
68 namespace protocols {
69 namespace simple_filters {
70 
72 
74  using namespace basic::options;
75  if ( options_registered_ ) return;
76  options_registered_ = true;
77 
78  OPT( in::file::native );
79  OPT( in::file::native_exclude_res );
80  OPT( evaluation::gdtmm );
81  OPT( abinitio::rmsd_residues );
82 
83 }
84 
86  using namespace core;
87  using namespace basic::options;
88  using namespace basic::options::OptionKeys;
89 
90  core::pose::PoseOP native_pose = NULL;
91  if ( option[ in::file::native ].user() ) {
92  native_pose = new core::pose::Pose;
93  core::import_pose::pose_from_pdb( *native_pose, option[ in::file::native ]() );
94  }
95 
96 
97  // set rmsd native
98  if ( native_pose && option[ in::file::native ].user() ) {
99  if ( option[ in::file::native_exclude_res ].user() ) {
101  native_pose,
103  native_pose->total_residue(), option[ in::file::native_exclude_res ]()), "" )
104  );
105  if ( option[ OptionKeys::evaluation::gdtmm ]() ) {
107  native_pose,
108  core::scoring::invert_exclude_residues( native_pose->total_residue(),
109  option[ in::file::native_exclude_res ]()), "" )
110  );
111  }
112  } else if ( option[ OptionKeys::abinitio::rmsd_residues ].user() ){
113  core::Size start = option[ OptionKeys::abinitio::rmsd_residues ]()[ 1 ];
114  Size end = option[ OptionKeys::abinitio::rmsd_residues ]()[ 2 ];
115  eval.add_evaluation( new RmsdEvaluator( native_pose, start, end, "", option[ OptionKeys::abinitio::bGDT ]() ) );
116  } else {
117  eval.add_evaluation( new SelectRmsdEvaluator( native_pose, "" ) );
118  if ( option[ OptionKeys::evaluation::gdtmm ]() ) eval.add_evaluation( new SelectGdtEvaluator( native_pose, "" ) );
119  eval.add_evaluation( new SelectMaxsubEvaluator( native_pose, "" ) );
120  }
121  } // if ( native_pose_ )
122 
123  if ( option[ OptionKeys::evaluation::rmsd_select ].user() ) {
124  utility::vector1< utility::file::FileName > const& rmsd_core( option[ OptionKeys::evaluation::rmsd_select ]() );
125  if ( !option[ in::file::native ].user() ) utility_exit_with_message( "need to specify in:file:native together with rmsd_select " );
126 
127  for ( Size ct = 1; ct <= rmsd_core.size(); ct ++ ) {
128  std::ifstream is( rmsd_core[ ct ].name().c_str() );
129 
130  if (!is.good()) {
131  utility_exit_with_message( "[ERROR] Error opening RBSeg file '" + rmsd_core[ ct ].name() + "'" );
132  }
133 
136  loops::SerializedLoopList loops = reader.read_pose_numbered_loops_file( is, rmsd_core[ ct ].name(), false /*no strict checking */ );
137 
138  loops::Loops core( loops );
139  utility::vector1< Size> selection;
140  core.get_residues( selection );
141  if ( native_pose ) eval.add_evaluation( new simple_filters::SelectRmsdEvaluator( native_pose, selection, rmsd_core[ ct ].base() ) );
142  if ( option[ OptionKeys::evaluation::score_with_rmsd ]() ) {
143  eval.add_evaluation( new simple_filters::TruncatedScoreEvaluator( rmsd_core[ ct ].base(), selection ) );
144  }
145  }
146  }
147 
148 
149 }
150 
152  return "NativeEvaluatorCreator";
153 }
154 
155 } //namespace
156 } //namespace