Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrowLigand.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/GrowLigand.cc
11 ///
12 /// @brief
13 /// @Gordon Lemmon
14 
17 
18 #include <protocols/ligand_docking/LigandDesign.hh> // For helper functions. Refactor this
19 #include <core/pose/util.hh>
20 
21 
22 #include <protocols/moves/Mover.hh>
23 
24 #include <core/types.hh>
25 
26 #include <basic/Tracer.hh>
27 
28 // option key includes
29 
30 // AUTO-REMOVED #include <basic/options/keys/docking.OptionKeys.gen.hh>
31 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
32 
37 #include <utility/tag/Tag.hh>
38 
39 //Auto Headers
40 #include <core/pose/Pose.hh>
41 #include <utility/vector0.hh>
42 #include <utility/vector1.hh>
43 #include <numeric/random/random_permutation.hh>
44 #include <boost/foreach.hpp>
45 
46 //Auto Headers
47 #include <utility/excn/Exceptions.hh>
49 #define foreach BOOST_FOREACH
50 
51 namespace protocols {
52 namespace ligand_docking {
53 
54 static basic::Tracer grow_ligand_tracer("protocols.ligand_docking.GrowLigand", basic::t_debug);
55 
58 {
60 }
61 
64  return new GrowLigand;
65 }
66 
69 {
70  return "GrowLigand";
71 }
72 
74  Mover("GrowLigand"),
75  chain_("")
76 {
77  set_fragments();
78 }
79 
81  Mover("GrowLigand"),
82  chain_(chain)
83 {
84  set_fragments();
85 }
86 
88  //utility::pointer::ReferenceCount(),
89  protocols::moves::Mover( that ),
90  chain_(that.chain_),
91  fragments_(that.fragments_)
92 {}
93 
95 
96 void
99  rs.set_property("FRAGMENT");
102  core::chemical::ResidueTypeCOPs fragment_types= rs.select( *rsd_set );
103  grow_ligand_tracer<< fragment_types.size()<< " fragment_types"<< std::endl;
104 
105  foreach(core::chemical::ResidueTypeCOP fragment_type, fragment_types){
106  fragments_.push_back( new core::conformation::Residue(*fragment_type, true) );
107  grow_ligand_tracer<< "frag_name: "<< fragment_type->name()<< std::endl;
108  }
109 }
110 
112  return new GrowLigand( *this );
113 }
114 
116  return new GrowLigand;
117 }
118 
120  return "GrowLigand";
121 }
122 
123 ///@brief parse XML (specifically in the context of the parser/scripting scheme)
124 void
126  utility::tag::TagPtr const tag,
127  protocols::moves::DataMap & /*datamap*/,
128  protocols::filters::Filters_map const & /*filters*/,
129  protocols::moves::Movers_map const & /*movers*/,
130  core::pose::Pose const & /*pose*/
131 )
132 {
133  if ( tag->getName() != "GrowLigand" ) {
134  grow_ligand_tracer << " received incompatible Tag " << tag << std::endl;
135  assert(false);
136  return;
137  }
138  if ( tag->hasOption("chain") ) {
139  chain_ = tag->getOption<std::string>("chain");
140  }else{
141  throw utility::excn::EXCN_RosettaScriptsOption("HeavyAtom filter needs a 'chain' option");
142  }
143 }
144 
145 void
147 {
148  assert(!fragments_.empty());
149  assert(chain_.size() == 1);
150 
151  utility::vector1<core::Size> unconnected_residues;
152  {
153  core::Size const chain_id= core::pose::get_chain_id_from_chain(chain_, pose);;
154  core::Size const start = pose.conformation().chain_begin(chain_id);
155  core::Size const end = pose.conformation().chain_end(chain_id);
156  unconnected_residues=find_unconnected_residues(pose, start, end);
157  }
158 
159  core::Size grow_from = numeric::random::random_element(unconnected_residues);
160  core::Size grow_from_connection= random_connection(&pose.residue(grow_from));
161  core::conformation::ResidueCOP growth = numeric::random::random_element(fragments_);
162  core::Size growth_connection= random_connection(growth);
163  bool const build_ideal_geometry= true;
164  bool const start_new_chain = false;
165  bool const lookup_bond_length = true;
166 
168  *growth,
169  build_ideal_geometry,
170  growth_connection,
171  grow_from,
172  grow_from_connection,
173  start_new_chain,
174  lookup_bond_length
175  );
176  return;
177 }
178 
180  for(core::Size i=1; i <= fragments_.size(); ++i){
182  for(; begin != fragments_.end(); ++begin){
183  //core::conformation::Residue const & res= *begin;
184  //core::Size connect_id= begin;
185  //std::string name= begin->name();
186  grow_ligand_tracer<< "atom_type, res_name, connection"<<" "<< (*begin)->name() << " "<< std::endl;
187  }
188  }
189 }
190 
192  core::pose::Pose & /*pose*/
193 )
194 {
195 }
196 
197 } // namespace ligand_docking
198 } // namespace protocols