Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BBTorsionSRFD.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file core/fragments/BBTorsionSRFD.hh
12 /// @brief A fragment as list of SingleResidue Data
13 /// @author Oliver Lange (olange@u.washington.edu)
14 
15 #ifndef INCLUDED_core_fragment_BBTorsionSRFD_HH
16 #define INCLUDED_core_fragment_BBTorsionSRFD_HH
17 
18 // Unit Headers
21 
22 // Package Headers
24 
25 // Project Headers
26 #include <core/pose/Pose.fwd.hh>
28 #include <core/types.hh>
29 
30 // Utility headers
31 #include <utility/exit.hh>
32 #include <utility/vector1_bool.hh>
33 #include <utility/pointer/ReferenceCount.hh>
34 
35 // C/C++ headers
36 #include <iostream>
37 
38 #include <utility/vector1.hh>
39 
40 
41 namespace core {
42 namespace fragment {
43 
44 class BBTorsionSRFD : public SecstructSRFD {
46 
47 public:
48  /// @brief constructor
49  BBTorsionSRFD( Size const nbb_in = 3, char secstruct = 'X', char sequence = 'X')
50  : SecstructSRFD(secstruct, sequence), torsions_(nbb_in), coords_(3), has_coords_(false) {}
51 
52  /// @brief copy assignment
53  BBTorsionSRFD & operator =( BBTorsionSRFD const & rval );
54 
55  /// @brief clone this object
56  virtual SingleResidueFragDataOP clone() const {
57  return new BBTorsionSRFD( *this );
58  }
59 
60  /// @brief create a new instance of this object
61  virtual SingleResidueFragDataOP create() const {
62  return new BBTorsionSRFD();
63  }
64 
65  /// @brief number of backbone torsions described by this fragment
66  inline Size nbb() const {
67  return torsions_.size();
68  }
69 
70  /// @brief set value for specific torsion in this piece of fragment.
71  void set_torsion( Size const tor, Real const setting ) {
72  torsions_[tor] = setting;
73  }
74 
75  /// @brief get the value for a specific torsion in this fragment
76  inline Real torsion( Size const torsion_number ) const {
77  return torsions_[ torsion_number ];
78  }
79 
80  /// @brief Returns true if this instance contains cartesian coordinates,
81  /// false otherwise. Coordinates are available if the <write_ca_coords>
82  /// option is enabled in the new fragment picker and rosetta++ fragments
83  /// are used.
84  bool has_coordinates() const {
85  return has_coords_;
86  }
87 
88  /// @brief Returns the x coordinate of this residue's CA
89  Real x() const {
90  if (!has_coords_)
91  utility_exit_with_message("Cartesian coordinates uninitialized!");
92 
93  return coords_[1];
94  }
95 
96  /// @brief Returns the y coordinate of this residue's CA
97  Real y() const {
98  if (!has_coords_)
99  utility_exit_with_message("Cartesian coordinates uninitialized!");
100 
101  return coords_[2];
102  }
103 
104  /// @brief Returns the z coordinate of this residue's CA
105  Real z() const {
106  if (!has_coords_)
107  utility_exit_with_message("Cartesian coordinates uninitialized!");
108 
109  return coords_[3];
110  }
111 
112  /// @brief Convenience method for setting this residue's
113  /// CA coordinates all at once
115  coords_[1] = x;
116  coords_[2] = y;
117  coords_[3] = z;
118  has_coords_ = true;
119  }
120 
121  /// @brief insert all backbone torsions into pose at position seq_pos
122  virtual bool apply( pose::Pose&, Size seq_pos ) const;
123 
124  /// @brief insert all backbone torsions into pose at position seq_pos
125  /// @param[in] movemap This MoveMap will be *ignored* at the BBTorsionSRFD level,
126  /// but will be passed to any superclass <tt>apply()</tt>.
127  /// @param[in,out] pose The pose to modify.
128  /// @param[in] seqpos Sequence position to modify.
129  /// @return True if <tt>apply()</tt> successful, False otherwise.
130  /// @warning MoveMap settings at the BBTorsionSRFD level are *ignored*.
131  /// For speed, does not check to see whether or not all backbone torsions
132  /// are moveable in MoveMap -- use <tt>is_applicable()</tt> for this
133  /// purpose prior to calling <tt>apply()</tt>.
134  virtual bool apply( kinematics::MoveMap const & movemap, pose::Pose & pose, Size const seqpos ) const;
135 
136  virtual bool steal( pose::Pose const&, Size seq_pos );
137  virtual bool is_compatible( SingleResidueFragData const& ) const;
138 
139  /// @brief check if all backbone torsions at the sequence position moveable
140  /// in the MoveMap
141  /// @return True if all backbone torsions moveable and <tt>is_applicable()</tt>
142  /// succeeded for superclass, otherwise False.
143  virtual bool is_applicable( kinematics::MoveMap const&, Size seq_pos ) const;
144 
145  virtual void show( std::ostream &out ) const;
146 
147  virtual void read_data( std::istream &in );
148 
149  virtual std::string type() const {
150  return _static_type_name();
151  }
152 
154  return "BBTorsion";
155  }
156 
157 private:
159 
160  /// @brief Cartesian coordinates for CA
162 
163  /// @brief Indicates whether this object contains cartesian coordinates
165 };
166 
167 } //fragment
168 } //core
169 
170 #endif