Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RBSegment.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
11 /// @brief
12 /// @author Frank DiMaio
13 /// @author Srivatsan Raman
14 
15 #ifndef INCLUDED_protocols_rbsegment_relax_RBSegment_hh
16 #define INCLUDED_protocols_rbsegment_relax_RBSegment_hh
18 
19 #include <core/types.hh>
22 #include <iostream>
23 
24 #ifdef WIN32
25  #include <functional>
26 #endif
27 
28 
29 namespace protocols {
30 namespace rbsegment_relax {
31 
32 //////////////////////////////////////////////////////////
33 ///@brief Enumeration of RB types
34 /////////////////////////////////////////////////////////
36 
37 
38 //////////////////////////////////////////////////////////
39 ///@brief RB residue range
40 /////////////////////////////////////////////////////////
42 public:
44 
45  RBResidueRange( int begin, int end , RBSegmentType type ) :
46  res_first( begin ),
47  res_last( end ),
48  seg_type( type )
49  {}
50 
51  inline core::Size length() const { return res_last - res_first + 1; }
52  inline core::Size start() const { return res_first; }
53  inline void set_start(core::Size S) { res_first = S; }
54  inline core::Size end() const { return res_last; }
55  inline void set_end(core::Size E) { res_last = E; }
56  inline RBSegmentType type() const { return (seg_type); }
57  inline char char_type() const { return( seg_type==RB_HELIX ? 'H' : (seg_type==RB_SHEET ? 'E' : '-') ); }
58 
59 private:
62 };
63 
64 
65 //////////////////////////////////////////////////////////
66 ///@brief Rigid-body segments in a protein
67 /////////////////////////////////////////////////////////
68 class RBSegment {
69 public:
72  }
73 
74  /// construct a simple RB Segment
75  RBSegment( int seg_begin, int seg_end, RBSegmentType seg_type ) {
76  segments_.push_back( RBResidueRange( seg_begin, seg_end, seg_type ) );
78  }
79 
80  /// construct a simple RBSegment from an RB residue range
81  RBSegment ( RBResidueRange const &range_in ) {
82  segments_.push_back( range_in );
84  }
85 
86  /// construct a simple RB Segment
87  RBSegment( int seg_begin, int seg_end, char type ) {
88  RBSegmentType seg_type;
89  if (type == 'H')
90  seg_type = RB_HELIX;
91  else if (type == 'E' || type == 'S')
92  seg_type = RB_SHEET;
93  else
94  seg_type = RB_DEFAULT;
95  segments_.push_back( RBResidueRange( seg_begin, seg_end, seg_type ) );
97  }
98 
99  /// construct a compound RBSegment from a vector of simple RBSegments
100  RBSegment ( utility::vector1 < RBSegment > const &segs_in );
101 
102  void set_movement( core::Real sigAxisR, core::Real sigAxisT, core::Real sigOffAxisR=0.0, core::Real sigOffAxisT=0.0);
103  void get_movement( core::Real &sigAxisR, core::Real &sigAxisT, core::Real &sigOffAxisR, core::Real &sigOffAxisT) const;
104 
105  // create a new RBsegment from this one by remapping residue ids
106  RBSegment remap( core::id::SequenceMapping const &mapping ) const;
107 
108  inline core::Size nContinuousSegments() const { return segments_.size(); }
109 
110  inline bool isEmpty() const { return ( nContinuousSegments()==0 ); }
111  inline bool isSimple() const { return ( nContinuousSegments()==1 ); }
112  inline bool isHelix() const { return ( isSimple() && segments_[1].type()==RB_HELIX ); }
113  inline bool isSheet() const { return ( isSimple() && segments_[1].type()==RB_SHEET ); }
114  inline bool isGenericRB() const { return ( isSimple() && segments_[1].type()==RB_DEFAULT ); }
115  inline bool isCompound() const { return ( nContinuousSegments()>1 ); }
116  inline bool initialized() const { return (sigAxisR_==0&&sigAxisT_==0&&sigOffAxisR_==0&&sigOffAxisT_==0); }
117 
118  // accessor
119  inline core::Real getSigAxisR() const { return ( sigAxisR_ ); }
120  inline core::Real getSigAxisT() const { return ( sigAxisT_ ); }
121  inline core::Real getSigOffAxisR() const { return ( sigOffAxisR_ ); }
122  inline core::Real getSigOffAxisT() const { return ( sigOffAxisT_ ); }
123 
124  RBResidueRange & operator[](int i) { return segments_[i]; }
125  RBResidueRange const & operator[](int i) const { return segments_[i]; }
126 
127 private:
129 
130  // rotational params
132 };
133 
134 /////////////
135 // used to sort RB structs by start-res
136 /////////////
137 class RB_lt : public std::binary_function<double, double, bool> {
138 public:
140  if (x.isEmpty()) return true;
141  else if (y.isEmpty()) return false;
142  else return (x[1].start() < y[1].start());
143  }
144 };
145 
146 //////////////////////////////////////////////////////////
147 ///@brief Parses an RB segment file into a vector of RBsegments
148 /////////////////////////////////////////////////////////
153  bool autoGenerateLoops=false,
154  int nres=0, // only needed if autoGenerateLoops==true
155  utility::vector1< core::Size > cutpts=utility::vector1< core::Size >(0) // only needed if autoGenerateLoops==true
156 );
157 
158 void select_RBsegments(
159  utility::vector1< RBSegment > const &rbsegs_in,
160  protocols::loops::Loops const &loops_in,
161  utility::vector1< RBSegment > &rbsegs_selected,
162  protocols::loops::Loops &loops_selected
163 );
164 
165 
166 
167 }
168 }
169 
170 #endif