Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SheetTopologyFilter.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/SheetTopologyFilter.cc
11 /// @brief filter structures by sheet topology
12 /// @detailed
13 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
14 
15 // Unit Headers
18 
19 // Package Headers
23 // AUTO-REMOVED #include <protocols/fldsgn/topology/HSSTriplet.hh> // REQUIRED FOR WINDOWS
24 
25 // Project Headers
26 #include <core/types.hh>
27 #include <core/pose/Pose.hh>
31 
32 // Utility headers
33 #include <basic/Tracer.hh>
34 
35 // Parser headers
36 // AUTO-REMOVED #include <protocols/moves/DataMap.hh>
37 // AUTO-REMOVED #include <protocols/moves/Mover.hh>
39 #include <utility/tag/Tag.hh>
40 
41 #include <utility/vector0.hh>
42 #include <utility/vector1.hh>
43 
44 
45 //// C++ headers
46 static basic::Tracer tr("protocols.fldsgn.filters.SheetTopologyFilter");
47 
48 namespace protocols {
49 namespace fldsgn {
50 namespace filters {
51 
52 // @brief default constructor
54  Filter( "SheetTopology" ),
55  secstruct_input_( false ),
56  ssinfo_( new SS_Info2 )
57 {}
58 
59 // @brief constructor with arguments
61  Filter( "SheetTopology" ),
62  secstruct_input_( false ),
63  ssinfo_( new SS_Info2 )
64 {
65  filtered_sheet_topology_ = (*sps).name();
66 }
67 
68 // @brief constructor with arguments
70  Filter( "SheetTopology" ),
71  filtered_sheet_topology_( sheet_topology ),
72  secstruct_input_( false ),
73  ssinfo_( new SS_Info2 )
74 {}
75 
76 // @brief copy constructor
78  //utility::pointer::ReferenceCount(),
79  Super( rval ),
80  filtered_sheet_topology_( rval.filtered_sheet_topology_ ),
81  secstruct_input_( rval.secstruct_input_ ),
82  ssinfo_( rval.ssinfo_ )
83 {}
84 
85 // @brief set filtered sheet_topology by SrandPairingSetOP
87 {
88  filtered_sheet_topology_ = (*sps).name();
89 }
90 
91 
92 // @brief set filtered sheet_topology by SrandPairingSetOP
94 {
95  filtered_sheet_topology_ = sheet_topology;
96 }
97 
98 // @brief returns true if the given pose passes the filter, false otherwise.
99 // In this case, the test is whether the give pose is the topology we want.
100 bool SheetTopologyFilter::apply( Pose const & pose ) const
101 {
104 
105  if( ! secstruct_input_ ) {
106  Dssp dssp( pose );
107  ssinfo_->initialize( pose, dssp.get_dssp_secstruct() );
108  }
109 
110  if( ! ssinfo_->strands().size() > 0 ){
111  tr << "Structure does not include strands." << std::endl;
112  return false;
113  }
114  //tr << "ss of input pose=" << pose.secstruct() << std::endl;
115  //tr << spairset_filter.name() << std::endl;
116 
118  StrandPairingSet spairset_filter( filtered_sheet_topology_ );
119 
120  for( Size ii=1; ii<=spairset_filter.size(); ++ii ) {
121 
122  bool flag( false );
123  for( Size jj=1; jj<=spairset.size(); jj++ ) {
124  if( spairset.strand_pairing( jj )->s1() == spairset_filter.strand_pairing( ii )->s1() &&
125  spairset.strand_pairing( jj )->s2() == spairset_filter.strand_pairing( ii )->s2() ) {
126  if( spairset.strand_pairing( jj )->orient() == spairset_filter.strand_pairing( ii )->orient() ) {
127  if( spairset_filter.strand_pairing( ii )->rgstr_shift() != 99 ) {
128  if( spairset.strand_pairing( jj )->rgstr_shift() == spairset_filter.strand_pairing( ii )->rgstr_shift() ) {
129  flag = true;
130  break;
131  }
132  } else {
133  flag = true;
134  break;
135  } // register shift ?
136  } else {
137  break;
138  } // orient ?
139  } // spairset
140  } // jj
141 
142  if( !flag ) {
143  tr << "Filtering failed: current/filtered sheet topology, " << spairset.name() << '/' << filtered_sheet_topology_ << '.' << std::endl;
144  return false;
145  }
146  } // ii
147 
148 
149  tr << "Successfully " << spairset.name() << " sheet topology was filtered. " << std::endl;
150  return true;
151 
152 } // apply_filter
153 
154 /// @brief parse xml
155 void
157  TagPtr const tag,
158  DataMap &,
159  Filters_map const &,
160  Movers_map const &,
161  Pose const & )
162 {
163  filtered_sheet_topology_ = tag->getOption<String>( "topology", "" );
164  if( filtered_sheet_topology_ == "" ) {
165  tr.Error << "Error!, option of topology is empty." << std::endl;
166  runtime_assert( false );
167  }
168 
169  // Blueprint is for giving secondary structure information, otherwise dssp will run for ss definition
170  // SSPAIR line is read for the topology of strand pairings
171  String const blueprint = tag->getOption<String>( "blueprint", "" );
172  if( blueprint != "" ) {
173  protocols::jd2::parser::BluePrint blue( blueprint );
174  ssinfo_->initialize( blue.secstruct() );
175  secstruct_input_ = true;
176 
177  if( ! blue.strand_pairings().empty() ) {
178  if( filtered_sheet_topology_ == "" ) {
179  StrandPairingSet spairset( blue.strand_pairings() );
180  filtered_sheet_topology_ = spairset.name();
181  } else {
182  tr << " SSPAIR line in blueprint will be igonared " << std::endl;
183  }
184  }
185  } //
186 
187  tr << filtered_sheet_topology_ << " is filtred " << std::endl;
188 }
189 
192 
194 SheetTopologyFilterCreator::keyname() const { return "SheetTopology"; }
195 
196 
197 } // filters
198 } // fldsgn
199 } // protocols