Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResonanceList.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 ResonanceList.hh
11 /// @brief provides a table with atomID - chemical shift mapping
12 /// @detail
13 /// @author Oliver Lange
14 
15 #ifndef INCLUDED_protocols_noesy_assign_ResonanceList_hh
16 #define INCLUDED_protocols_noesy_assign_ResonanceList_hh
17 
18 
19 // Unit Headers
21 
22 // Package Headers
24 
25 // Project Headers
26 #include <core/chemical/AA.hh>
27 #include <core/id/NamedAtomID.hh>
28 #include <core/types.hh>
29 
30 // Utility headers
31 // AUTO-REMOVED #include <utility/exit.hh>
32 // #include <utility/excn/Exceptions.hh>
33 #include <utility/vector1.hh>
34 #include <utility/pointer/ReferenceCount.hh>
35 // #include <numeric/numeric.functions.hh>
36 // #include <basic/prof.hh>
37 //#include <basic/Tracer.hh>
38 // #include <basic/options/option.hh>
39 // #include <basic/options/keys/abinitio.OptionKeys.gen.hh>
40 // #include <basic/options/keys/run.OptionKeys.gen.hh>
41 //#include <basic/options/keys/templates.OptionKeys.gen.hh>
42 
43 //// C++ headers
44 // AUTO-REMOVED #include <cstdlib>
45 // AUTO-REMOVED #include <string>
46 #include <map>
47 
48 namespace protocols {
49 namespace noesy_assign {
50 
51 /*!@detail:
52 the ResonanceList provides a map of chemical shifts.
53 each atom-chemical shift tupel has a "resonanceID" as a key. (integer)
54 
55 used classes:
56 
57 Resonance is an atom with chemical shift information
58 ResonanceIDs (typedef) is a map from ID to Resonance
59 ResidueMap (typedef) is a map from residue number to a vector of Resonances.
60 
61 
62 
63 */
65 
66 public:
68 
69 private:
70  typedef std::map< core::Size, Resonances > ResidueMap;
71  typedef std::map< core::Size, ResonanceOP > ResonanceIDs;
72 
73  ResonanceList( ResonanceList const& a )://private copy-c'stor to avoid that FloatingResonances have out-dated pointers.
74  utility::pointer::ReferenceCount(a) //make compiler happy
75  {};
76  ResonanceList& operator=( ResonanceList const& ) { return *this; };
77 public:
78  ///@brief Constructor
80 
81  virtual ~ResonanceList();
82 
83  ///@brief read chemical shift assignments
84  void read_from_stream( std::istream& );
85 
86  ///@brief write chemical shift assignments
87  void write_to_stream( std::ostream& ) const;
88 
89  ///@brief write in talos format
90  void write_talos_format( std::ostream&, bool backbone_only ) const;
91 
92  ///@brief retrieve a Resonance by ResonanceID --- throws EXCN_UnknonwResonance if atom not found
93  Resonance const& operator[] ( core::Size key ) const;
94 
95  ///@brief retrive a Resonance by atom --- throws EXCN_UnknonwResonance if atom not found
96  Resonance const& operator[] ( core::id::NamedAtomID const& ) const;
97 
98  ///@brief all resonances of a certain residue
99  ///@detail --- requires that update_residue_map() has been called (which is done by read_from_stream() )
100  Resonances const& resonances_at_residue( core::Size resid ) const;
101 
102  ///@brief iterators
103  typedef ResonanceIDs::const_iterator const_iterator;
104  // typedef ResonanceIDs::iterator iterator;
105  const_iterator begin() const { return map_.begin(); };
106  const_iterator end() const { return map_.end(); };
107 
108  ///@brief have at least one resonance for residue "resi"
109  bool has_residue( core::Size resi ) const;
110 
111  ///@brief retrieve aminoacid of residue "resi"
113 
114  ///@brief retrieve the protein sequence
115  std::string const& sequence() const { return sequence_; }
116 
117  ///@brief number of Resonances
118  core::Size size() const { return map_.size(); };
119 
120  ///@brief first ResonanceID (given by input file)
121  core::Size start_key() const { return map_.begin()->first; }
122 
123  ///@brief last ResonanceID ( given by input file )
124  core::Size last_key() const { return map_.rbegin()->first; }
125 
126 protected:
127  ///@brief retrieve a Resonance by ResonanceID --- no error checking
128  Resonance const& operator[] ( core::Size key ) { return *map_[ key ]; };
129 
130  ///@brief sort Resonances by residue number and store in by_resid_
131  void update_residue_map();
132 
133 private:
134  ///@brief master map...
135  ResonanceIDs map_; //Resonances are ordered by resonancesID < resID, Resonance >
136 
137  ///@brief slave map... created by update_residue_map()
138  ResidueMap by_resid_; //Resonances are ordered by residue < res_i, vector1<Resonance> >
139 
140  ///@brief sequence of the proteion
142 };
143 
144 }
145 }
146 
147 #endif