Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PackStatFilter.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/PackStatFilter.cc
11 /// @brief filter structures by packstat score
12 /// @detailed
13 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
14 
15 // Unit Headers
18 
19 // Project Headers
20 #include <core/types.hh>
21 // AUTO-REMOVED #include <core/pose/Pose.hh>
24 #include <core/pose/util.hh>
25 
26 // Utility headers
27 #include <basic/Tracer.hh>
28 
29 // Parser headers
31 #include <utility/tag/Tag.hh>
32 
33 #include <utility/vector0.hh>
34 #include <utility/vector1.hh>
35 
36 
37 //// C++ headers
38 static basic::Tracer tr("protocols.filters.PackStatFilter");
39 
40 namespace protocols {
41 namespace simple_filters {
42 
43 // @brief default constructor
45  Filter( "PackStat" ),
46  chain_( 0 ),
47  repeats_( 1 ),
48  filtered_score_( 0.58 ) // ideally, ~0.65 is required for good packing
49 {}
50 
51 //PackStatFilter::~PackStatFilter(){}
52 
53 // @brief constructor with arguments
55  Filter( "PackStat" ),
56  chain_(0),
57  repeats_(1),
58  filtered_score_( score )
59 {}
60 
61 // @brief copy constructor
63  //utility::pointer::ReferenceCount(),
64  Super( rval ),
65  chain_(rval.chain_),
66  repeats_(rval.repeats_),
67  filtered_score_( rval.filtered_score_ )
68 {}
69 
70 // @brief set filtered secondary structure
71 void PackStatFilter::filtered_score( Real const & score )
72 {
74 }
75 
76 /// @brief
78 PackStatFilter::compute( Pose const & pose ) const
79 {
80  // calc packstat
81  core::Real packscore;
82 
83  // repeats to average
84  core::Real packscore_average( 0.0 );
85 
86  for( core::Size i = 1; i<=repeats_; i++ ){
87  if( chain_ < 1 )
89  else{
90  core::pose::Pose single_chain( pose.split_by_chain( chain_ ) );
91  packscore = core::scoring::packstat::compute_packing_score( single_chain );
92  }
93  packscore_average += packscore;
94  tr << "repeat " << i << ": packscore: " << packscore << std::endl;
95  }
96 
97  return packscore_average / (core::Real)repeats_;
98 }
99 
100 /// @brief
102 PackStatFilter::report_sm( Pose const & pose ) const
103 {
104  return compute( pose );
105 }
106 
107 // @brief returns true if the given pose passes the filter, false otherwise.
108 // In this case, the test is whether the give pose is the topology we want.
109 bool PackStatFilter::apply( Pose const & pose ) const
110 {
111  Real score = compute( pose );
112  if( score > filtered_score_ ){
113  tr << "Successfully filtered: " << score << std::endl;
114  return true;
115  }else{
116  tr << "Filter failed current/threshold=" << score << "/" << filtered_score_ << std::endl;
117  return false;
118  }
119 } // apply_filter
120 
121 /// @brief parse xml
122 void
124  TagPtr const tag,
125  DataMap &,
126  filters::Filters_map const &,
127  Movers_map const &,
128  Pose const & )
129 {
130  filtered_score_ = tag->getOption<Real>( "threshold", 0.58 ); // ideally, ~0.65 is required for good packing
131  tr << "Structures with packstat score " << filtered_score_ << " will be filtred." << std::endl;
132  chain_ = tag->getOption<core::Size>( "chain", 0 );
133  repeats_ = tag->getOption<core::Size>( "repeats", 1 );
134 }
135 
138 
140 PackStatFilterCreator::keyname() const { return "PackStat"; }
141 
142 
143 } // filters
144 } // protocols