Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ligand_dock_impl.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/ligand_docking/ligand_dock_impl.cc
11 ///
12 /// @brief
13 /// @author Rocco Moretti (rmoretti@u.washington.edu); Ian Davis (ian.w.davis@gmail.com)
14 
15 // Unit Headers
16 
18 #include <protocols/moves/Mover.hh>
19 
20 // Package Headers
21 
23 // AUTO-REMOVED #include <protocols/jd2/util.hh>
24 
26 
27 // Project Headers
28 
29 #include <core/types.hh>
31 
32 #include <core/pose/Pose.hh>
34 
35 #include <protocols/toolbox/match_enzdes_util/EnzConstraintIO.hh> //for addding constraints if demanded by user
37 // AUTO-REMOVED #include <core/pose/datacache/CacheableDataType.hh>
38 // AUTO-REMOVED #include <basic/datacache/BasicDataCache.hh>
39 // AUTO-REMOVED #include <basic/datacache/CacheableString.hh>
40 
41 // Utility Headers
42 
43 #include <basic/options/option.hh>
44 #include <basic/Tracer.hh>
45 
46 // option key includes
47 
48 #include <basic/options/keys/run.OptionKeys.gen.hh>
49 #include <basic/options/keys/in.OptionKeys.gen.hh>
50 #include <basic/options/keys/out.OptionKeys.gen.hh>
51 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
52 
53 #include <protocols/jd2/Job.hh>
54 #include <utility/vector1.hh>
55 
56 
57 namespace protocols {
58 namespace ligand_docking {
59 
60 basic::Tracer TR("protocols.ligand_docking.main");
61 
63 public:
66  {
67  if( basic::options::option[ basic::options::OptionKeys::in::file::native ].user() ) {
68  native_ = new core::pose::Pose();
69  core::import_pose::pose_from_pdb( *native_, basic::options::option[ basic::options::OptionKeys::in::file::native ]().name() );
70  }
71 
72  if( basic::options::option[ basic::options::OptionKeys::enzdes::cstfile].user() ){
73  //we need the residue type set, assuming FA standard is used
75  basic::options::option[ basic::options::OptionKeys::run::preserve_header ].value(true);
77  constraints_->read_enzyme_cstfile( basic::options::option[ basic::options::OptionKeys::enzdes::cstfile ] );
78 
79  core::scoring::ScoreFunctionOP scorefunc = this->get_scorefxn();
80  if (scorefunc->has_zero_weight( core::scoring::coordinate_constraint ) ) scorefunc->set_weight(core::scoring::coordinate_constraint, 1.0 ) ;
81  if (scorefunc->has_zero_weight( core::scoring::atom_pair_constraint ) ) scorefunc->set_weight(core::scoring::atom_pair_constraint, 1.0 ) ;
82  if (scorefunc->has_zero_weight( core::scoring::angle_constraint ) ) scorefunc->set_weight(core::scoring::angle_constraint, 1.0 ) ;
83  if (scorefunc->has_zero_weight( core::scoring::dihedral_constraint ) ) scorefunc->set_weight(core::scoring::dihedral_constraint, 1.0 ) ;
84  }
85 
86  }
87 
88  virtual
90 
91  virtual
92  void
93  apply( core::pose::Pose & pose ) {
94 
95  if( constraints_ ){
96  constraints_->add_constraints_to_pose( pose, this->get_scorefxn(), false );
97  }
98 
100 
101  // Score new structure and add to silent file
102  std::map< std::string, core::Real > scores;
104  if( native_ ) {
105  this->append_ligand_docking_scores(*native_, pose, this->get_scorefxn(), scores, constraints_);
106  } else { // input serves as native
108  this->append_ligand_docking_scores(*input_pose, pose, this->get_scorefxn(), scores, constraints_);
109  }
110 
111  // Attach relevant scores to current job (Assumes use of JD2)
112  {
114  std::map< std::string, core::Real >::const_iterator curr( scores.begin() );
115  std::map< std::string, core::Real >::const_iterator end( scores.end() );
116  for (; curr != end; ++curr) {
117  curr_job->add_string_real_pair(curr->first, curr->second);
118  }
119  }
120 
121  /* TODO: From old jd1 code:
122  // Want to recycle the reference poses from the input silent file, or else every entry becomes a new reference pose!
123  if( use_silent_in ) {
124  //std::cout << "Ref addr " << (atdiff->ref_pose_for( curr_job->input_tag() ))() << std::endl;
125  jobdist.dump_pose( curr_job->output_tag(curr_nstruct), scores, *(atdiff->ref_pose_for( curr_job->input_tag() )), *the_pose );
126  }
127  else jobdist.dump_pose( curr_job->output_tag(curr_nstruct), scores, *input_pose, *the_pose );
128  */
129 
130 
131  }
132 
133  virtual
135  get_name() const {
136  return "LigandDockMain";
137  }
138 
139  virtual
141  fresh_instance() const {
142  return new LigandDockMain;
143  }
144 
145  virtual
146  bool
147  reinitialize_for_each_job() const { return false; }
148 
149  virtual
150  bool
151  reinitialize_for_new_input() const { return false; }
152 
153 private:
154 
157 };
158 
160 
161 } //namespace ligand_docking
162 } //namespace protocols
163 
164 //////////////////////////////////////////////////////////////////////////////
165 /// @details Assumes option system has already been initialized!
166 int
168 {
170 
171  // Change precision of AtomTreeDiffJobOutputter, for backward compatability reasons
172  // makes silent file much smaller, ~3x vs. default 6,4,2
173  // but has too much atom positioning error (~0.1 Ang) to be reliable for rescoring
174  if ( ! basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_bb].user() &&
175  ! basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_sc].user() &&
176  ! basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_bl].user()) {
177  protocols::ligand_docking::TR << "Changing atom_tree_diff output precision to 6,3,1." << std::endl;
178  basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_bb].value(6);
179  basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_sc].value(3);
180  basic::options::option[ basic::options::OptionKeys::out::file::atom_tree_diff_bl].value(1);
181  }
182 
184  protocols::jd2::AtomTreeDiffJobOutputterOP atd_outputter( dynamic_cast< protocols::jd2::AtomTreeDiffJobOutputter * >( job_outputter() ) );
185  if ( atd_outputter ) {
186  atd_outputter->use_input_for_ref(true); // match original ligand_dock application
187  }
188 
190 
191  return 0;
192 }
193