Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AbinitioBaseFilter.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 src/protocols/filters/Filters.hh
11 /// @brief header file for Filters.cc
12 /// @detailed
13 /// Contains currently: Filters
14 ///
15 ///
16 /// @author Robert Vernon
17 
18 // Unit Headers
19 
20 // Project Headers
22 
23 #include <core/pose/Pose.hh>
24 #include <core/pose/util.hh>
25 
26 // AUTO-REMOVED #include <basic/options/option.hh>
27 #include <basic/options/keys/OptionKeys.hh>
28 
29 
31 // AUTO-REMOVED #include <protocols/simple_filters/RGFilter.hh>
32 // AUTO-REMOVED #include <protocols/simple_filters/COFilter.hh>
33 // AUTO-REMOVED #include <protocols/simple_filters/SheetFilter.hh>
34 
35 
36 // ObjexxFCL Headers
37 // AUTO-REMOVED #include <ObjexxFCL/FArray1D.hh>
38 // AUTO-REMOVED #include <ObjexxFCL/FArray2D.hh>
39 #include <ObjexxFCL/format.hh>
40 
41 
42 // Utility headers
43 #include <basic/Tracer.hh>
44 
45 #include <utility/vector1.hh>
46 
47 //Auto Headers
49 
50 
51 //// C++ headers
52 
53 static basic::Tracer tr("protocols.simple_filters.AbinitioBaseFilter");
54 
55 using namespace ObjexxFCL;
56 using namespace ObjexxFCL::fmt;
57 
58 namespace protocols {
59 namespace simple_filters {
60 
61 AbinitioBaseFilter::AbinitioBaseFilter() {
62  using namespace basic::options;
63  using namespace basic::options::OptionKeys;
64  sstype_ = "";
65 }
66 
67 bool
68 AbinitioBaseFilter::apply( core::pose::Pose const & pose ) const {
69  if ( sstype_ == "" ) sstype_=get_protein_sstype( pose );
70  tr.Info << "apply filter: " << name() << std::endl;
71  return true;
72 }
73 
75 AbinitioBaseFilter::get_protein_sstype( core::pose::Pose const & pose ) const {
76  using core::Size;
77 
79 
80  if( secstructs.size() == 0 ) {
81  tr.Error << "Warning: Needs psipred_ss2 to run filters" << std::endl;
82  // disable_all_filters_ = true;
83  return "fail";
84  }
85 
86  // float beta_ratio;
87  int alpha = 0;
88  // int
89  beta_ = 0;
90  int helix_length = 0;
91  max_helix_length_ = 0;
92 
93  for ( Size i = 1; i <= pose.total_residue(); ++i ) {
94  if ( ! pose.residue(i).is_protein() ) continue;
95  if ( secstructs[i] == 'H' ) {
96  ++alpha;
97  ++helix_length;
98  if ( helix_length > max_helix_length_ ) {
99  max_helix_length_ = helix_length;
100  }
101  } else if ( secstructs[i] == 'E' ) {
102  ++beta_;
103  helix_length = 0;
104  } else {
105  helix_length = 0;
106  }
107  }
108  max_helix_fraction_ = static_cast< core::Real >( max_helix_length_ ) / pose.total_residue();
109 
110 //car protein_ss_type
111  std::string protein_sstype;
112  beta_ratio_ = static_cast< float >( beta_ ) / ( alpha + beta_ );
113  if ( beta_ratio_ >= 0.8 ) {
114  tr.Trace << "Protein type: all beta Fraction beta: " <<
115  F( 6, 3, beta_ratio_ ) << std::endl;
116  protein_sstype = 'b';
117  } else if ( beta_ratio_ > 0.2 && beta_ >= 10 ) {
118  tr.Trace << "Protein type: alpha/beta Fraction beta: " <<
119  F( 6, 3, beta_ratio_ ) << std::endl;
120  protein_sstype = "ab";
121  } else {
122  tr.Trace << "Protein type: all alpha Fraction beta: " <<
123  F( 6, 3, beta_ratio_ ) << "nbeta" << I( 6, beta_ ) << std::endl;
124  protein_sstype = 'a';
125  }
126 
127  return protein_sstype;
128 
129 }
130 
131 } // filters
132 } // protocols
133 
134