Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AddCavitiesMover.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_moves/AddCavitiesMover.cc
11 ///
12 /// @brief
13 /// @author
14 
16 
19 
20 #include <core/pose/Pose.hh>
22 
23 #include <core/chemical/AA.hh>
24 // AUTO-REMOVED #include <core/chemical/AtomTypeSet.hh>
25 // AUTO-REMOVED #include <core/chemical/MMAtomTypeSet.hh>
28 // AUTO-REMOVED #include <core/chemical/ResidueSelector.hh>
31 // AUTO-REMOVED #include <core/chemical/residue_io.hh>
32 // AUTO-REMOVED #include <core/chemical/VariantType.hh>
33 
35 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.hh>
38 
39 #include <basic/datacache/BasicDataCache.hh>
41 
42 #include <utility/vector1.hh>
43 
44 
45 namespace protocols {
46 namespace simple_moves {
47 
48  using namespace core;
49  using namespace core::scoring::packstat;
50  using core::id::AtomID;
51 
52 
54  core::Size max_cav ,
55  core::Real min_size,
56  core::Size min_nb ,
57  core::Real min_sep
58  ) : max_cav_(max_cav), min_size_(min_size), min_nb_(min_nb), min_sep_(min_sep) {}
59 
62  id::AtomID closest;
63  Real closest_dist = 9e9;
64  for( size_t ir = 1; ir <= pose.total_residue(); ++ir ) {
65  for( size_t ia = 1; ia <= pose.residue(ir).natoms(); ++ia ) {
66  id::AtomID id( ia, ir );
67  if( 22 <= pose.residue(id.rsd()).atom(id.atomno()).type() ) continue;
68  if( pose.xyz(id).distance_squared( xyz ) < closest_dist ) {
69  closest_dist = pose.xyz(id).distance_squared( xyz );
70  closest = id;
71  }
72  }
73  }
74  return closest;
75  }
76 
79  using namespace core;
80  using namespace chemical;
81  using namespace conformation;
82  ResidueTypeSetCAP residue_set( ChemicalManager::get_instance()->residue_type_set( FA_STANDARD ) );
83  return ResidueFactory::create_residue( residue_set->name_map("SUCK") );
84  }
85 
86  CavBalls
87  AddCavitiesMover::get_cavities( Pose & pose, Real nbdis, int nbcount, Real minsep ) {
89 
91  opts.prune_max_iters = 5;
92  opts.prune_max_delta = 0;
93  opts.num_cav_ball_layers = 2;
97  for( PackstatReal pr = 3.0; pr >= 0.9; pr -= 0.1 )
98  opts.probe_radii.push_back(pr);
99  opts.prune_cavity_burial_probe_radii.push_back( 1.6 );
100 
101  CavBalls cball = compute_sasa( spheres, opts )->cavballs;
102  CavBalls cbph = prune_hidden_cavity_balls( cball, opts );
103  CavBalls cbpr = prune_cavity_balls( spheres, cbph, opts );
104  compute_cav_ball_neighbor_count( spheres, cbpr, nbdis );
105  CavBalls cbbur;
106  for( CavBallIter i = cbpr.begin(); i != cbpr.end(); ++i ) if( i->anb > nbcount ) cbbur.push_back( *i );
107  CavBalls selcb = select_cav_balls(cbbur,minsep);
108 
109  CavBalls cb;
110 
111  return selcb;
112  }
113 
114  void
116  //using namespace core::pose::datacache::CacheableDataType;
117  using namespace basic::datacache;
118  using namespace core::pose::datacache;
120  return;
121  }
122  CacheableDataOP cd = pose.data().get_ptr( core::pose::datacache::CacheableDataType::POSE_BEFORE_CAVITIES_ADDED );
123  core::pose::PoseOP cache_pose = dynamic_cast< core::pose::datacache::CacheablePoseRawPtr*>(cd())->pose();
125  Pose orig_pose = *cache_pose;
126  orig_pose.copy_segment( orig_pose.total_residue(), pose, 1, 1 );
127  pose = orig_pose;
128  }
129 
130  void
132  using namespace core::scoring;
133  using namespace constraints;
134  //using namespace core::pose::datacache::CacheableDataType;
135  using namespace basic::datacache;
136  using namespace core::pose::datacache;
137 
138  clear_suckers(pose);
139 
140  using namespace basic;
142 
143  CavBalls cbs = get_cavities(pose, 10.0, min_nb_, 3.0 );
144  int Ncb = max_cav_;
145 
146  // add VRT res for coord constraints
148  ( *conformation::ResidueFactory::create_residue( pose.residue(1).residue_type_set().name_map( "VRT" ) ),
149  pose.total_residue()/2 );
150  int virt_resno = pose.total_residue();
151  FuncOP func( new HarmonicFunc( 0.0, 1.0 ) );
152 
153  // std::cerr << "add sucker atoms" << std::endl;
154  int count = 0;
155  for( int i = 1; i <= std::min(Ncb,(int)cbs.size()); ++i ) {
156  if( cbs[i].radius() < min_size_ ) {
157  Ncb = i-1;
158  break;
159  }
160  // std::cerr << "adding cb" << cbs[i].str() << std::endl;
162  sucker->set_xyz( 1, cbs[i].xyz() );
163  AtomID closest = get_closest_heavy_atom( pose, cbs[i].xyz() );
164  // std::cerr << "closest " << closest << " score before " << (*sf)(pose) << std::endl;
165  pose.append_residue_by_jump( *sucker, closest.rsd() );
166  int suck_resno = pose.total_residue();
167 
168  pose.add_constraint( new CoordinateConstraint( AtomID(1,suck_resno),
169  AtomID(1,virt_resno),
170  sucker->xyz(1),
171  func ) );
172  ++count;
173  }
174  //std::cerr << "added " << count << " suckers" << std::endl;
175 
176  }
177  // strip off the suckers and virt res
178 
179  void
181  clear_suckers( pose );
182  if( 0 < max_cav_ ) {
183  add_suckers( pose );
184  }
185  }
186 
189  return "AddCavitiesMover";
190  }
191 
192 
193 
194 } // end namespace simple_moves
195 } // end namespace protocols