Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LimitAromaChi2Operation.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/toolbox/task_operations/LimitAromaChi2Operation.cc
11 /// @brief eliminate aromatic rotamers, of which chi2 are around 0, 180 degree.
12 /// @detail Chi2=0, 180 rotamers of aromatic residues ( PHE, TYR, HIS ) are not observed in nature very much,
13 /// however Rosetta really like them. This is really pathology. For design purpose, we don't need them actually.
14 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
15 
16 
17 // Unit Headers
20 
21 #include <core/chemical/AA.hh>
23 // AUTO-REMOVED #include <core/pose/Pose.hh>
24 // AUTO-REMOVED #include <core/pack/rotamer_set/RotamerSet_.hh>
28 #include <utility/tag/Tag.hh>
29 
30 
32 #include <utility/vector0.hh>
33 #include <utility/vector1.hh>
34 
35 #ifdef WIN32
36  #include <core/graph/Graph.hh>
37 #endif
38 
39 namespace protocols {
40 namespace toolbox {
41 namespace task_operations {
42 
43 
45  RotamerSetOperation(),
46  chi2max_( 110 ),
47  chi2min_( 70 ),
48  include_trp_( false )
49 {}
50 
52  RotamerSetOperation(),
53  chi2max_( chi2max ),
54  chi2min_( chi2min ),
55  include_trp_( false )
56 {}
57 
59 
62 {
63  return new LimitAromaChi2_RotamerSetOperation( *this );
64 }
65 
66 void
68  Pose const &,
69  ScoreFunction const &,
70  //mjo commenting out 'ptask' because it is unused and causes a warning
71  PackerTask const & /*ptask*/,
72  GraphCOP,
73  RotamerSet & rotamer_set
74 )
75 {
76 
77  utility::vector1< bool > rotamers_to_delete;
78  rotamers_to_delete.resize( rotamer_set.num_rotamers() );
79  Size irot( 0 ), num_to_delete(0);
80  for( Rotamers::const_iterator it=rotamer_set.begin(), ite=rotamer_set.end(); it != ite; ++it ) {
81 
82  irot ++;
83  rotamers_to_delete[ irot ] = false;
85  if( rop->aa() == core::chemical::aa_tyr ||
86  rop->aa() == core::chemical::aa_phe ||
87  rop->aa() == core::chemical::aa_his ||
88  (rop->aa() == core::chemical::aa_trp && include_trp_) )
89  {
90 
91  runtime_assert( rop->nchi() >= 2 );
92  utility::vector1< Real > chi( rop->chi() );
93 
94  if( chi[ 2 ] < 0 ) {
95  chi[ 2 ] += 180.0;
96  }
97 
98  if( chi[ 2 ] > chi2max_ || chi[ 2 ] < chi2min_ ) {
99  rotamers_to_delete[ irot ] = true;
100  num_to_delete++;
101  }
102  }
103 
104  }
105  //flo nov 2010: if all the rotamers in the rotamer set are to be deleted,
106  //and there is no input rotamer at that position, this will cause a program exit
107  //if this is the case (rare), it's probably best to not delete any rotamers
108  if( (num_to_delete == rotamer_set.num_rotamers() ) && (rotamer_set.id_for_current_rotamer() == 0 ) ){
109  //std::cerr << "shit condition at position " << rotamer_set.resid() << ", not deleting any of the " << rotamer_set.num_rotamers() << " rotamers." << std::endl;
110  return;
111  }
112  rotamer_set.drop_rotamers( rotamers_to_delete );
113 
114 } // alter_rotamer_set
115 
116 ///////////////////////////////////////////////////////////////////////////////////////////
119 {
120  return new LimitAromaChi2Operation;
121 }
122 
123 /// @brief defauot constructor
125  TaskOperation(),
126  chi2max_( 110 ),
127  chi2min_( 70 ),
128  include_trp_( false )
129 {}
130 
131 /// @brief destructor
133 
134 /// @brief clone
137  return new LimitAromaChi2Operation( *this );
138 }
139 
140 //mjo commenting out 'pose' because it is unused and causes a warning
141 /// @brief
142 void
143 LimitAromaChi2Operation::apply( Pose const & /*pose*/, PackerTask & task ) const
144 {
146  rso->include_trp( include_trp_ );
147  task.append_rotamerset_operation( rso );
148 }
149 
150 void
152 {
153  chi2max( tag->getOption< Real >( "chi2max", 110.0 ) );
154  chi2min( tag->getOption< Real >( "chi2min", 70.0 ) );
155  include_trp( tag->getOption< bool >( "include_trp", 0 ) );
156 }
157 
158 void
159 LimitAromaChi2Operation::parse_def( utility::lua::LuaObject const & def)
160 {
161  chi2max( def["chi2max"] ? def["chi2max"].to<Real>() : 110.0 );
162  chi2min( def["chi2min"] ? def["chi2min"].to<Real>() : 70.0 );
163 }
164 
165 
166 
167 } // TaskOperations
168 } // toolbox
169 } // protocols
170