Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InterfaceAnalyzer.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 apps/public/analysis/InterfaceAnalyzer.cc
11 /// @brief Q&D protocol to run InterfaceAnalyzerMover as protocol
12 /// @author Steven Lewis, Bryan Der, Ben Stranges
13 
14 // Unit Headers
15 #include <protocols/analysis/InterfaceAnalyzerMover.hh>
16 
17 // Project Headers
18 #include <protocols/jd2/JobDistributor.hh>
19 
20 #include <protocols/moves/Mover.hh>
21 
22 #include <core/conformation/Conformation.hh>
23 
24 #include <core/scoring/ScoreFunction.hh>
25 #include <core/scoring/ScoreFunctionFactory.hh>
26 
27 #include <core/pose/Pose.hh>
28 #include <core/pose/PDBInfo.hh>
29 
30 // Utility Headers
31 #include <devel/init.hh>
32 #include <basic/Tracer.hh>
33 #include <basic/options/option.hh>
34 
35 #include <utility/vector1.hh>
36 
37 
38 using basic::T;
39 using basic::Error;
40 using basic::Warning;
41 
42 static THREAD_LOCAL basic::Tracer TR( "apps.public.analysis.InterfaceAnalyzer" );
43 
44 //define local options
46 basic::options::BooleanOptionKey const compute_packstat("compute_packstat");
47 basic::options::BooleanOptionKey const tracer_data_print("tracer_data_print");
50 basic::options::BooleanOptionKey const pack_separated("pack_separated");
52 basic::options::BooleanOptionKey const add_regular_scores_to_scorefile("add_regular_scores_to_scorefile");
55 
56 // mover deffinition
58 public:
59 
60  IAMover();
61 
62  virtual ~IAMover() {};
63 
64  virtual void apply( core::pose::Pose& pose );
65 
66  virtual
67  std::string
68  get_name() const {
69  return "IAMover";
70  }
71 
72  virtual bool reinitialize_for_each_job() const { return true; }
73 
74  virtual bool reinitialize_for_new_input() const { return true; }
75  virtual protocols::moves::MoverOP fresh_instance() const {return protocols::moves::MoverOP( new IAMover );}
76 
77 
79 
80 private:
81  protocols::analysis::InterfaceAnalyzerMoverOP IAM_;
82  core::scoring::ScoreFunctionOP scorefxn_;
83 };
84 
85 IAMover::IAMover() : scorefxn_(core::scoring::get_score_function()) {}
86 
87 //assign the correct constructor for the mover, and figure out the multichain assignment for that ctor
89 
90  core::Size const num_chains(pose.conformation().num_chains());
91 
92  //shared booleans - making local copies for readability
93  bool const tracer = basic::options::option[ tracer_data_print ].value();
94  bool const comp_packstat = basic::options::option[ compute_packstat ].value();
95  bool const pack_in = basic::options::option[ pack_input ].value();
96  bool const pack_sep = basic::options::option[ pack_separated ].value();
97  bool const jobname = basic::options::option[ use_jobname ].value();
98 
99  //if 2 chains, or no multichain ctor, use interface_jump constructor
100  if ( (num_chains <= 2) ) {
101  TR << "Computing interface between two chains in pose" << std::endl;
102  core::Size const interface_jump = basic::options::option[ jumpnum ].value();
103  IAM_ = protocols::analysis::InterfaceAnalyzerMoverOP( new protocols::analysis::InterfaceAnalyzerMover(
104  interface_jump,
105  tracer,
106  scorefxn_,
107  comp_packstat,
108  pack_in,
109  pack_sep,
110  jobname
111  ) );
112  } else if ( basic::options::option[fixedchains].active() ) {
114  //parse the fixed chains to figure out pose chain nums
115  std::set< int > fixed_chains; //This is a set of the CHAIN IDs, not residue ids
116  TR << "Fixed chains are: " ;
117  for ( core::Size j = 1; j <= fixed_chains_string.size(); ++j ) {
118  char this_chain (fixed_chains_string[ j ][0]);
119  for ( core::Size i = 1; i<=pose.total_residue(); ++i ) {
120  if ( pose.pdb_info()->chain( i ) == this_chain ) {
121  fixed_chains.insert( pose.chain(i) );
122  break; //once we know something about the chain we can skip - we just need the chain id
123  }
124  }
125  TR << this_chain << ", ";
126  }
127  TR << "these will be moved together." << std::endl;
128 
129  IAM_ = protocols::analysis::InterfaceAnalyzerMoverOP( new protocols::analysis::InterfaceAnalyzerMover(
130  fixed_chains,
131  tracer,
132  scorefxn_,
133  comp_packstat,
134  pack_in,
135  pack_sep,
136  jobname
137  ) );
138  } else if ( basic::options::option[interface].active() ) {
139  std::string dock_chains = basic::options::option[interface].value();
140  TR << "Using interface definition: "<<dock_chains <<std::endl;
141  IAM_ = protocols::analysis::InterfaceAnalyzerMoverOP( new protocols::analysis::InterfaceAnalyzerMover(
142  dock_chains,
143  tracer,
144  scorefxn_,
145  comp_packstat,
146  pack_in,
147  pack_sep,
148  jobname
149  ) );
150  } else {
151  utility_exit_with_message("More than two chains present but no -fixedchains or -interface declared. Aborting.");
152  }
153  //IAM_->set_use_resfile(basic::options::option[use_resfile].value());
154 
155  return;
156 } //end assign_IA_mover
157 
158 ///begin apply
160 
161  //check to make sure there are enough chains
162  if ( pose.conformation().num_chains() < 2 ) {
163  TR.Error << "pose has only one chain, skipping" << std::endl;
164  set_last_move_status( protocols::moves::FAIL_BAD_INPUT);
165  return;
166  }
167 
168  //fill the interface analyzer mover
169  assign_IA_mover( pose );
170 
171  //now apply and get cool data and stuff
172  IAM_->apply(pose);
173  //flesh out scores for scorefile, if desired
175 
176  return;
177 }//end apply
178 
179 int
180 main( int argc, char* argv[] )
181 {
182  try {
183 
185  option.add( jumpnum, "jump between chains of interface" ).def(1);
186  option.add( compute_packstat, "compute packstat (of interface residues only)" ).def(false);
187  option.add( tracer_data_print, "print to tracer, not scorefile" ).def(false);
188  option.add( fixedchains, "Which chain(s) is/are moved away from the others, for 3 or more chains" );
189  option.add( pack_input, "pack the input pose").def(false);
190  option.add( add_regular_scores_to_scorefile, "adds default scores to scorefile").def(false);
191  option.add( pack_separated, "pack the separated chains at the separated dG phase").def(false);
192  option.add( use_jobname, "appended _0001 job name for output instead of input pose name").def(false);
193  option.add( use_resfile, "use a resfile during the packing stages").def(false);
194  option.add( interface, "dock_chains interface definition, optional, ex LH_A. Can handle any number of chains. ");
195  devel::init(argc, argv);
196 
197  protocols::jd2::JobDistributor::get_instance()->go(protocols::moves::MoverOP( new IAMover() ));
198 
199  TR << "************************d**o**n**e**************************************" << std::endl;
200  } catch ( utility::excn::EXCN_Base const & e ) {
201  std::cout << "caught exception " << e.msg() << std::endl;
202  return -1;
203  }
204 
205  return 0;
206 }
#define utility_exit_with_message(m)
Exit with file + line + message.
Definition: exit.hh:47
#define THREAD_LOCAL
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
Automatic hidden index key for integer options.
basic::options::StringOptionKey const interface("interface")
basic::options::BooleanOptionKey const pack_input("pack_input")
Automatic hidden index key for string options.
basic::options::BooleanOptionKey const tracer_data_print("tracer_data_print")
virtual ~IAMover()
virtual bool reinitialize_for_each_job() const
void init(int argc, char *argv[])
Command line init() version.
Definition: init.cc:23
core::pose::Pose Pose
Definition: supercharge.cc:101
basic::options::BooleanOptionKey const use_jobname("use_jobname")
Automatic hidden index key for string options.
virtual protocols::moves::MoverOP fresh_instance() const
Tracer & T(std::string const &channel, TracerPriority priority)
T is special function for assign tracer property on the static object.
Definition: Tracer.cc:567
member1 value
Definition: Tag.cc:296
void assign_IA_mover(core::pose::Pose &pose)
Tracer & Error(TracerPriority priority=t_error)
Predefined Error tracer.
Definition: Tracer.hh:395
virtual bool reinitialize_for_new_input() const
protocols::analysis::InterfaceAnalyzerMoverOP IAM_
Tracer IO system.
Automatic hidden index key for boolean options.
TracerProxy Error
Definition: Tracer.hh:262
Tracer & Warning(TracerPriority priority=t_warning)
Predefined Warning tracer.
Definition: Tracer.hh:398
virtual void apply(core::pose::Pose &pose)
begin apply
utility::options::OptionCollection option
OptionCollection global.
Definition: option.cc:45
basic::options::BooleanOptionKey const compute_packstat("compute_packstat")
ocstream cout(std::cout)
Wrapper around std::cout.
Definition: ocstream.hh:287
vector1: std::vector with 1-based indexing
basic::options::BooleanOptionKey const add_regular_scores_to_scorefile("add_regular_scores_to_scorefile")
int main(int argc, char *argv[])
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
Definition: Tracer.hh:134
basic::options::BooleanOptionKey const pack_separated("pack_separated")
virtual std::string get_name() const
basic::options::StringVectorOptionKey const fixedchains("fixedchains")
Program options global and initialization function.
static THREAD_LOCAL basic::Tracer TR("apps.public.analysis.InterfaceAnalyzer")
basic::options::BooleanOptionKey const use_resfile("use_resfile")
platform::Size Size
Definition: random.fwd.hh:30
basic::options::IntegerOptionKey const jumpnum("jumpnum")
core::scoring::ScoreFunctionOP scorefxn_
rule< Scanner, option_closure::context_t > option
Definition: Tag.cc:378