Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PairingsList.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 
10 /// @file src/core/scoring/dssp/PairingTemplate
11 /// @brief header file for ClassicAbinitio protocol
12 /// @detailed
13 /// from converting jumping_pairings.cc of rosetta++ into mini
14 ///
15 /// @author Oliver Lange
16 /// @author Christopher Miles (cmiles@uw.edu)
17 
18 #ifndef INCLUDED_core_scoring_dssp_PairingsList_hh
19 #define INCLUDED_core_scoring_dssp_PairingsList_hh
20 
21 // Unit Headers
23 
24 // Project Headers
25 #include <core/types.hh>
26 
27 // Utility headers
28 // we need it because of declarations in fwd.hh
29 #include <utility/vector1.hh>
30 #include <utility/exit.hh>
31 
32 // ObjexxFCL Headers
33 #include <ObjexxFCL/FArray1A.fwd.hh>
34 
35 //// C++ headers
36 // AUTO-REMOVED #include <cstdlib> //required by GCC 4.3.2
37 #include <string>
38 
39 namespace core {
40 namespace scoring {
41 namespace dssp {
42 
43 using core::Size;
44 
45 class Pairing {
46  public:
47  Pairing() :
48  pos1_( 0 ),
49  pos2_( 0 ),
50  orientation_( 0 ),
51  pleating_( 0 )
52  {}
53 
54  Pairing( core::Size pos1_in, core::Size pos2_in ) :
55  pos1_( pos1_in),
56  pos2_( pos2_in),
57  orientation_( 0 ),
58  pleating_( 0 )
59  {}
60 
61  //c'stor to translate from old-style version of pairing
62  Pairing( ObjexxFCL::FArray1A_int );
63 
64  Pairing( core::Size pos1_in, core::Size pos2_in, core::Size ori_in, core::Size pleat_in ) :
65  pos1_( pos1_in),
66  pos2_( pos2_in),
67  orientation_( ori_in),
68  pleating_( pleat_in )
69  {}
70 
71  Size Pos1() const {
72  return pos1_;
73  }
74 
75  void Pos1(Size pos1) {
76  pos1_ = pos1;
77  }
78 
79  Size Pos2() const {
80  return pos2_;
81  }
82 
83  void Pos2(Size pos2) {
84  pos2_ = pos2;
85  }
86 
87  Size Orientation() const {
88  return orientation_;
89  }
90 
91  void Orientation(Size orientation) {
92  orientation_ = orientation;
93  }
94 
95  Size Pleating() const {
96  return pleating_;
97  }
98 
99  void Pleating(Size pleating) {
100  pleating_ = pleating;
101  }
102 
103  ///@brief constant values that define orientation
104  static core::Size const ANTI = 1;
105  static core::Size const PARALLEL = 2;
106  static core::Size const OUTWARDS = 1;
107  static core::Size const INWARDS = 2;
108 
109  ///@brief reverses the Pairing
110  Pairing reverse();
111 
112  ///@brief returns a new reversed pairing
113  Pairing generate_reversed() const;
114 
115  ///
116  bool is_parallel() const {
117  runtime_assert( orientation_ );
118  return orientation_ == PARALLEL;
119  }
120 
121  ///
122  bool is_anti() const {
123  runtime_assert( orientation_ );
124  return orientation_ == ANTI;
125  }
126 
127  bool is_inwards() const {
128  runtime_assert( pleating_ );
129  return pleating_ == INWARDS;
130  }
131 
132  bool is_outwards() const {
133  runtime_assert( pleating_ );
134  return pleating_ == OUTWARDS;
135  }
136 
137  bool operator ==( Pairing const& p ) const {
138  return ( (p.Pos1() == Pos1())
139  && ( p.Pos2() == Pos2() )
140  && ( p.Orientation() == Orientation() )
141  && ( p.Pleating() == Pleating() )
142  );
143  }
144 
146  return is_anti() ? Pos1() + Pos2() : std::abs( (int) Pos1() - (int) Pos2() );
147  }
148 
149  bool operator < ( Pairing const& p ) const {
150  return p.Pos1() != Pos1() ? Pos1() < p.Pos1() :
151  ( p.Pos2() != Pos2() ? Pos2() < p.Pos2() :
152  ( p.Orientation() != Orientation() ? Orientation() < p.Orientation() : Pleating() < p.Pleating() ) );
153  }
154 
155  private:
160 };
161 
162 ///@brief list of pairings
163 extern std::ostream& operator<< ( std::ostream& out, Pairing const& );
164 extern std::ostream& operator<< ( std::ostream& out, PairingsList const& p);
165 
166 ///@brief add pairings in pairing_file to list "pairings"
167 extern void read_pairing_list( std::string pairing_file, PairingsList& pairings);
168 extern void read_pairing_list( std::istream &is, PairingsList& pairings);
169 
170 extern bool has_orientation_and_pleating( PairingsList const& );
171 
172 } // dssp
173 } // scoring
174 } // core
175 
176 #endif