Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HolesFilter.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/filters/HolesFilter.cc
11 /// @brief filter structures by will's hole value
12 /// @detailed
13 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
14 
15 // Unit Headers
18 
19 // Project Headers
20 // AUTO-REMOVED #include <basic/database/open.hh>
21 #include <core/types.hh>
22 #include <core/pose/Pose.hh>
24 
25 // Utility headers
26 #include <basic/Tracer.hh>
27 
28 // Parser headers
30 #include <utility/tag/Tag.hh>
31 
32 #include <utility/vector0.hh>
33 #include <utility/vector1.hh>
34 
35 //// C++ headers
36 static basic::Tracer tr("protocols.filters.HolesFilter");
37 
38 namespace protocols {
39 namespace simple_filters {
40 
41 // @brief default constructor
43  Filter( "Holes" ),
44  filtered_value_( 2.0 ),
45  cmd_( "" )
46 {}
47 
48 // @brief copy constructor
50  //utility::pointer::ReferenceCount(),
51  Super( rval ),
52  filtered_value_( rval.filtered_value_ ),
53  cmd_( rval.cmd_ )
54 {}
55 
56 // @brief set filtered value
57 void HolesFilter::filtered_value( Real const & value )
58 {
59  filtered_value_ = value;
60 }
61 
62 /// @brief
64 HolesFilter::report_sm( Pose const & pose ) const
65 {
66  return compute( pose );
67 }
68 
69 /// @brief
70 void
71 HolesFilter::report( std::ostream & out, Pose const & pose ) const
72 {
73  out << "Holes: " << compute( pose ) << std::endl;
74 }
75 
76 /// @brief
78 HolesFilter::compute( Pose const & pose ) const
79 {
82 
83  Size MAX_RES = 5000;
84  runtime_assert( pose.total_residue() <= MAX_RES );
85 
86  HolesResult result = compute_holes_score( pose, cmd_ );
87  return result.dec15_score;
88 }
89 
90 
91 // @brief returns true if the given pose passes the filter, false otherwise.
92 // In this case, the test is whether the give pose is the topology we want.
93 bool HolesFilter::apply( Pose const & pose ) const
94 {
95  Real value = compute( pose );
96  if( value < filtered_value_ ){
97  tr << "Successfully filtered: " << value << std::endl;
98  return true;
99  }else{
100  tr << "Filter failed current/threshold=" << value << "/" << filtered_value_ << std::endl;
101  return false;
102  }
103 } // apply_filter
104 
105 /// @brief parse xml
106 void
108  TagPtr const tag,
109  DataMap &,
110  filters::Filters_map const &,
111  Movers_map const &,
112  Pose const & )
113 {
114  // set filtered type
115  cmd_ = tag->getOption<String>( "cmd", "" );
116  if( cmd_ == "" ) {
117  tr << "cmd in xml file is emptry, so using -holes::dalphaball is expected. " << std::endl;
118  tr << "if both are empty, this gonna be crash. " << std::endl;
119  }
120 
121  // set threshold
122  filtered_value_ = tag->getOption<Real>( "threshold", 2.0 );
123  tr << "Structures which have holes value less than " << filtered_value_ << " will be filtered." << std::endl;
124 }
125 
128 
130 HolesFilterCreator::keyname() const { return "Holes"; }
131 
132 
133 } // filters
134 } // protocols