Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SpecificResiduesNearInterfaceFilter.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 sw=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/protein_interface_design/filters/SpecificResiduesNearInterfaceFilterCreator.hh
11 /// @brief Pass if a specific set of residues are near the interface
12 /// @author Arpit Tandon
13 /// @author Matthew O'Meara (mattjomeara@gmail.com)
14 
17 #include <core/pose/Pose.hh>
19 #include <utility/tag/Tag.hh>
22 
23 #include <basic/Tracer.hh>
25 #include <utility/vector1.hh>
28 
29 // C++ Headers
30 #include <utility/excn/Exceptions.hh>
31 #include <sstream>
32 
33 namespace protocols {
34 namespace protein_interface_design {
35 namespace filters {
36 
37 using std::endl;
38 using std::string;
39 using std::stringstream;
40 using std::ostream;
41 using core::pose::Pose;
42 using core::Real;
43 using core::Size;
49 using utility::vector1;
50 
51 static basic::Tracer TR( "protocols.protein_interface_design.filters.SpecificResiduesNearInterfaceFilter" );
52 
53 //////////// Creator ////////////////////////
57 }
58 
59 string
61  return "SpecificResiduesNearInterface";
62 }
63 /////////// End Creator /////////////////////
64 
65 
66 ///@brief default ctor
68  parent( "SpecificResiduesNearInterfaceFilter" ),
69  task_factory_(NULL),
70  rb_jump_(1)
71 {}
72 
75  parent( "SpecificResiduesNearInterfaceFilter" ),
76  task_factory_(src.task_factory_),
77  rb_jump_(src.rb_jump_)
78 {}
79 
81 
85 }
86 
89  return new SpecificResiduesNearInterfaceFilter( *this );
90 }
91 
92 
95  return task_factory_;
96 }
97 
98 void
100  TaskFactoryOP tf
101 ){
102  task_factory_ = tf;
103 }
104 
105 void
107  utility::tag::TagPtr const tag,
111  Pose const & )
112 {
113  if(!tag->hasOption("task_operations" )){
114  throw utility::excn::EXCN_RosettaScriptsOption(
115  "Please specify a task operation for the residues that should be near the other chain.");
116  }
117  task_factory(parse_task_operations( tag, data ));
118 
119  rb_jump_ = tag->getOption<core::Size>( "jump_number", 1 );
120 
121  // TODO make this work
122  // interface_distance_threshold_ = tag->getOption<core::Size>( "interface_distance_threshold", 8 );
123  //
124  // TR
125  // << "Specific Residues Near Interface over jump number " << rb_jump_
126  // << " with threshold " << residues_in_interface_threshold_ << endl;
127 }
128 
129 
130 Size
132  Pose const & pose
133 ) const {
134 
135  if(!task_factory_){
136  utility_exit_with_message(
137  "Please specify a task operation for the residues that should be near the other chain.");
138  }
139 
140  if(pose.conformation().num_chains() <= rb_jump_){
141  stringstream error_msg;
142  error_msg
143  << "You have specied jump number '" << rb_jump_ << "', "
144  << "however the pose only has '" << pose.conformation().num_chains() << "' "
145  << "chains." << endl;
146  utility_exit_with_message(error_msg.str());
147  }
148 
149  Interface interface(rb_jump_);
150  interface.calculate(pose);
151 
152  PackerTaskCOP task(task_factory_->create_task_and_apply_taskoperations(pose));
153  vector1< bool > relevant_residues(task->repacking_residues());
154 
155  bool all_at_interface(true);
156  for(Size residue_number=1;
157  residue_number <= pose.total_residue(); ++residue_number){
158  if(!relevant_residues[residue_number]) continue;
159 
160  if(!interface.is_interface(residue_number)){
161  all_at_interface = false;
162  break;
163  }
164  }
165 
166  return all_at_interface;
167 }
168 
169 bool
171  Pose const & pose
172 ) const {
173  return compute(pose);
174 }
175 
176 
177 void
179  ostream & out,
180  Pose const & pose
181 ) const {
182  out
183  << "SpecificResiduesNearInterfaceFilter returns "
184  << (compute(pose) ? "true" : "false") << endl;
185 }
186 
187 
188 Real
190  Pose const & pose
191 ) const {
192  return(static_cast<Real>(compute(pose)));
193 }
194 
195 
196 } // namespace
197 } // namespace
198 } // namespace