Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseBetaAntiParallelJumpSampleGenerator.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 StepWiseBetaAntiParallelJumpSampleGenerator
11 /// @brief Subclass of StepWisePoseSampleGenerator
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
19 #include <core/types.hh>
20 #include <core/kinematics/Jump.hh>
22 #include <core/pose/Pose.hh>
23 // AUTO-REMOVED #include <ObjexxFCL/format.hh>
24 #include <ObjexxFCL/string.functions.hh>
25 #include <basic/database/open.hh>
26 
27 // AUTO-REMOVED #include <utility/io/ozstream.hh>
28 #include <utility/io/izstream.hh>
29 
30 #include <iostream>
31 #include <string>
32 
33 //Auto Headers
34 #include <utility/vector1.hh>
35 #include <utility/io/mpistream.hh>
36 
37 
38 
39 using namespace core;
40 
41 namespace protocols {
42 namespace swa {
43 namespace protein {
44 
45  //////////////////////////////////////////////////////////////////////////
46  //constructor!
47  StepWiseBetaAntiParallelJumpSampleGenerator::StepWiseBetaAntiParallelJumpSampleGenerator(
48  core::pose::Pose const & pose,
49  Size const moving_residue ):
50  StepWiseProteinJumpSampleGenerator( 0, jumps_ ) //generic
51  {
52  Size which_jump = get_antiparallel_beta_jumps( pose, moving_residue );
53  initialize( which_jump, jumps_ );
54  }
55 
56  Size
58 
59  using namespace core::kinematics;
61 
62  Size which_jump = 0;
63  jumps_.clear();
64 
65  // Which jump connects into the new residue ("sample_res")? We're going to figure out nice beta-pairing jumps to it.
66  bool downstream( false );
67  FoldTree const & f( pose.fold_tree() );
68 
69  for ( Size i = 1; i <= f.num_jump(); i++ ) {
70  if ( f.upstream_jump_residue( i ) == sample_res ){
71  downstream = true;
72  which_jump = i; break;
73  } else if (f.downstream_jump_residue( i ) == sample_res ){
74  downstream = false;
75  which_jump = i; break;
76  }
77  }
78  if ( which_jump == 0 ) utility_exit_with_message( "Could not find the jump for sample_beta?!" );
79 
80  std::string atom_base, atom_sample;
81  if ( downstream ){
82  atom_base = f.upstream_atom( which_jump );
83  atom_sample = f.downstream_atom( which_jump );
84  } else {
85  atom_base = f.downstream_atom( which_jump );
86  atom_sample = f.upstream_atom( which_jump );
87  }
88  atom_base = strip_whitespace( atom_base );
89  atom_sample = strip_whitespace( atom_sample );
90 
91  std::string const jump_library_file( basic::database::full_name( "clustered_beta_pairs.dat" ) );
92  utility::io::izstream data( jump_library_file.c_str() );
93  if ( !data.good() ) utility_exit_with_message( "Unable to open file: " +jump_library_file + '\n' );
94 
95  std::string line, atom1_in, atom2_in, tag;
96  Jump jump;
97  while( getline(data, line) ) {
98  std::istringstream is( line );
99  is >> tag >> atom1_in >> atom2_in;
100  is >> jump;
101 
102  std::cout << atom1_in << " " << atom_base << " " << atom2_in << " " << atom_sample << std::endl;
103 
104  if ( (atom1_in == atom_base) && (atom2_in == atom_sample ) ){
105  if ( !downstream ) jump.reverse();
106  jumps_.push_back( jump );
107  }
108  }
109  data.close();
110 
111  std::cout << "FOUND " << jumps_.size() << " JUMPS!" << std::endl;
112 
113  return which_jump;
114 
115  }
116 
117 }
118 }
119 }