Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RNA_AddOrDeleteMover.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 RNA_AddOrDeleteMover
11 /// @brief AddOrDeletes an RNA residue from a chain terminus.
12 /// @detailed
13 /// @author Rhiju Das
14 
20 
21 // libRosetta headers
22 #include <core/types.hh>
23 #include <core/pose/Pose.hh>
25 #include <core/pose/util.hh>
26 #include <basic/Tracer.hh>
27 
28 
29 using namespace core;
30 using core::Real;
31 
32 //////////////////////////////////////////////////////////////////////////
33 // Removes one residue from a 5' or 3' chain terminus, and appropriately
34 // updates the pose sub_to_full_info object.
35 //////////////////////////////////////////////////////////////////////////
36 
37 static basic::Tracer TR( "protocols.swa.monte_carlo.rna_add_or_delete_mover" ) ;
38 
39 namespace protocols {
40 namespace swa {
41 namespace monte_carlo {
42 
43 
44  //////////////////////////////////////////////////////////////////////////
45  //constructor!
46  RNA_AddOrDeleteMover::RNA_AddOrDeleteMover( RNA_AddMoverOP rna_add_mover,
47  RNA_DeleteMoverOP rna_delete_mover ) :
48  rna_add_mover_( rna_add_mover ),
49  rna_delete_mover_( rna_delete_mover ),
50  allow_deletion_of_last_residue_( false )
51  {}
52 
53  //////////////////////////////////////////////////////////////////////////
54  //destructor
56  {}
57 
58  void
60  std::string move_type = "";
61  apply( pose, move_type );
62  }
63 
64  //////////////////////////////////////////////////////////////////////////
65  void
67  {
68 
69  // should stuff into AddOrDeleteMover
70  Size res_at_terminus;
71  MovingResidueCase moving_residue_case;
72  AddOrDeleteChoice add_or_delete_choice;
73 
74  SubToFullInfo & sub_to_full_info = nonconst_sub_to_full_info_from_pose( pose );
75  utility::vector1< Size > const & moving_res_list = sub_to_full_info.moving_res_list();
76 
77  //always have something in play!!?? Or permit removal??!! need to check this carefully.
78  bool disallow_delete = allow_deletion_of_last_residue_ && ( moving_res_list.size() <= 1 );
79 
80  get_random_residue_at_chain_terminus( pose, res_at_terminus, moving_residue_case, add_or_delete_choice, disallow_delete );
81 
82  TR.Debug << "ADD/DELETE move ==> res: " << res_at_terminus << " case: " << moving_residue_case << " add/delete: " << add_or_delete_choice << std::endl;
83 
84  if ( add_or_delete_choice == DELETE ) {
85  move_type = "delete";
86  //std::cout << "Before delete: " << (*scorefxn)( pose ) << std::endl;
87  rna_delete_mover_->apply( pose, res_at_terminus, moving_residue_case );
88  TR.Debug << std::cout << pose.annotated_sequence() << std::endl;
89  //std::cout << "After delete: " << (*scorefxn)( pose ) << std::endl << std::endl;
90  } else {
91  runtime_assert( add_or_delete_choice == ADD );
92  // try to add a residue that is supposed to be sampled.
93  move_type = "add";
94  //std::cout << "Before adding onto " << res_at_terminus << " : " << (*scorefxn)( pose ) << std::endl;
95  rna_add_mover_->apply( pose, res_at_terminus, moving_residue_case );
96  TR.Debug << pose.annotated_sequence() << std::endl;
97  // std::cout << "After add: " << (*scorefxn)( pose ) << std::endl << std::endl;
98  //pose.dump_pdb( "after_add.pdb" );
99  }
100 
101  }
102 
103 
106  return "RNA_AddOrDeleteMover";
107  }
108 
109 }
110 }
111 }