Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
O2M_MutateMover.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/O2M_MutateMover.cc
11 /// @brief Mover that takes a single starting structure and some task ops, and produces every single possible point mutation
12 /// DOES NOT WORK WITH ROSETTASCRIPTS
13 /// @author Ken Jung
14 
15 // Unit headers
17 
18 #include <core/pose/Pose.hh>
19 #include <core/pose/util.hh>
26 
28 
29 #include <utility/string_util.hh>
30 
31 //Auto Headers
33 
34 #include <basic/Tracer.hh>
35 
36 namespace protocols{
37 namespace simple_moves{
38 
39 static basic::Tracer TR( "protocols.simple_moves.O2M_MutateMover" );
40 
42 {
43  using namespace core::pack::task;
44  using namespace core::pack::task::operation;
45  using namespace core::chemical;
46  using namespace core::conformation;
47 
48  if( ! task_factory_) {
49  TR << "Task factory not initialized" << std::endl;
50  return;
51  }
52  if( ! scorefxn_) {
53  TR << "Score function not initialized" << std::endl;
54  return;
55  }
56 
57  PoseSP starting_pose = (*pmap["input"])[0];
58  core::pose::add_comment( *starting_pose, "mut_pos", "AA0" );
59  PackerTaskCOP starting_task = task_factory_->create_task_and_apply_taskoperations( *starting_pose );
60 
61  for( core::Size resi = 1; resi <= starting_pose->total_residue(); ++resi ){
62  if( starting_task->residue_task( resi ).being_designed() && starting_pose->residue(resi).is_protein() ) {
63  std::list<ResidueTypeCOP> const & allowed( starting_task->residue_task( resi ).allowed_residue_types() );
64  for( std::list<ResidueTypeCOP>::const_iterator itr=allowed.begin(); itr != allowed.end(); itr++ ){
65  if( (*itr)->aa() != starting_pose->residue( resi ).aa() ) {
66  PoseSP working_pose( new Pose( *starting_pose) );
67 
68  PackerTaskOP mutate_task( starting_task->clone() );
69 
70  // Create the new residue and replace it
72  **itr, working_pose->residue(resi),
73  working_pose->conformation());
74  // Make sure we retain as much info from the previous res as possible
75  copy_residue_coordinates_and_rebuild_missing_atoms( working_pose->residue(resi),
76  *new_res, working_pose->conformation() );
77  working_pose->replace_residue(resi, *new_res, false );
78 
79 
80  TR << "Mutated pos " << resi << " from " << starting_pose->residue( resi ).name3() << " to " << working_pose->residue( resi ).name3() << std::endl;
81  // although normal mutation notation is A20Q, by doing AQ20 we can use index to get residue type easily
82  std::string mut_pos;
83  mut_pos += starting_pose->residue( resi ).name1();
84  mut_pos += working_pose->residue(resi).name1();
85  mut_pos += utility::to_string(resi);
86  core::pose::add_comment( *working_pose, "mut_pos", mut_pos );
87  pmap["input"]->push_back( working_pose );
88  }
89  }
90  }
91  }
92 }
93 
94 void O2M_MutateMover::parse_def( utility::lua::LuaObject const & def,
95  utility::lua::LuaObject const & score_fxns,
96  utility::lua::LuaObject const & tasks,
98 
99  if( def["scorefxn"] ) {
100  scorefxn_ = protocols::elscripts::parse_scoredef( def["scorefxn"], score_fxns );
101  } else {
102  scorefxn_ = score_fxns["score12"].to<core::scoring::ScoreFunctionSP>()->clone();
103  }
104  if( def["tasks"] ) {
105  task_factory_ = protocols::elscripts::sp_parse_taskdef( def["tasks"], tasks );
106  } else {
108  }
109 }
110 
111 }//simple_moves
112 }//protocols