Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RNA_BaseDoubletClasses.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 // CVS information:
4 // $Revision: 1.1.2.1 $
5 // $Date: 2005/11/07 21:05:35 $
6 // $Author: rhiju $
7 // (c) Copyright Rosetta Commons Member Institutions.
8 // (c) This file is part of the Rosetta software suite and is made available under license.
9 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
11 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
12 
13 #ifndef INCLUDED_core_scoring_rna_RNA_BaseDoubletClasses_hh
14 #define INCLUDED_core_scoring_rna_RNA_BaseDoubletClasses_hh
15 
16 #include <core/types.hh>
18 
19 // C++ Headers
20 #include <iomanip>
21 #include <iostream>
22 #include <list>
23 
24 //using core::Size;
25 //using core::Real;
26 
27 namespace core {
28 namespace scoring {
29 namespace rna {
30 
31 /////////////////////////////////////////////////////////////////////
32 // Useful type definitions.
33 /////////////////////////////////////////////////////////////////////
34 
35 class Base_pair
36 {
37 
38  public:
39 
41  res1( 0 ),
42  res2( 0 ),
43  edge1( 0 ),
44  edge2( 0 ),
45  orientation( 0 ),
46  LW_orientation( 0 ), //Leontis Westhof base-pair orientation (1 = cis; 2 = trans). This is not yet implemented! (PS. 12/26/2011)
47  num_hbonds( 0 )
48  {
49  };
50 
51  Base_pair( Size const & res1_input, Size const res2_input,
52  Size const & edge1_input, Size const edge2_input,
53  Size const & orientation_input):
54  res1( res1_input ),
55  res2( res2_input ),
56  edge1( edge1_input ),
57  edge2( edge2_input ),
58  orientation( orientation_input ),
59  LW_orientation( 0 ),
60  num_hbonds( 0 )
61  {
62  };
63 
64  Size res1;
68  Size orientation; // 1 = antiparallel; 2 = parallel
69  Size LW_orientation; // 1 = cis; 2 = trans
71 
72 
73  void
74  print_info( std::ostream & out = std::cout ) const {
75  out << "res1= " << std::setw(4) << res1;
76  out << " res2= " << std::setw(4) << res2;
77  out << " edge1= " << std::setw(6) << get_full_edge_from_num(edge1);
78  out << " edge2= " << std::setw(6) << get_full_edge_from_num(edge2);
79  out << " LW_orient= " << std::setw(5) << get_full_LW_orientation_from_num( LW_orientation );
80  out << " orient= " << std::setw(5) << get_full_orientation_from_num( orientation );
81  out << " #hbonds= " << std::setw(4) << num_hbonds;
82  out << " ";
83  }
84 
85  friend
86  bool operator < (Base_pair const & lhs, Base_pair const & rhs )
87  {
88  //There must be a more elegant way to do this...
89  if( lhs.res1 < rhs.res1 ) {
90  return true;
91  } else if ( lhs.res1 == rhs.res1 ) {
92  if ( lhs.res2 < rhs.res2 ) {
93  return true;
94  } else if ( lhs.res2 == rhs.res2 ) {
95  if ( lhs.edge1 < rhs.edge1 ) {
96  return true;
97  } else if ( lhs.edge1 == rhs.edge1 ) {
98  if ( lhs.edge2 < rhs.edge2 ) {
99  return true;
100  } else if ( lhs.edge2 == rhs.edge2) {
101  return ( lhs.orientation < rhs.orientation);
102  }
103  }
104  }
105  }
106  return false;
107  };
108 
109  friend
110  bool operator == (Base_pair const & lhs, Base_pair const & rhs )
111  {
112  return (lhs.res1 == rhs.res1 &&
113  lhs.res2 == rhs.res2 &&
114  lhs.edge1 == rhs.edge1 &&
115  lhs.edge2 == rhs.edge2 &&
116  lhs.orientation == rhs.orientation );
117  };
118 
119 
120  friend
121  std::ostream &
122  operator <<( std::ostream & out, Base_pair const & s ){
123  out << s.res1 << " " << s.res2 << " " << s.edge1 << " " << s.edge2 << " " << s.orientation;
124  return out;
125  }
126 };
127 
128 typedef std::pair<Real, Base_pair> Energy_base_pair;
129 typedef std::list<Energy_base_pair> Energy_base_pair_list;
130 
132  public:
133 
135  res1( 0 ),
136  res2( 0 ),
137  orientation( 0 ),
138  which_side( 0 )
139  {
140  };
141 
142 
143  Size res1;
145  Size orientation; // 1 = antiparallel; 2 = parallel
146  Size which_side; // 1 = residue 2 is 3' to residue1; 2 = residue 2 is 5' to residue 1
147 
148  friend
149  bool operator < (Base_stack const & lhs, Base_stack const & rhs ){
150  //There must be a more elegant way to do this...
151  if( lhs.res1 < rhs.res1 ) {
152  return true;
153  } else if ( lhs.res1 == rhs.res1 ) {
154  if ( lhs.res2 < rhs.res2 ) {
155  return true;
156  } else if ( lhs.res2 == rhs.res2 ) {
157  if ( lhs.orientation < rhs.orientation ) {
158  return true;
159  } else if ( lhs.orientation == rhs.orientation ) {
160  return ( lhs.which_side < rhs.which_side);
161  }
162  }
163  }
164  return false;
165  }
166 
167 
168  friend
169  std::ostream &
170  operator <<( std::ostream & out, Base_stack const & s )
171  {
172  out << s.res1 << " " << s.res2 << " " << s.orientation << " " << s.which_side;
173  return out;
174  }
175 
176 
177 };
178 
179 typedef std::pair<Real, Base_stack> Energy_base_stack;
180 typedef std::list<Energy_base_stack> Energy_base_stack_list;
181 
182 } //rna
183 } //scoring
184 } //core
185 
186 #endif