Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SwitchChainOrderMover.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 SwitchChainOrderMover.cc
11 /// @brief
12 
13 // Unit headers
19 #include <basic/Tracer.hh>
20 #include <core/pose/util.hh>
21 using basic::T;
22 using basic::Error;
23 using basic::Warning;
24 static basic::Tracer TR("protocols.simple_moves.SwitchChainOrderMover");
25 #include <utility/tag/Tag.hh>
26 
27 // AUTO-REMOVED #include <core/chemical/AtomType.hh>
28 #include <utility/vector1.hh>
29 #include <boost/foreach.hpp>
30 #define foreach BOOST_FOREACH
31 #include <core/pose/Pose.hh>
34 #include <core/pose/PDBInfo.hh>
36 
37 namespace protocols {
38 namespace simple_moves {
39 
42 {
44 }
45 
48  return new SwitchChainOrderMover;
49 }
50 
53 {
54  return "SwitchChainOrder";
55 }
56 
58  : moves::Mover("SwitchChainOrder"),
59  residue_numbers_( NULL )
60 {
61 }
62 
63 void
65 {
66  core::pose::Pose new_pose(pose);
68  new_ft.clear();
70  core::Size chain_count( 1 );
71  utility::vector1< core::Size > new_residue_numbers;
72  new_residue_numbers.clear();
73  utility::vector1< core::Size > positions_in_new_pose;
74  positions_in_new_pose.clear();
75  foreach( char const chaini, chain_order() ){
76  core::Size const chain( chaini - '0' );
77  runtime_assert( chain > 0 && chain <= conf.num_chains() );
78  core::Size const chain_begin( conf.chain_begin( chain ) );
79  core::Size const chain_end( conf.chain_end( chain ) );
80 
81  core::Size const new_chain_begin( positions_in_new_pose.size() + 1 );
82  for( core::Size i = chain_begin; i<=chain_end; ++i )
83  positions_in_new_pose.push_back( i );
84  core::Size const new_chain_end( positions_in_new_pose.size() );
85  if( residue_numbers_() != NULL ){
86  foreach( core::Size const residue_number, residue_numbers_->obj ){
87  if( residue_number >= chain_begin && residue_number <= chain_end )
88  new_residue_numbers.push_back( residue_number - ( chain_begin - new_chain_begin ) );
89  }
90  }
91  new_ft.add_edge( new_chain_begin, new_chain_end, -1 );
92  if( chain_count > 1 )
93  new_ft.add_edge( 1, new_chain_begin, chain_count - 1 );
94  chain_count++;
95  }
96  new_ft.reorder( 1 );
97  core::pose::create_subpose( pose, positions_in_new_pose, new_ft, new_pose );
98  new_pose.update_residue_neighbors();
99  new_pose.pdb_info( new core::pose::PDBInfo( new_pose, true ) ); //reinitialize the PDBInfo
100  pose.clear();
101  pose = new_pose;
103  ( *scorefxn() ) ( pose );
105  TR<<"New pose's foldtree "<<pose.fold_tree()<<std::endl;
106  if( residue_numbers_() != NULL ){
107  residue_numbers_->obj = new_residue_numbers;
108  TR<<"new residue numbers: ";
109  foreach( core::Size const res, residue_numbers_->obj )
110  TR<<res<<", ";
111  TR<<std::endl;
112  }
113 }
114 
118 }
119 
122 {
123  return new SwitchChainOrderMover( *this );
124 }
125 
128 {
129  return new SwitchChainOrderMover;
130 }
131 
132 void
134  utility::tag::TagPtr const tag,
138  core::pose::Pose const & )
139 {
140  chain_order( tag->getOption< std::string >( "chain_order" ) );
141  std::string const residue_numbers_setter( tag->getOption< std::string >( "residue_numbers_setter", "" ) );
143  if( residue_numbers_setter != "" )
144  residue_numbers_ = protocols::moves::get_set_from_datamap< protocols::moves::DataMapObj< utility::vector1< core::Size > > >( "residue_numbers", residue_numbers_setter, data );
145 
146 }
147 
148 void
150  chain_order_ = co;
151 }
152 
155 {
156  return chain_order_;
157 }
158 
159 void
161 
164 
165 } // simple_moves
166 } // protocols