Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BackboneSampler.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 // (C) 199x-27 University of Washington
10 // (C) 199x-27 University of California Santa Cruz
11 // (C) 199x-27 University of California San Francisco
12 // (C) 199x-27 Johns Hopkins University
13 // (C) 199x-27 University of North Carolina, Chapel Hill
14 // (C) 199x-27 Vanderbilt University
15 
16 /// @file
17 /// @brief
18 /// @author
19 
20 // Unit headers
22 
23 // Package headers
29 #include <protocols/moves/Mover.hh>
31 
32 // Project Headers
33 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
37 // AUTO-REMOVED #include <core/pose/datacache/cacheable_observers.hh>
38 // AUTO-REMOVED #include <core/pose/datacache/CacheableObserverType.hh>
39 // AUTO-REMOVED #include <core/pose/datacache/ObserverCache.hh>
40 #include <core/pose/Pose.hh>
42 #include <core/types.hh>
43 
44 // Utility Headers
45 #include <numeric/random/random.hh>
46 #include <utility/tag/Tag.hh>
47 #include <utility/vector1.hh>
48 
49 // C++ headers
50 //#include <map>
51 #include <set>
52 
53 //basic includes
54 #include <basic/Tracer.hh>
55 
57 #include <core/kinematics/Jump.hh>
58 #include <utility/vector0.hh>
59 
60 
61 namespace protocols {
62 namespace enzdes {
63 
64 static basic::Tracer TR( "protocols.enzdes.BackboneSampler" );
65 static numeric::random::RandomGenerator RG( 6172774 );
66 
69 {
71 }
72 
75  return new BackboneSampler();
76 }
77 
80 {
81  return "BackboneSampler";
82 }
83 
85  LigandBaseProtocol(),
86  bb_moves_( 1000 ),
87  mc_kt_( 0.6 ) {}
88 
89 using namespace std;
90 using namespace core;
91 using namespace core::scoring;
92 using namespace pack::task;
93 using namespace protocols::moves;
94 
95 // all constants for the backrub mover were taken from Colin's backrub.cc application
97 ( ScoreFunctionCOP scorefxn,
98  core::Size const bb_moves,
99  core::Real const mc_kt
100 )
102 {
103  bb_moves_ = bb_moves;
104  mc_kt_ = mc_kt;
105  scorefxn_repack_ = new ScoreFunction( *scorefxn );
106 }
107 
109 
112  return( protocols::moves::MoverOP( new BackboneSampler( *this ) ) );
113 }
114 
115 void
117 {
118 // pose.dump_pdb("pose.pdb");
119  kinematics::FoldTree const ft_in = pose.fold_tree();
120 
121  //checks wheather there are any segments set from cacheable observers
122  //makes them obey insertions and deletions through lenght observer
123  std::set< core::Size > segments;
125 
126  //makes protein segements movable
127  utility::vector1< bool > mobile_bb( pose.n_residue(), false );
129  //movemap -> clear();
130  if ( segments.empty() ) {
131  for ( core::Size ii=1; ii <= pose.n_residue(); ++ii ) {
132  if ( pose.residue(ii).is_protein() ) {
133  movemap -> set_bb( ii, true );
134  mobile_bb[ii] = true;
135  }
136  else {
137  //C-term res in the protein is frozen
138  movemap -> set_bb( ii-1, false );
139  mobile_bb[ii-1] = false;
140  }
141  }
142  }
143  else {
144  for ( core::Size ii=1; ii <= pose.n_residue(); ++ii ) {
145  if ( pose.residue(ii).is_protein() && ( segments.find(ii) != segments.end() ) ) {
146  movemap -> set_bb( ii, true );
147  mobile_bb[ii] = true;
148  }
149  }
150  }
151 
152  //make fold tree that complies with movemap
153  //reorder_foldtree_around_mobile_regions from LigandBaseProtocol
154  TR << "Original fold tree: " << pose.fold_tree() << std::endl;
155  core::Size lig_jump = get_ligand_jump_id(pose);
156  core::Size lig_id = get_ligand_id(pose);
157  reorder_foldtree_around_mobile_regions( pose, lig_jump, mobile_bb, lig_id);
159  TR << "Modified fold tree: " << pose.fold_tree() << std::endl;
160 
162  bbg8t3amover.movemap( movemap );
163  bbg8t3amover.factorA( 0.5 ); // values suggested by Yuan
164  bbg8t3amover.factorB( 10.0 );
165 
166  //core::pose::PoseCOP pose_copy = new core::pose::Pose( pose );
167  //bbg8t3amover.set_input_pose( pose_copy );
168  //bbg8t3amover.set_native_pose( pose_copy );
169 
170  TR << "Score After PDB Load:" << std::endl;
171  scorefxn_repack_->show(TR, pose);
172  TR.flush();
173 
174  protocols::moves::MonteCarlo mc( pose, *scorefxn_repack_, mc_kt_ );
175  mc.reset( pose );
176 
177  TR << "Running " << bb_moves_ << " trials..." << std::endl;
178  for ( core::Size ii =1; ii != bb_moves_; ++ii ) {
179  bbg8t3amover.apply( pose );
180  mc.boltzmann( pose, bbg8t3amover.type() );
181  }
182  mc.show_counters();
183 
184  TR << "Lowest score: \n";
185  pose = mc.lowest_score_pose();
186  scorefxn_repack_->show(TR, pose);
187  TR.flush();
188 
190  pose.fold_tree( ft_in );
191  TR << "Reinstated original fold tree: " << pose.fold_tree() << std::endl;
192 // pose.dump_pdb("BBG_pose.pdb");
193 }
194 
198 }
199 
201  utility::tag::TagPtr const tag,
205  Pose const & )
206 {
207  bb_moves_ = tag->getOption<core::Size>( "moves", 1000 );
208  std::string const scorefxn( tag->getOption<string>( "scorefxn", "score12" ));
209  scorefxn_repack_ = new ScoreFunction( *data.get< ScoreFunction * >( "scorefxns", scorefxn) );
210 }
211 
212 
213 } //enzdes
214 } //protocols