Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PeptideStapleMover.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/PeptideStapleMover.cc
11 /// @brief Peptide Staples are covalent links between i/i+[4,7] residues in a helix. Applying a PeptideStapleMover creates one of these links.
12 /// @authors Jacob Corn and Andrew Leaver-Fay
13 
14 // Unit Headers
16 
17 // Package headers
18 #include <protocols/moves/Mover.hh>
19 #include <core/id/AtomID.hh>
20 
22 
23 //#include <basic/options/option.hh>
24 //#include <basic/options/keys/OptionKeys.hh>
25 //#include <basic/options/after_opts.hh>
26 //#include <basic/options/util.hh>
27 
28 #include <core/pose/Pose.hh>
29 
30 // AUTO-REMOVED #include <core/conformation/ResidueFactory.hh>
35 
37 
38 //#include <core/pack/task/operation/TaskOperation.hh>
39 //#include <core/pack/task/TaskFactory.hh>
40 
43 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.hh>
44 // AUTO-REMOVED #include <core/scoring/constraints/CoordinateConstraint.hh>
49 
51 //#include <protocols/simple_moves/PackRotamersMover.hh>
52 
53 #include <numeric/constants.hh>
54 #include <basic/Tracer.hh>
55 #include <core/types.hh>
56 using basic::T;
57 using basic::Error;
58 using basic::Warning;
59 static basic::Tracer TR( "protocols.simple_moves.PeptideStapleMover" );
60 
61 // C++ Headers
62 #include <sstream>
63 
64 #include <utility/vector1.hh>
65 
66 //Auto Headers
68 
69 
70 // ObjexxFCL Headers
71 
72 namespace protocols {
73 namespace simple_moves {
74 
75 PeptideStapleMover::PeptideStapleMover( core::Size const staple_start, core::Size const staple_gap=4 ) :
76  protocols::moves::Mover(),
77  seqpos_(staple_start),
78  staple_gap_(staple_gap)
79 {
80  protocols::moves::Mover::type( "PeptideStapleMover" );
81 }
82 
83 /// @brief Places and minimizes a PeptideStaple (i+4 or i+7, depending on staple_gap) at seqpos in pose
85 {
86 
87  // BUNCH OF SANITY CHECKS
88  // test whether we're running off the pose
89  if ( (seqpos_ + staple_gap_) > pose.total_residue() )
90  {
91  TR << "A staple gap of " << staple_gap_ << " runs off the end of the pose. Aborting staple insertion at residue " << seqpos_ << std::endl;
92  return;
93  }
94  // test connection points for terminii
95  if ( pose.residue( seqpos_ ).is_terminus() || pose.residue( seqpos_+staple_gap_ ).is_terminus() )
96  {
97  TR << "Staple insertion is not supported at chain terminii. Aborting staple insertion at residue " << seqpos_ << std::endl;
98  return;
99  }
100  // test residues between connections for secondary structure, jumps, and terminii
101  for( Size i = seqpos_; i <= seqpos_ + staple_gap_; ++i ) {
102  if( pose.secstruct( i ) != 'H' ) {
103  TR << "Secondary structure at residue " << i << " is " << pose.secstruct(i) << ", but stapling along non-helix residues is untested!" << std::endl;
104  }
105  if( pose.fold_tree().is_jump_point( i ) ) {
106  TR << "Peptide stapling across jumps is untested!" << std::endl;
107  }
108  }
109 
110  core::chemical::ResidueTypeSet const & residue_set ( pose.residue(1).residue_type_set() );
111  core::chemical::ResidueTypeCOP stapleA_type;
112  core::chemical::ResidueTypeCOP stapleB_type;
113 
114  if ( staple_gap_ == 4 ) {
115  stapleA_type = residue_set.name_map("STAPLE08A") ;
116  stapleB_type = residue_set.name_map("STAPLE08B") ;
117  }
118 
119  // create staple residues on top of
120  core::conformation::Residue stapleA_res ( *stapleA_type, pose.residue(seqpos_), pose.conformation() );
121  core::conformation::Residue stapleB_res ( *stapleB_type, pose.residue(seqpos_ + staple_gap_), pose.conformation() );
122 
123  pose.replace_residue( seqpos_, stapleA_res, true );
124  pose.replace_residue( seqpos_ + staple_gap_, stapleB_res, true);
125  pose.conformation().detect_bonds();
126 
128  minimize_( pose );
129 }
130 
133  return "PeptideStapleMover";
134 }
135 
136 /// @brief Derives the constraints to be used for minimizing the stapled residue
137 /// @author Andrew Leaver-Fay
139 {
140  typedef core::Size Size;
141  typedef core::Real Real;
142  using namespace core::scoring::constraints;
143  using namespace core::chemical;
144  using namespace core::id;
145  //ConstraintSetOP cst_set( new ConstraintSet() );
146 
147  TR << "residue " << seqpos_ << " " << pose.residue( seqpos_ ).name() << std::endl;
148 
149  // if ( pose.residue( ii ).name() == "STAPLE08A" ) {
150  Size const seqpos_conn_atom = pose.residue( seqpos_ ).type().residue_connection( 3 ).atomno();
151  Size const seqpos_vc_atom = pose.residue( seqpos_ ).atom_index( "VC" );
152 
153  Size const jj = pose.residue( seqpos_ ).connect_map( 3 ).resid();
154  Size const jj_conn_atom = pose.residue( jj ).type().residue_connection( 3 ).atomno();
155  Size const jj_vc_atom = pose.residue( jj ).atom_index( "VC" );
156 
157  TR << "seqpos conn: " << pose.residue( seqpos_ ).atom_name( seqpos_conn_atom );
158  TR << " seqpos vc: " << pose.residue( seqpos_ ).atom_name( seqpos_vc_atom );
159  TR << " jj conn: " << pose.residue( jj ).atom_name( jj_conn_atom );
160  TR << " jj vc: " << pose.residue( jj ).atom_name( jj_vc_atom );
161 
162  ConstraintOP apc1 = new AtomPairConstraint(
163  AtomID( seqpos_conn_atom, seqpos_ ),
164  AtomID( jj_vc_atom, jj ),
165  new HarmonicFunc( 0.0, 0.001 ) );
166 
167  ConstraintOP apc2 = new AtomPairConstraint(
168  AtomID( jj_conn_atom, jj ),
169  AtomID( seqpos_vc_atom, seqpos_ ),
170  new HarmonicFunc( 0.0, 0.001 ) );
171 
172  pose.add_constraint( apc1 );
173  pose.add_constraint( apc2 );
174 
175  Size const seqpos_conn_atom_base = pose.residue( seqpos_ ).type().icoor( seqpos_conn_atom ).stub_atom( 1 ).atomno();
176  Size const jj_conn_atom_base = pose.residue( jj ).type().icoor( jj_conn_atom ).stub_atom( 1 ).atomno();
177 
178  Real const seqpos_ideal_angle = numeric::constants::d::pi - pose.residue( seqpos_ ).type().icoor( seqpos_vc_atom ).theta();
179  Real const jj_ideal_angle = numeric::constants::d::pi - pose.residue( jj ).type().icoor( jj_vc_atom ).theta();
180 
181  TR << "seqpos_conn_atom_base: " << seqpos_conn_atom_base << " " << pose.residue( seqpos_ ).atom_name( seqpos_conn_atom_base ) << " " << seqpos_ideal_angle << std::endl;
182  TR << "jj_conn_atom_base: " << jj_conn_atom_base << " " << pose.residue( jj ).atom_name( jj_conn_atom_base ) << " " << jj_ideal_angle << std::endl;
183 
184  ConstraintOP bac1 = new AngleConstraint(
185  AtomID( seqpos_conn_atom, seqpos_),
186  AtomID( seqpos_vc_atom, seqpos_ ),
187  AtomID( jj_conn_atom_base, jj ),
188  new HarmonicFunc( jj_ideal_angle, 0.01 ) );
189 
190  ConstraintOP bac2 = new AngleConstraint(
191  AtomID( seqpos_conn_atom_base, seqpos_),
192  AtomID( jj_vc_atom, jj ),
193  AtomID( jj_conn_atom, jj ),
194  new HarmonicFunc( seqpos_ideal_angle, 0.01 ) );
195 
196  pose.add_constraint( bac1 );
197  pose.add_constraint( bac2 );
198 
199  Real cross_connection_dihedral_val (0);
200 /* if ( basic::options::option[ cross_connection_dihedral ].user() ) {
201  cross_connection_dihedral_val = basic::options::option[ cross_connection_dihedral ]();
202  }
203 */
204  ConstraintOP dcst = new DihedralConstraint(
205  AtomID( seqpos_conn_atom_base, seqpos_ ),
206  AtomID( seqpos_conn_atom, seqpos_ ),
207  AtomID( jj_conn_atom, jj ),
208  AtomID( jj_conn_atom_base, jj ),
209  new CircularHarmonicFunc( cross_connection_dihedral_val * numeric::constants::d::pi / 180.0, 0.1 ) );
210  pose.add_constraint( dcst );
211 
212  utility::vector1< AtomIndices > const & seqpos_chi( pose.residue( seqpos_ ).chi_atoms() );
213  for ( Size kk = 1; kk <= seqpos_chi.size(); ++kk ) {
214  Real ideal_dihedral = pose.residue( seqpos_ ).type().icoor( seqpos_chi[ kk ][ 4 ] ).phi();
215  TR << "seqpos ideal dihedral: " << ideal_dihedral << " " << ideal_dihedral * 180 / numeric::constants::d::pi << std::endl;
216  ConstraintOP dcst = new DihedralConstraint(
217  AtomID( seqpos_chi[ kk ][ 1 ], seqpos_ ),
218  AtomID( seqpos_chi[ kk ][ 2 ], seqpos_ ),
219  AtomID( seqpos_chi[ kk ][ 3 ], seqpos_ ),
220  AtomID( seqpos_chi[ kk ][ 4 ], seqpos_ ),
221  new CircularHarmonicFunc( ideal_dihedral, 0.1 ) );
222  pose.add_constraint( dcst );
223  }
224 
225  utility::vector1< AtomIndices > const & jj_chi( pose.residue( jj ).chi_atoms() );
226  for ( Size kk = 1; kk <= jj_chi.size(); ++kk ) {
227  Real ideal_dihedral = pose.residue( jj ).type().icoor( jj_chi[ kk ][ 4 ] ).phi();
228  TR << "jj ideal dihedral: " << ideal_dihedral << " " << ideal_dihedral * 180 / numeric::constants::d::pi << std::endl;
229  ConstraintOP dcst = new DihedralConstraint(
230  AtomID( jj_chi[ kk ][ 1 ], jj ),
231  AtomID( jj_chi[ kk ][ 2 ], jj ),
232  AtomID( jj_chi[ kk ][ 3 ], jj ),
233  AtomID( jj_chi[ kk ][ 4 ], jj ),
234  new CircularHarmonicFunc( ideal_dihedral, 0.1 ) );
235  pose.add_constraint( dcst );
236  }
237  //pose.add_constraint( cst_set );
238 }
239 
240 
241 /// @brief Minimizes a placed PeptideStaple using the constraints derived with derive_stape_constraints_
242 /// @author Andrew Leaver-Fay
244 {
245  using namespace core::scoring;
247  scorefxn->set_weight( atom_pair_constraint, 1 );
248  scorefxn->set_weight( angle_constraint, 1 );
249  scorefxn->set_weight( dihedral_constraint, 1 );
250  scorefxn->set_weight( coordinate_constraint, 1 );
251 
252  TR << "Total score before staple minimization: " << (*scorefxn)( pose ) << std::endl;
253 
254  // the movable dof's
256  mm->set_chi( seqpos_, true );
257  mm->set_chi( seqpos_ + staple_gap_, true);
258  protocols::simple_moves::MinMover min_mover( mm, scorefxn, "dfpmin_armijo_nonmonotone_atol", 10.0 /*tolerance*/,
259  true /*use_nblist*/, false /*deriv_check*/, false /* non verbose-deriv-check, default*/ );
260  min_mover.min_options()->nblist_auto_update( true );
261  min_mover.apply( pose );
262 
263  TR << "Total score after staple minimization: " << (*scorefxn)( pose ) << std::endl;
264 }
265 
266 } // moves
267 } // protocols