Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InterlockAroma.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/flxbb/InterlockAroma.cc
11 /// @brief place interlocking aromatic residues
12 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
13 
14 
17 
19 
20 // AUTO-REMOVED #include <core/chemical/ChemicalManager.fwd.hh>
21 #include <core/pose/Pose.hh>
25 #include <core/scoring/Energies.hh>
35 
36 // Utility headers
37 #include <basic/Tracer.hh>
38 #include <utility/vector1.hh>
39 
40 // Parser headers
41 #include <utility/tag/Tag.hh>
43 
44 // AUTO-REMOVED #include <protocols/fldsgn/topology/HSSTriplet.hh>
45 
46 #include <utility/vector0.hh>
47 
48 //Auto Headers
49 #include <core/graph/Graph.hh>
50 static basic::Tracer TR("protocols.flxbb.InterlockAroma");
51 
52 namespace protocols{
53 namespace flxbb{
54 
55 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
58 {
60 }
61 
64  return new InterlockAroma;
65 }
66 
69 {
70  return "InterlockAroma";
71 }
72 
73 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
75  Mover( "InterlockAroma" ),
76  scorefxn_( core::scoring::ScoreFunctionFactory::create_score_function( core::scoring::SOFT_REP_WTS ) ),
77  input_ss_( "" ),
78  max_repulsion_energy_( 30.0 ),
79  min_env_energy_( -0.5 ),
80  limit_aroma_chi2_( true ),
81  output_pdbs_( false ),
82  verbose_( false )
83 {}
84 
85 
86 /// @brief copy constructor
88  Super( rval ),
89  scorefxn_( rval.scorefxn_ ),
90  input_ss_ ( rval.input_ss_ ),
91  max_repulsion_energy_( rval.max_repulsion_energy_ ),
92  min_env_energy_( rval.min_env_energy_ ),
93  limit_aroma_chi2_( rval.limit_aroma_chi2_ ),
94  output_pdbs_( rval.output_pdbs_ ),
95  verbose_( rval.verbose_ )
96 {}
97 
98 /// @brief destructor
100 
101 /// @brief clone this object
104 {
105  return new InterlockAroma( *this );
106 }
107 
108 /// @brief create this type of object
111 {
112  return new InterlockAroma();
113 }
114 
115 
116 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
117 /// @brief mover apply
118 void
120 {
133 
134  // set pose to fullatom
135  runtime_assert( pose.is_fullatom() );
136 
137  // set secondary structure
138  String ss("");
139  if( ! input_ss_.empty() ) {
140  ss = input_ss_;
141  runtime_assert( input_ss_.length() == pose.total_residue() );
142  } else {
143  Dssp dssp( pose );
144  ss = dssp.get_dssp_secstruct();
145  }
146  SS_Info2_OP ssinfo = new SS_Info2( pose, ss );
147 
148  // create packer task
149  TaskFactory taskf;
150  if( limit_aroma_chi2_ ) { // default is true
151  taskf.push_back( new LimitAromaChi2Operation );
152  }
153  PackerTaskOP ptask( taskf.create_task_and_apply_taskoperations( pose ) );
154 
155  // debug
156  std::ostringstream filename;
157 
158  // create poly-Ala pose
159  MakePolyXMover bap( "ALA", false/*kee_pro*/, true /*keep_gly*/, false /*keep_disulfide_cys*/ );
160  Pose polyala_pose( pose );
161  bap.apply( polyala_pose );
162 
163  // farep score of original pose
164  scorefxn_->set_weight( core::scoring::envsmooth, 1.0 );
165 
166  (*scorefxn_)( polyala_pose );
167  Real farepE_ref = polyala_pose.energies().total_energies()[ core::scoring::fa_rep ];
168  Real faatrE_ref = polyala_pose.energies().total_energies()[ core::scoring::fa_atr ];
169  Real envE_ref = polyala_pose.energies().total_energies()[ core::scoring::envsmooth ];
170 
171  // set search residue types to packer task
172  InterlockingAromaFilter ilfilter;
173  for( Size ii=1; ii<=polyala_pose.total_residue(); ++ii ) {
174 
175  // skip residues of strands
176  if( ss.at( ii-1 ) != 'L' && ss.at( ii-1 ) != 'H' ) continue;
177 
178  // set packer task
180  restrict_to_aa[ core::chemical::aa_from_name( "PHE" ) ] = true;
181  ptask->nonconst_residue_task( ii ).restrict_absent_canonical_aas( restrict_to_aa );
182  ptask->set_bump_check( true );
183 
184  // create rotamer set
185  RotamerSetFactory rsf;
186  RotamerSetOP rotset = rsf.create_rotamer_set( polyala_pose.residue( ii ) );
187  rotset->set_resid( ii );
188  rotset->build_rotamers( polyala_pose, *scorefxn_, *ptask, new core::graph::Graph( polyala_pose.total_residue() ), false );
189 
190  Size rotnum( 0 );
191  for( Rotamers::const_iterator rotamer = rotset->begin(); rotamer != rotset->end(); ++rotamer ) {
192 
193  rotnum++;
194  Pose work_pose( polyala_pose );
195 
196  // farep score after the insertion of rotamer
197  work_pose.replace_residue( ii, **rotamer, false/*orient bb*/ );
198 
199  (*scorefxn_)( work_pose );
200  Real farepE_mut = work_pose.energies().total_energies()[ core::scoring::fa_rep ];
201  Real faatrE_mut = work_pose.energies().total_energies()[ core::scoring::fa_atr ];
202  Real envE_mut = work_pose.energies().total_energies()[ core::scoring::envsmooth ];
203 
204  // evaluate clash
205  Real dfarep = farepE_mut - farepE_ref;
206  if( dfarep > max_repulsion_energy_ ) continue;
207 
208  // evaluate buriedness
209  Real denvE = envE_mut - envE_ref;
210  if( denvE > min_env_energy_ ) continue;
211 
212  // evaluate vdw attraction
213  Real dfaatrE = faatrE_mut - faatrE_ref;
214 
215  if( ilfilter.compute( ii, work_pose, ssinfo ) ) {
216 
217  if( output_pdbs_ ) {
218  filename.str("");
219  filename << "interlock_" << ii << "." << rotnum << ".pdb";
220  work_pose.dump_pdb( filename.str() );
221  }
222 
223  if( verbose_ ) {
224  TR << ii << " " << rotnum << " " << dfarep << " " << denvE << " " << dfaatrE << std::endl;
225  }
226 
227  }
228  }
229  }
230 
231 
232 } // InterlockAroma::apply
233 
237 }
238 
239 /// @brief parse xml
240 void
242  TagPtr const tag,
243  DataMap & data,
244  Filters_map const &,
245  Movers_map const &,
246  Pose const & )
247 {
248  String const sfxn ( tag->getOption<String>( "scorefxn", "soft_rep" ));
249  scorefxn_ = data.get< ScoreFunction * >( "scorefxns", sfxn );
250 
251  max_repulsion_energy_ = tag->getOption<Real>( "max_repulsion_energy", 30.0 );
252  min_env_energy_ = tag->getOption<Real>( "min_env_energy", -0.5 );
253 
254  TR << "max_repulsion_energy: " << max_repulsion_energy_ << ", min_env_energy: " << min_env_energy_ << std::endl;
255 
256  // read secondary structure info through blueprint
257  std::string const blueprint( tag->getOption<std::string>( "blueprint", "" ) );
258  if( blueprint != "" ){
260  input_ss_ = bop->secstruct();
261  }
262 
263  // Exclude aromatic chi2 rotamers, of which angles are around 0
264  limit_aroma_chi2_ = tag->getOption<bool>( "limit_aroma_chi2", 1 );
265 
266  output_pdbs_ = tag->getOption<bool>( "output_pdbs", 0 );
267  verbose_ = tag->getOption<bool>( "verbose", 0 );
268 
269 }
270 
271 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
272 
273 
274 } // namespace of flxbb
275 } // namespace of protocols