Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CarbohydrateInfo.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 CarbohydrateInfo.hh
11 /// @brief Declarations and simple accessor/mutator definitions for CarbohydrateInfo.
12 /// @author labonte
13 
14 #ifndef INCLUDED_core_chemical_carbohydrates_CarbohydrateInfo_HH
15 #define INCLUDED_core_chemical_carbohydrates_CarbohydrateInfo_HH
16 
17 // Unit header
19 
20 // Package headers
22 
23 // Project headers
24 #include <core/types.hh>
25 #include <core/id/types.hh>
26 
27 // Utility headers
28 #include <utility/pointer/ReferenceCount.hh>
29 #include <utility/vector1.hh>
30 
31 // C++ headers
32 #include <map>
33 #include <string>
34 #include <iostream>
35 
36 
37 namespace core {
38 namespace chemical {
39 namespace carbohydrates {
40 
42 public:
43  // Standard methods ////////////////////////////////////////////////////////
44  /// @brief Empty constructor
46 
47  /// @brief Standard constructor
49 
50  /// @brief Copy constructor
51  CarbohydrateInfo(CarbohydrateInfo const & object_to_copy);
52 
53  // Assignment operator
54  CarbohydrateInfo & operator=(CarbohydrateInfo const & object_to_copy);
55 
56  // Destructor
58 
59 
60  // Standard Rosetta methods ////////////////////////////////////////////////
61  /// @brief Generate string representation of CarbohydrateInfo for debugging purposes.
62  void show(std::ostream & output=std::cout) const;
63 
64  // Insertion operator (overloaded so that CarbohydrateInfo can be "printed" in PyRosetta).
65  friend std::ostream & operator<<(std::ostream & output, CarbohydrateInfo const & object_to_output);
66 
67 
68  // Accessors/Mutators
69  // Nomenclature
70  /// @brief Return the full IUPAC name of the monosaccharide.
72  full_name() const
73  {
74  return full_name_;
75  }
76 
77  /// @brief Return the abbreviated IUPAC name of the monosaccharide (for use in polysaccharide sequences).
79  short_name() const
80  {
81  return short_name_;
82  }
83 
84  /// @brief Return the standard/common, non-residue, short name of the monosaccharide.
85  std::string base_name() const;
86 
87  // Oxidation type
88  /// @brief Return true if the monosaccharide is an aldose.
89  /// @details An aldose sugar is an aldehyde derivative.
90  bool
91  is_aldose() const
92  {
93  if (anomeric_carbon_ == 1) {
94  return true;
95  }
96  return false;
97  }
98 
99  /// @brief Return true if the monosaccharide is a ketose.
100  /// @details A ketose sugar is a ketone derivative.\n
101  /// Does not distinguish between 2-ketoses (uloses) and 3-ketoses.\n
102  /// \n
103  /// See also:\n
104  /// CarbohydrateInfo.anomeric_carbon()
105  bool
106  is_ketose() const
107  {
108  if (anomeric_carbon_ != 1) {
109  return true;
110  }
111  return false;
112  }
113 
114  /// @brief Return the anomeric carbon number.
115  /// @details For linear monosaccharides, this number corresponds to the carbon that is oxidized to the aldehyde
116  /// or ketone.
117  core::uint
119  {
120  return anomeric_carbon_;
121  }
122 
123 
124  // Size
125  /// @brief Get the number of carbons in the monosaccharide.
126  core::Size
127  n_carbons() const
128  {
129  return n_carbons_;
130  }
131 
132  /// @brief Return true if the monosaccharide is a triose.
133  bool
134  is_triose() const
135  {
136  if (n_carbons_ == 3) {
137  return true;
138  }
139  return false;
140  }
141 
142  /// @brief Return true if the monosaccharide is a tetrose.
143  bool
144  is_tetrose() const
145  {
146  if (n_carbons_ == 4) {
147  return true;
148  }
149  return false;
150  }
151 
152  /// @brief Return true if the monosaccharide is a pentose.
153  bool
154  is_pentose() const
155  {
156  if (n_carbons_ == 5) {
157  return true;
158  }
159  return false;
160  }
161 
162  /// @brief Return true if the monosaccharide is a hexose.
163  bool
164  is_hexose() const
165  {
166  if (n_carbons_ == 6) {
167  return true;
168  }
169  return false;
170  }
171 
172  /// @brief Return true if the monosaccharide is a heptose.
173  bool
174  is_heptose() const
175  {
176  if (n_carbons_ == 7) {
177  return true;
178  }
179  return false;
180  }
181 
182 
183  // Stereochemistry
184  /// @brief Get the stereochemical designation for the monosaccharide.
185  /// @return 'L' or 'D'
186  char
187  stereochem() const
188  {
189  return stereochem_;
190  }
191 
192  /// @brief Return true if the monosaccharide is an L-sugar.
193  bool
194  is_L_sugar() const
195  {
196  if (stereochem_ == 'L') {
197  return true;
198  }
199  return false;
200  }
201 
202  /// @brief Return true if the monosaccharide is a D-sugar.
203  bool
204  is_D_sugar() const
205  {
206  if (stereochem_ == 'D') {
207  return true;
208  }
209  return false;
210  }
211 
212 
213  // Ring properties
214  /// @brief Get the size of the carbohydrate ring.
215  /// @details A linear monosaccharide has a ring size of zero.
216  core::Size
217  ring_size() const
218  {
219  return ring_size_;
220  }
221 
222  /// @brief Return true if the monosaccharide is linear.
223  bool
224  is_acyclic() const
225  {
226  if (ring_size_ == 0) {
227  return true;
228  }
229  return false;
230  }
231 
232  /// @brief Return true if the monosaccharide is a ring.
233  bool
234  is_cyclic() const
235  {
236  return !is_acyclic();
237  }
238 
239  /// @brief Return true if the monosaccharide is a furanose.
240  /// @details A furanose has a five-membered ring (like furan).
241  bool
242  is_furanose() const
243  {
244  if (ring_size_ == 5) {
245  return true;
246  }
247  return false;
248  }
249 
250  /// @brief Return true if the monosaccharide is a pyranose.
251  /// @details A pyranose has a six-membered ring (like pyran).
252  bool
253  is_pyranose() const
254  {
255  if (ring_size_ == 6) {
256  return true;
257  }
258  return false;
259  }
260 
261  /// @brief Return true if the monosaccharide is a septanose.
262  /// @details A septanose has a seven-membered ring.
263  bool
264  is_septanose() const
265  {
266  if (ring_size_ == 7) {
267  return true;
268  }
269  return false;
270  }
271 
272 
273  // Anomeric form
274  /// @brief Get the anomeric form for the monosaccharide.
275  /// @return "alpha", "beta", or ""
276  /// @details "alpha" and "beta" designate the stereochemistry at the anomeric carbon of a cyclic sugar.
278  anomer() const
279  {
280  return anomer_;
281  }
282 
283  /// @brief Return true if the cyclic monosaccharide is an alpha sugar.
284  /// @details "alpha" and "beta" designate the stereochemistry at the anomeric carbon of a cyclic sugar.
285  bool
287  {
288  if (anomer_ == "alpha") {
289  return true;
290  }
291  return false;
292  }
293 
294  /// @brief Return true if the cyclic monosaccharide is a beta sugar.
295  /// @details "alpha" and "beta" designate the stereochemistry at the anomeric carbon of a cyclic sugar.
296  bool
298  {
299  if (anomer_ == "beta") {
300  return true;
301  }
302  return false;
303  }
304 
305 
306  // Polymer info
307  /// @brief Return true if the monosaccharide is attached to something at the anomeric carbon.
308  /// @remarks not yet implemented
309  bool
310  is_glycoside() const
311  {
312  return is_glycoside_;
313  }
314 
315  /// @brief Return the attachment point of the downstream saccharide residue of the main chain.
316  /// @return an integer n of (1->n) of polysaccharide nomenclature, where n specifies the attachment point on the
317  /// upstream monosaccharide residue; e.g., 4 specifies O4; n = 0 specifies an upper terminus
318  /// @details A monosaccharide with a group linked to it at one position is a distinct residue type from the same
319  /// monosaccharide with the same group linked to it at another position. For example, Rosetta treats (1->4)-beta-
320  /// D-glucopyranose as an entirely distinct residue type from (1->3)-beta-D-glucopyranose, with separate .params
321  /// files for each.\n
322  /// \n
323  /// See also:\n
324  /// CarbohydrateInfo.n_branches()\n
325  /// CarbohydrateInfo.branch_point()
326  core::uint
328  {
330  }
331 
332  /// @brief Return the number of branches off of this residue.
333  /// @details A monosaccharide with a group linked to it at one position is a distinct residue type from the same
334  /// monosaccharide with the same group linked to it at another position. For example, Rosetta treats (1->4)-beta-
335  /// D-glucopyranose as an entirely distinct residue type from (1->3)-beta-D-glucopyranose, with separate .params
336  /// files for each.\n
337  /// \n
338  /// See also:\n
339  /// CarbohydrateInfo.mainchain_glycosidic_bond_acceptor()\n
340  /// CarbohydrateInfo.branch_point()
341  /// @remarks Branches are not yet implemented.
342  core::Size
343  n_branches() const
344  {
345  return branch_points_.size();
346  }
347 
348  /// @brief Return the attachment point of the downstream saccharide residue attached to ith branch off of this
349  /// residue.
351 
352  /// @brief Return true if the attachment point of the downstream saccharide is on an exocyclic carbon.
353  bool
355  {
356  return has_exocyclic_linkage_;
357  }
358 
359 
360  // Side-chain modifications
361  // TODO: Determine a good way to track modifications at each carbon.
362  // For now, use booleans.
363  /// @brief Return true if the primary hydroxyl group is oxidized to the acid.
364  bool
365  is_uronic_acid() const {
366  return is_uronic_acid_;
367  }
368 
369 
370  // Torsion angle mappings
371  /// @brief Return the BB or CHI identifier for the requested glycosidic linkage torsion angle.
372  std::pair<core::id::TorsionType, core::uint> glycosidic_linkage_id(core::uint torsion_index) const;
373 
374  /// @brief Return the CHI identifier for the requested nu (internal ring torsion) angle.
375  std::pair<core::id::TorsionType, core::uint> nu_id(core::uint subscript) const;
376 
377 private:
378  // Private methods /////////////////////////////////////////////////////////
379  // Initialize data members from properties.
380  void init(core::chemical::ResidueTypeCAP residue_type);
381 
382  // Copy all data members from <object_to_copy_from> to <object_to_copy_to>.
383  void copy_data(CarbohydrateInfo object_to_copy_to, CarbohydrateInfo object_to_copy_from);
384 
385  // Return the number of carbon atoms (not counting R groups) in the ResidueType.
386  core::Size get_n_carbons() const;
387 
388  // Read through all the properties. Check for impossible cases. If any property type is not set, the default
389  // value will be maintained.
391 
392  // Get connection data from the residue type.
394 
395  // Determine and set the full and abbreviated IUPAC names.
396  void determine_IUPAC_names();
397 
398  // Get monosaccharide root name from the 3-letter code.
401  {
402  return CODE_TO_ROOT_MAP.find(code)->second; // operator[] is not overloaded for const maps.
403  }
404 
405  // If cyclic, define nu angles in terms of CHI ids.
406  void define_nu_ids();
407 
408  // Private data ////////////////////////////////////////////////////////////
412  core::uint anomeric_carbon_; // also indicative of location of aldehyde/ketone oxidation
414  char stereochem_; // L or D
415  core::Size ring_size_; // 0 indicates linear sugar
416  std::string anomer_; // alpha, beta, or null
419 
420  // Glycosidic bond attachment points, i.e., the second integer in (1->n) notations.
421  core::uint mainchain_glycosidic_bond_acceptor_; // 0 if N/A, i.e., if residue type is an upper terminus
424 
425 
426  // Torsion angle mappings
427  // Definitions of phi, psi, omega, and nu angles in terms of Rosetta 3 BB and CHI angles for this particular
428  // sugar. chi angles directly correspond to CHI torsions. (Other torsion angles further up the side chains can
429  // be accessed and set with CHI torsions but do not have an official designation, so they are not mapped.)
431 
432  // The nu angles should always be the last CHI angles defined in the param file or by a patch file.
434 
435  // Constants.
436  static core::Size const MAX_C_SIZE_LIMIT; // maximum size of a carbohydrate carbon chain in Rosetta
438 
439 public:
440  static std::map<std::string, std::string> const CODE_TO_ROOT_MAP;
441 }; // class CarbohydrateInfo
442 
443 } // namespace carbohydrates
444 } // namespace chemical
445 } // namespace core
446 
447 #endif // INCLUDED_core_chemical_carbohydrates_CarbohydrateInfo_HH