Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResLvlTaskOperations.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 core/pack/task/operation/ResLvlTaskOperations.cc
11 /// @brief
12 /// @author ashworth
13 
14 // Unit Headers
17 
19 
20 #include <core/chemical/AA.hh>
21 #include <utility/tag/Tag.hh>
22 #include <utility/exit.hh>
23 
24 #include <sstream>
25 
26 #include <utility/vector0.hh>
27 #include <utility/vector1.hh>
28 
29 
30 namespace core {
31 namespace pack {
32 namespace task {
33 namespace operation {
34 
36 
39  return new RestrictToRepackingRLT;
40 }
41 
43 RestrictToRepackingRLT::clone() const { return new RestrictToRepackingRLT( *this ); }
44 
46 {
48 }
49 
51  : canonical_aas_to_keep_( chemical::num_canonical_aas, false )
52 {}
53 
55 
59 }
60 
63 
65 {
67 }
68 
69 // if an amino acid is not present (false) in the boolean vector, then do not allow it at this position. The boolean vector is a 20-length vector in alphabetical order by one-letter code.
71 {
72  runtime_assert( aa_flags.size() == chemical::num_canonical_aas );
73  canonical_aas_to_keep_ = aa_flags;
74 }
75 
77 {
78  using namespace chemical;
79  runtime_assert( canonical_aas_to_keep_.size() == num_canonical_aas );
80  for ( std::string::const_iterator it( aastring.begin() ), end( aastring.end() );
81  it != end; ++it ) {
82  if ( oneletter_code_specifies_aa( *it ) ) {
84  } else {
85  std::ostringstream os;
86  os << "aa letter " << *it << " does not not correspond to a canonical AA";
87  utility_exit_with_message( os.str() );
88  }
89  }
90 }
91 
93 {
94  runtime_assert( tag );
95  if ( tag->hasOption("aas") ) aas_to_keep( tag->getOption<std::string>("aas") );
96  else utility_exit_with_message("no aas tag option by which restrict absent canonical aas.");
97 }
98 
99 //BEGIN DisallowIfNonnativeRLTRLT
101  disallowed_aas_ ( chemical::num_canonical_aas, false ),
102  allowed_aas_( invert_vector( disallowed_aas_ ) )
103 {}
105  disallowed_aas_( disallowed_aas ),
106  allowed_aas_( invert_vector(disallowed_aas) )
107 {}
108 
110 
113  return new DisallowIfNonnativeRLT;
114 }
115 
117 {
118  return new DisallowIfNonnativeRLT( *this );
119 }
120 
122  allowed_aas_.clear();
123  disallowed_aas_.clear();
124 }
125 //private function to invert disallowed aas into allowed aas
128  utility::vector1< bool > inverted_vec;
129  for(core::Size ii=1; ii<=disallowed_aas_.size(); ii++ ){
130  inverted_vec.push_back( ! disallowed_aas[ii] );
131  }
132  return inverted_vec;
133 }
134 
136 {
137  runtime_assert( allowed_aas_.size() == chemical::num_canonical_aas );
139 }
140 
142  runtime_assert( cannonical_disallowed.size() == chemical::num_canonical_aas );
143  disallowed_aas_ = cannonical_disallowed;
144  allowed_aas_ = invert_vector( disallowed_aas_ );
145 }
147  using namespace chemical;
149  for ( std::string::const_iterator it( aa_string.begin() ), end( aa_string.end() );
150  it != end; ++it ) {
151  if ( oneletter_code_specifies_aa( *it ) ) {
152  aa_vector[ aa_from_oneletter_code( *it ) ] = true;
153  } else {
154  std::ostringstream os;
155  os << "aa letter " << *it << " does not not correspond to a canonical AA";
156  utility_exit_with_message( os.str() );
157  }
158  }
159  disallowed_aas_ = aa_vector;
161 }
162 
164 {
165  runtime_assert( tag );
166  if ( tag->hasOption("disallow_aas") )
167  disallow_aas( tag->getOption< std::string >( "disallow_aas" ) );
168  else utility_exit_with_message("no aas tag option by which restrict absent canonical aas.");
169 }
170 
171  //Begin PreventRepackingRLT
173 
176  return new PreventRepackingRLT;
177 }
178 
180 PreventRepackingRLT::clone() const { return new PreventRepackingRLT( *this ); }
181 
183 {
184  rlt.prevent_repacking();
185 }
186 
188 
190  : parent(),
191  behavior_( behavior )
192 {}
193 
195 
198  return new AddBehaviorRLT;
199 }
200 
202 AddBehaviorRLT::clone() const { return new AddBehaviorRLT( *this ); }
203 
205 {
206  runtime_assert( ! behavior_.empty() );
207  rlt.add_behavior( behavior_ );
208 }
209 
211 {
212  runtime_assert( tag );
213  if ( tag->hasOption("behavior") ) behavior_ = tag->getOption<std::string>("behavior");
214  else utility_exit_with_message("AddBehaviorRLT tag needs to define option \"behavior\".");
215 }
216 
217 } //namespace operation
218 } //namespace task
219 } //namespace pack
220 } //namespace core