Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_filters.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/protein_interface_design/parse_filters.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 
14 // Project Headers
15 #include <core/types.hh>
16 #include <utility/exit.hh>
17 
21 //#include <protocols/moves/ResidueMover.hh>
22 #include <utility/tag/Tag.hh>
25 
26 // Utility Headers
27 #include <basic/Tracer.hh>
28 
29 // Unit Headers
30 
31 // C++ headers
32 #include <map>
33 #include <string>
34 
35 #include <core/chemical/AA.hh>
36 #include <utility/vector0.hh>
37 #include <utility/excn/Exceptions.hh>
38 #include <utility/vector1.hh>
39 
40 using namespace core;
41 using namespace core::scoring;
42 
43 static basic::Tracer TR( "protocols.protein_interface_design.parse_filters" );
44 
45 namespace protocols {
46 namespace protein_interface_design {
47 using namespace protocols::filters;
48 
49 using namespace protocols::moves;
50 
51 using namespace utility::tag;
52 using namespace std;
53 
54 void
55 ResiduesInInterfaceFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & )
56 {
57  residues_in_interface_threshold_ = tag->getOption<core::Size>( "residues", 20 );
58  rb_jump_ = tag->getOption<core::Size>( "jump_number", 1 );
59 
60  TR<<"residues in interface filter over jump number " << rb_jump_ << " with threshold "<<residues_in_interface_threshold_<<std::endl;
61 }
62 
63 void
64 ScoreTypeFilter::parse_my_tag( TagPtr const tag, DataMap & data, Filters_map const &, Movers_map const &, core::pose::Pose const & )
65 {
66  using namespace core::scoring;
67 
68  std::string const scorefxn_name( tag->getOption<string>( "scorefxn", "score12" ) );
69  scorefxn_ = new ScoreFunction( *(data.get< ScoreFunction * >( "scorefxns", scorefxn_name )) );
70  score_type_ = core::scoring::score_type_from_name( tag->getOption<string>( "score_type", "total_score" ) );
71  if( ! tag->hasOption( "threshold" ) ) throw utility::excn::EXCN_RosettaScriptsOption("Must specify 'threshold' for ScoreTypeFilter.");
72  score_type_threshold_ = tag->getOption<core::Real>( "threshold" );
73 
74  TR<<"ScoreType filter for score_type "<<score_type_<<" with threshold "<<score_type_threshold_<<std::endl;
75 }
76 
77 void
78 InterfaceSasaFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & )
79 {
80  lower_threshold_ = tag->getOption<core::Real>( "threshold", 800 );
81  jump( tag->getOption< core::Size >( "jump", 1 ));
82  hydrophobic_ = tag->getOption<bool>( "hydrophobic", false );
83  polar_ = tag->getOption<bool>( "polar", false );
84  runtime_assert( !hydrophobic_ || !polar_ );
85  if( jump() != 1 && ( polar_ || hydrophobic_ ) )
86  throw utility::excn::EXCN_RosettaScriptsOption( "ERROR: presently, only total sasa is supported across a jump other than 1. Remove polar and hydrophobic flags and try again." );
87 
88  TR<<"SasaFilter with lower threshold of "<<lower_threshold_<<" Ang^2 and jump "<<jump()<<'\n';
89  if( hydrophobic_ )
90  TR<<"Only reporting hydrophobic sasa\n";
91  if( polar_ )
92  TR<<"Only reporting polar sasa\n";
93  TR.flush();
94 }
95 
96 void
97 AlaScan::parse_my_tag( TagPtr const tag, DataMap & data, Filters_map const &, Movers_map const &, core::pose::Pose const & )
98 {
99  distance_threshold_ = tag->getOption<core::Real>( "interface_distance_cutoff", 8.0 );
100  chain1_ = tag->getOption< bool >( "partner1", 0 );
101  chain2_ = tag->getOption< bool >( "partner2", 1 );
102  jump_ = tag->getOption< Size >( "jump", 1 );
103  runtime_assert( chain1_ || chain2_ );
104  std::string const scorefxn_name( tag->getOption< string >( "scorefxn", "score12" ));
105  repeats_ = tag->getOption< core::Size >( "repeats", 1 );
106  symmetry_ = tag->getOption< bool >( "symmetry", 0 );
107  repack( tag->getOption< bool >( "repack", 1 ) );
108 
109  if ( symmetry_ ) {
110  using namespace core::scoring::symmetry;
111  scorefxn_ = new SymmetricScoreFunction( *data.get< ScoreFunction * >( "scorefxns", scorefxn_name ) );
112  TR<<"Symmetric AlaScan with distance threshold of "<<distance_threshold_<<" Ang "<<". jump="<<jump_<<" partner1="<<chain1_<<", partner2="<<chain2_<<" using "<<repeats_<<" repeats."<<std::endl;
113  return;
114  }
115  using namespace core::scoring;
116  scorefxn_ = new ScoreFunction( *(data.get< ScoreFunction * >( "scorefxns", scorefxn_name )) );
117  TR<<"AlaScan with distance threshold of "<<distance_threshold_<<" Ang "<<". jump="<<jump_<<" partner1="<<chain1_<<", partner2="<<chain2_<<" using "<<repeats_<<" repeats repack "<<repack()<<std::endl;
118 }
119 
120 void
121 NeighborTypeFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & pose )
122 {
123  residue_types_.assign( chemical::num_canonical_aas, false );
124  utility::vector0< TagPtr > const neighbor_type_tags( tag->getTags() );
125  for( utility::vector0< TagPtr >::const_iterator nt_it=neighbor_type_tags.begin(); nt_it!=neighbor_type_tags.end(); ++nt_it ) {
126  TagPtr const nt_tag_ptr = *nt_it;
127  if( nt_tag_ptr->getName() == "Neighbor" ) {
128  std::string const type( nt_tag_ptr->getOption<string>( "type" ) );
129  residue_types_[ chemical::aa_from_name( type ) ] = true;
130  }
131  }
132  target_residue_ = protocols::rosetta_scripts::get_resnum( tag, pose );
133  distance_threshold_ = tag->getOption<core::Real>( "distance", 8.0 );
134 
135  TR<<"NeighborTypeFilter with distance threshold of "<<distance_threshold_<<" around residue "<<target_residue_<<std::endl;
136 }
137 
138 void
139 ResidueBurialFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & pose )
140 {
141  target_residue_ = protocols::rosetta_scripts::get_resnum( tag, pose );
142  distance_threshold_ = tag->getOption<core::Real>( "distance", 8.0 );
143  neighbors_ = tag->getOption<core::Size>( "neighbors", 1 );
144 
145  TR<<"ResidueBurialFilter with distance threshold of "<<distance_threshold_<<" around residue "<<target_residue_<<" with "<<neighbors_<<" neighbors."<<std::endl;
146 }
147 
148 void
149 ResidueDistanceFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & pose )
150 {
151  res1_ = protocols::rosetta_scripts::get_resnum( tag, pose, "res1_" );
152  res2_ = protocols::rosetta_scripts::get_resnum( tag, pose, "res2_" );
153  distance_threshold_ = tag->getOption<core::Real>( "distance", 8.0 );
154 
155  TR<<"ResidueDistanceFilter with distance threshold of "<<distance_threshold_<<" between residues "<<res1_<<" and "<<res2_<<std::endl;
156 }
157 
158 void
159 DdgFilter::parse_my_tag( TagPtr const tag, DataMap & data, Filters_map const & , Movers_map const & , core::pose::Pose const & )
160 {
161  using namespace core::scoring;
162 
163  std::string const scorefxn_name( tag->getOption<string>( "scorefxn", "score12" ) );
164  scorefxn_ = new ScoreFunction( *(data.get< ScoreFunction * >( "scorefxns", scorefxn_name )) );
165  ddg_threshold_ = tag->getOption<core::Real>( "threshold", -15 );
166  rb_jump_ = tag->getOption< core::Size >( "jump", 1 );
167  repeats( tag->getOption< core::Size >( "repeats", 1 ) );
168  repack( tag->getOption< bool >( "repack", 1 ) );
169  symmetry_ = tag->getOption<bool>( "symmetry", 0 );
170 
171  if( repeats() > 1 && !repack() )
172  throw utility::excn::EXCN_RosettaScriptsOption( "ERROR: it doesn't make sense to have repeats if repack is false, since the values converge very well." );
173 
174  if ( symmetry_ )
175  TR<<"ddg filter with threshold "<< ddg_threshold_<<" repeats="<<repeats()<<" and scorefxn "<<scorefxn_name<<" with symmetry " <<std::endl;
176  else
177  TR<<"ddg filter with threshold "<< ddg_threshold_<<" repeats="<<repeats()<<" and scorefxn "<<scorefxn_name<<" over jump "<<rb_jump_<<" and repack "<<repack()<<std::endl;
178 }
179 
180 void
181 HbondsToResidueFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & pose )
182 {
183  partners_ = tag->getOption<core::Size>( "partners" );
184  energy_cutoff_ = tag->getOption<core::Real>( "energy_cutoff", -0.5 );
185  backbone_ = tag->getOption<bool>( "backbone", 0 );
186  sidechain_ = tag->getOption<bool>( "sidechain", 1 );
187  resnum_ = protocols::rosetta_scripts::get_resnum( tag, pose );
188 
189  TR<<"Hbonds to residue filter for resnum "<<resnum_<<" with "<<partners_<<" hbonding partners"<<std::endl;
190 }
191 
192 void
193 EnergyPerResidueFilter::parse_my_tag( TagPtr const tag, DataMap & data, Filters_map const &, Movers_map const &, core::pose::Pose const & pose )
194 {
195  using namespace core::scoring;
196 
197  std::string const scorefxn_name( tag->getOption<string>( "scorefxn", "score12" ) );
198  scorefxn_ = new ScoreFunction( *(data.get< ScoreFunction * >( "scorefxns", scorefxn_name ) ));
199  score_type_ = core::scoring::score_type_from_name( tag->getOption<string>( "score_type", "total_score" ) );
200  threshold_ = tag->getOption<core::Real>( "energy_cutoff", 0.0 );
201  whole_interface_ = tag->getOption<bool>( "whole_interface" , 0 );
202  rb_jump_ = tag->getOption<core::Size>( "jump_number", 1 );
203  interface_distance_cutoff_ = tag->getOption<core::Real>( "interface_distance_cutoff" , 8.0 );
204 
205  if (whole_interface_==1 ) {
206  resnum_ = 1;
207  TR<<"energies for all interface residues with a distance cutoff of "
208  << interface_distance_cutoff_ << " A will be calculated \n"
209  << "jump_number is set to "<< rb_jump_
210  << "\n and scorefxn " <<scorefxn_name <<" will be used" <<std::endl;
211  }
212  else {
213  resnum_ = protocols::rosetta_scripts::get_resnum( tag, pose );
214  TR<<"EnergyPerResidueFilter for residue "<<resnum_<<" of score_type "<<score_type_<<" with cutoff "<<threshold_<<std::endl;
215  }
216 }
217 
218 void
219 BuriedUnsatHbondFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & )
220 {
221  jump_num_ = tag->getOption<core::Size>( "jump_number", 1 );
222  upper_threshold_ = tag->getOption<core::Size>( "cutoff", 20 );
223 
224  TR<<"Buried Unsatisfied Hbond filter over jump number " << jump_num_ << " with cutoff " << upper_threshold_ << std::endl;
225 }
226 
227 void
228 TerminusDistanceFilter::parse_my_tag( TagPtr const tag, DataMap &, Filters_map const &, Movers_map const &, core::pose::Pose const & )
229 {
230  jump_num_ = tag->getOption<core::Size>( "jump_number", 1 );
231  distance_ = tag->getOption<core::Size>( "distance", 5 );
232 
233  TR<<"Distance From Terminus filter over jump number " << jump_num_ << " with cutoff " << distance_ << std::endl;
234 }
235 
236 
237 } // protein_interface_design
238 } // devel