Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
not_universal_main.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/jobdist/not_universal_main.cc
11 /// @brief Simple main method for applying a Mover to a set of
12 /// input Poses.
13 /// @author James Thompson
14 
15 #include <core/types.hh>
16 
17 #include <core/io/pdb/pose_io.hh>
24 
25 #include <core/scoring/rms_util.hh>
28 #include <core/pose/Pose.hh>
29 #include <core/pose/util.hh>
30 
32 #include <basic/Tracer.hh>
33 
34 #include <protocols/moves/Mover.hh>
37 
38 #include <string>
39 
40 // option key includes
41 #include <basic/options/option.hh>
42 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
43 #include <basic/options/keys/out.OptionKeys.gen.hh>
44 #include <basic/options/keys/run.OptionKeys.gen.hh>
45 #include <basic/options/keys/in.OptionKeys.gen.hh>
46 
48 #include <utility/vector1.hh>
49 
50 
51 
52 namespace protocols {
53 namespace jobdist {
54 
55 static basic::Tracer tr("protocols.jobdist.not_universal_main");
56 
58  core::pose::Pose & pose,
59  utility::vector1< std::string > const & user_tags
60 ) {
61  using std::string;
62  using utility::vector1;
63 
64  bool valid_tag( false );
65  std::string this_id( "" );
66  get_comment( pose, "user_tag", this_id );
67  if ( this_id == "" ) get_comment( pose, "user_ta", this_id );
68  if ( this_id == "" ) {
69  tr.Error << "can't find user_tag in pose!" << std::endl;
70  }
71 
73  for ( iter it = user_tags.begin(), end = user_tags.end();
74  it != end && !valid_tag && this_id != ""; ++it
75  ) {
76  if ( this_id.find( *it ) != std::string::npos ) {
77  break;
78  valid_tag = true;
79  tr.Debug << "processing Pose with user_tag " << this_id << std::endl;
80  }
81  } // for user_tags
82 
83  if ( !valid_tag ) {
84  tr.Warning << "skipping Pose with user_tag " << this_id << std::endl;
85  }
86 
87  return valid_tag;
88 }
89 
90 /////////////////////////////////////////////////////////////////////////////
91 /// @brief main function that applies a mover to a set of input poses and
92 /// only does silent-file output. Similar in idea to universal_main, but
93 /// without all of the code duplication for silent-files/PDB files.
96 ) {
97  using namespace basic::options;
98  using namespace basic::options::OptionKeys;
99  using namespace core::chemical;
100  using namespace core::io::silent;
101  using namespace core::import_pose::pose_stream;
102 
103  using core::Size;
104  using core::Real;
105  using std::string;
106  using utility::vector1;
107 
110  option[ in::file::residue_type_set ]()
111  );
112 
113  core::pose::Pose native_pose, current_pose;
114  if ( option[ in::file::native ].user() ) {
116  native_pose, *rsd_set, option[ in::file::native ]()
117  );
118  }
119 
121  if ( option[ constraints::cst_weight ].user() ) {
122  Real const weight( option[ constraints::cst_weight ]() );
123  scorefxn->set_weight( core::scoring::angle_constraint, weight );
124  scorefxn->set_weight( core::scoring::dihedral_constraint, weight );
125  scorefxn->set_weight( core::scoring::atom_pair_constraint, weight );
126  scorefxn->set_weight( core::scoring::dunbrack_constraint, weight );
127  scorefxn->set_weight( core::scoring::coordinate_constraint, weight );
128  }
129  scorefxn->show( tr.Debug );
130  tr.flush_all_channels();
131 
132  vector1< string > user_tags;
133  if ( option[ in::file::user_tags ].user() ) {
134  user_tags = option[ in::file::user_tags ]();
135  }
136 
138 
139  Size const n_repeats( option[ run::repeat ]() );
140 
141  SilentFileData sfd_out;
142  while( input.has_another_pose() ) {
143  input.fill_pose( current_pose, *rsd_set );
144 
145  if ( option[ in::file::user_tags ].user() ) {
146  if ( ! pose_matches_user_tag( current_pose, user_tags ) ) {
147  continue;
148  }
149  }
150 
151  for ( Size ii = 1; ii <= n_repeats; ++ii ) {
152  // only keep input scores if specified by the user.
153  if ( !option[ in::file::keep_input_scores ]() ) {
154  clearPoseExtraScores( current_pose );
155  }
156 
158  current_pose.conformation(), "start_pose"
159  );
160 
161  mover.apply( current_pose );
162 
163  // rescore the Pose if necessary, on by default.
164  if ( option[ in::file::rescore ]() ) {
165  (*scorefxn)(current_pose);
166  }
167 
168  // output
169  if ( !option[ out::nooutput ]() ) {
172  ss->fill_struct( current_pose );
173 
174  // add model quality information if a native was given.
175  if ( option[ in::file::native ].user() ) {
177  = core::scoring::CA_rmsd( native_pose, current_pose );
179  = core::scoring::CA_maxsub( native_pose, current_pose );
181  = core::scoring::CA_gdtmm( native_pose, current_pose );
182  ss->add_energy( "rmsd", CA_rmsd );
183  ss->add_energy( "maxsub", CA_maxsub );
184  ss->add_energy( "gdtmm", CA_gdtmm );
185  }
186 
187  sfd_out.write_silent_struct( *ss, option[ out::file::silent ]() );
188  } // if ( !option[ out::nooutput ]() )
189  }
190  tr.flush();
191  } // while( input.has_another_pose() )
192  tr.flush();
193 
194  return 0;
195 } // not_universal_main
196 
197 } // jobdist
198 } // protocols