Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StrandPairing.hh
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 // @brief
10 // @author olange: ported from original bblum-rosetta++ version $
11 
12 
13 #ifndef INCLUDED_core_scoring_dssp_StrandPairing_HH
14 #define INCLUDED_core_scoring_dssp_StrandPairing_HH
15 
16 // Unit Headers
19 
20 // Project Headers
21 #include <core/types.hh>
22 #include <core/pose/Pose.fwd.hh>
23 
24 
25 // Utility headers
26 #include <utility/pointer/ReferenceCount.hh>
27 #include <utility/pointer/owning_ptr.hh>
28 
29 // ObjexxFCL Headers
30 #include <ObjexxFCL/FArray2.fwd.hh>
31 
32 // C++ headers
33 #include <string>
34 
35 #include <utility/exit.hh>
36 #include <utility/vector1.hh>
37 
38 
39 namespace core {
40 namespace scoring {
41 namespace dssp {
42 
43 //////////////////////////////////////////////////////////////////
44 // StrandPairing
45 // This class encapsulates a pairing between two beta strands.
46 // It is designed to be initialized with a single residue-residue
47 // pairing and then extended, residue by residue, along the
48 // strands. It MUST be extended sequentially along the length
49 // of the strands. It can accomodate beta bulges of length at
50 // most 1 on one strand and 4 on the other (inspired by dssp
51 // guidelines).
52 //////////////////////////////////////////////////////////////////
55 public:
56  StrandPairing();
57  StrandPairing(core::Size res1, core::Size res2, bool antiparallel, core::Size pleating);
59 
60  core::Size operator==(const StrandPairing &rhs) const;
61  // core::Size operator!=(const StrandPairing &rhs) const;
62  core::Size operator<(const StrandPairing &rhs) const;
63 
64  core::Size size() const {
65  return end1_ - begin1_ + 1;
66  }
67 
68  core::Size begin1() const {
69  return begin1_;
70  }
71 
72  core::Size end1() const {
73  return end1_;
74  }
75 
76  bool range_check() const;
77 
78  core::Size contact_order() const;
79 
80  core::Size get_register() const;
81  void get_all_register_and_bulges( SizeList& regs, SizeList& bulges ) const;
82  std::size_t hash_value() const;
83  bool contains(core::Size res) const;
84  bool is_bulge(core::Size res) const;
85  bool is_ladder() const;
86  core::Size get_pair(core::Size res)const ;
87  bool check_pleat() const;
89  bool extend(core::Size res, core::Size res2, bool antiparallel, core::Size pleating);
90  void extend_to(core::Size res);
91  bool antiparallel() const;
92  bool has_pairing( core::scoring::dssp::Pairing const& ) const;
93  bool has_common_pairing( StrandPairing const& other ) const;
94  bool paired( core::Size res1, core::Size res2, bool anti ) const;
96  bool merge( StrandPairing const& other, bool domerge = false);
97  bool mergeable( StrandPairing const& other ) const;
98  void show_internals( std::ostream& out ) const;
99  bool valid_ends() const;
100  friend std::ostream & operator<<(std::ostream & out, StrandPairing const & sp);
101  friend std::istream & operator>>( std::istream &in, StrandPairing &sp );
104 
105 private:
106  //@brief first pairing of antipar. strand is begin1_ --> end2_
107  // last pairing of antipar. strand is end1_ --> begin2_
108  // hence strand1 goes from begin1-->end1 and strand2 goes from begin2-->end2
110 
111  // vector listing which residues are paired to the residues
112  // in strand 1. 0 indicates beta bulge (unpaired).
113  // one entry for pos begin1_...end1_
114  std::vector<core::Size> pairing1;
115  std::vector<core::Size> pleating1;
116  // similar to pairing1 but for strand 2.
117  std::vector<core::Size> pairing2;
119  bool antipar;
120 };
121 
122 std::ostream & operator<<(std::ostream & out, StrandPairing const& sp);
123 //////////////////////////////////////////////////////////////////
124 // StrandPairingSet
125 // This class maintains a set of strand pairings and provides
126 // access functions to determine whether a particular residue
127 // participates in any of them, and in what capacity.
128 //
129 //////////////////////////////////////////////////////////////////
132  typedef StrandPairings::iterator iterator;
133 public:
134  typedef StrandPairings::const_iterator const_iterator;
135 
137  StrandPairingSet( ObjexxFCL::FArray2_float const& hbonds, float threshold, core::pose::Pose const& );
138  StrandPairingSet( core::pose::Pose const&, core::Real threshold = -0.5 );
140  virtual ~StrandPairingSet();
141 
142  //void add_decoy( core::Size dec );
143  bool check_pleat() const;
144  char dssp_state( core::Size res ) const;
145  char featurizer_state( core::Size res ) const;
146  bool paired( core::Size res1, core::Size res2, bool antiparallel ) const;
147  bool has_pairing( core::scoring::dssp::Pairing const& ) const;
148  bool has_pairing( StrandPairing const& ) const;
150  bool merge( const StrandPairingSet &other, bool domerge = false );
151 
152  friend std::ostream & operator<<(std::ostream & out, const StrandPairingSet &sp);
153  friend std::istream & operator>>(std::istream & is, StrandPairingSet &sp);
154 
155  const_iterator begin() const { return pairings_.begin(); }
156  const_iterator end() const { return pairings_.end(); }
157  Size size() const { return pairings_.size(); }
158 
159  StrandPairing const& strand_pairing( Size i ) const {
160  runtime_assert( i <= pairings_.size() );
161  return pairings_[ i ];
162  }
163 
164  void push_back( StrandPairing const& sp ) {
165  pairings_.push_back( sp );
166  }
167 private:
168  void add_pairing( core::Size res1, core::Size res2, bool antiparallel, core::Size pleating );
169  void add_pairing( core::scoring::dssp::Pairing const& pairing );
170  void selfmerge();
171  void compute( ObjexxFCL::FArray2_float const& hbonds, float threshold, core::pose::Pose const& );
172 
174 };
175 
176 std::ostream & operator<<(std::ostream & out, const StrandPairingSet &sp);
177 
178 }
179 }
180 }
181 
182 #endif