Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MembraneTopologyClaimer.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file MembraneTopologyClaimer
10 /// @brief membrane topology
11 /// @author Yifan Song
12 
13 // Unit Headers
17 
18 // Project headers
19 #include <basic/options/option.hh>
26 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
27 
28 
29 // Package Headers
33 
34 // option key includes
35 #include <basic/options/keys/membrane.OptionKeys.gen.hh>
36 #include <basic/options/keys/in.OptionKeys.gen.hh>
37 
38 // Project Headers
39 #include <core/pose/Pose.hh>
41 #include <basic/datacache/BasicDataCache.hh>
42 #include <basic/Tracer.hh>
43 #include <numeric/random/random.hh>
44 
45 #include <utility/vector0.hh>
46 #include <utility/vector1.hh>
47 
48 
49 static basic::Tracer TR("protocols.topo_broker.membrane_topology",basic::t_info);
50 static numeric::random::RandomGenerator RG(786137);
51 
52 namespace protocols {
53 namespace topology_broker {
54 
55 using namespace core;
56 
57 
59 
61  input_pose_(input_pose)
62 {}
63 
64 void
66  moves::RandomMover& random_mover,
67  core::pose::Pose const& pose,
68  abinitio::StageID /*stageID, abinitio sampler stage */,
69  core::scoring::ScoreFunction const& /*scorefxn*/,
70  core::Real /*progress progress within stage */
71 )
72 {
73  if ( basic::options::option[basic::options::OptionKeys::membrane::fixed_membrane] ) {
74  //moves::MoverOP move_pose_to_membrane = new moves::MovePoseToMembraneCenterMover;
75  //core::Real move_pose_to_membrane_weight(1.0);
76  //random_mover.add_mover( move_pose_to_membrane, move_pose_to_membrane_weight);
77 
78  moves::MoverOP membrane_center_perturbation_mover = new rigid::MembraneCenterPerturbationMover;
79  core::Real membrane_center_perturbation_weight(2.0);
80  random_mover.add_mover( membrane_center_perturbation_mover, membrane_center_perturbation_weight );
81 
82  // TR << pose.fold_tree();
83  // if pose is symmetric or option has symmetry, no rotation trial
84  if ( !core::pose::symmetry::is_symmetric( pose ) ) {
85  moves::MoverOP membrane_normal_perturbation_mover = new rigid::MembraneNormalPerturbationMover;
86  core::Real membrane_normal_perturbation_weight(5.0);
87  random_mover.add_mover( membrane_normal_perturbation_mover, membrane_normal_perturbation_weight);
88  }
89  }
90 }
91 
92 /*
93 void MembraneTopologyClaimer::new_decoy( core::pose::Pose const& pose ) {
94  //get rigid-body orientation of jump and safe for later use in initialize_dofs();
95 
96 }
97 */
98 
100  core::pose::Pose& pose,
101  DofClaims const& /*init_dofs*/,
102  DofClaims& /*failed_to_init*/
103 ) {
104  using basic::options::option;
105  using namespace basic::options;
106  using namespace basic::options::OptionKeys;
107 
108  //using core::pose::datacache::CacheableDataType::MEMBRANE_TOPOLOGY;
109  runtime_assert ( option[in::file::spanfile].user() );
110 
111  std::string const spanfile = option[ in::file::spanfile ]();
115  topology.initialize(spanfile);
116 
117  if ( basic::options::option[basic::options::OptionKeys::membrane::fixed_membrane] ) {
118  if ( !core::pose::symmetry::is_symmetric( pose ) ) {
120  }
121  }
122 }
123 
124 // void MembraneTopologyClaimer::generate_sequence_claims( DofClaims& /* new_claims */) {
125 // new_claims.push_back( new SequenceClaim( this, 1, 1, label(), DofClaim::INIT /* for now... eventually CAN_INIT ? */ ) );
126 // }
127 
128 ////////////////////////////////////////////////////////////////////////////////////////////////////
129 /// @details Adds a virtual residue to a pose as the root.
130 /// Jump is to a residue in the middle of a transmembrane segment.
132  int nres = pose.total_residue();
133 
135 
136  // return if the pose is empty (otherwise will segfault)
137  if (nres == 0) {
138  TR.Warning << "addVirtualResAsRootMembrane() called with empty pose!" << std::endl;
139  return;
140  }
141 
142  // find residue in the middle of transmembrane region
143  // pick a random transmembrane segment
144  Size ihelix = int(RG.uniform() * topology.tmhelix() + 1.);
145  Size jump_res (int(0.5 * (topology.span_begin(ihelix) + topology.span_end(ihelix))));
146 
147  // create a virtual residue, fullatom or centroid
148  bool fullatom = pose.is_fullatom();
149  core::chemical::ResidueTypeSetCAP const &residue_set(
152  );
153  core::chemical::ResidueTypeCOPs const & rsd_type_list( residue_set->name3_map("VRT") );
155 
156  // move to membrane_center if it's defined
157  if ( basic::options::option[basic::options::OptionKeys::membrane::membrane_center].user() ) {
158  Vector mem_center;
159  mem_center.x() = basic::options::option[basic::options::OptionKeys::membrane::membrane_center]()[1];
160  mem_center.y() = basic::options::option[basic::options::OptionKeys::membrane::membrane_center]()[2];
161  mem_center.z() = basic::options::option[basic::options::OptionKeys::membrane::membrane_center]()[3];
162 
163  for ( Size j=1; j<= new_res->natoms(); ++j ) {
164  new_res->atom(j).xyz( new_res->atom(j).xyz() + mem_center );
165  }
166  }
167 
168  core::pose::Pose closed_loops_pose( pose );
169  closed_loops_pose.fold_tree( broker().final_fold_tree() );
170 
171  pose.append_residue_by_jump( *new_res , jump_res );
172  closed_loops_pose.append_residue_by_jump( *new_res, jump_res );
173 
174  // make the virt atom the root
175  kinematics::FoldTree newF( pose.fold_tree() );
176  newF.reorder( nres+1 );
177  TR << "addVirtualResAsRoot() setting new fold tree to " << newF << std::endl;
178  TR << " jump_res = " << jump_res << std::endl;
179  pose.fold_tree( newF );
180 
181  kinematics::FoldTree finalF( closed_loops_pose.fold_tree() );
182  finalF.reorder( nres+1 );
183  broker().final_fold_tree() = finalF;
184 
185 }
186 
187 } //topology_broker
188 } //protocols