Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DnaChains.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 DnaChains.hh
11 /// @brief a descriptive but lightweight class to keep track of (usually basepaired) dna chains
12 /// @author ashworth
13 
14 #ifndef INCLUDED_protocols_dna_DnaChains_hh
15 #define INCLUDED_protocols_dna_DnaChains_hh
16 
18 
19 #include <core/types.hh>
20 #include <core/pose/Pose.fwd.hh>
21 
22 #include <utility/pointer/ReferenceCount.hh>
23 
24 #include <iosfwd>
25 #include <map>
26 
27 #include <utility/vector1.hh>
28 
29 
30 namespace protocols {
31 namespace dna {
32 
33 class DnaPosition {
34 ///@brief Stores residue index/indices for a DNA position, which could be a basepair or a single-stranded position. Accomplishes what std::pair<Size,Size> would, but is nicer to use
35 public: // constructors
36  // default empty constructor
37  DnaPosition() : top_(0), bottom_(0), paired_(false) {}
38  // construct a single-stranded position
39  DnaPosition( core::Size i ) : top_(i), bottom_(0), paired_(false) {}
40  // construct a double-stranded position (a basepair)
41  DnaPosition( core::Size i, core::Size j ) : top_(i), bottom_(j), paired_(true) {}
43 
44 public: // const methods
45  core::Size top() const { return top_; }
46  core::Size bottom() const { return bottom_; }
47  bool paired() const { return paired_; }
48  // there are no 'settors' -- just delete and reconstruct -- it is safer that way
49 
50 private:
53  bool paired_;
54 };
55 
56 typedef std::map< core::Size, DnaPosition > DnaPositions;
57 
59 // this class is a light wrapper for DnaPositions (a map which is typedefed above)
60 public: // constructors
61  DnaChains();
62  virtual ~DnaChains();
63  DnaChains( DnaChains const & other );
64  DnaChainsOP clone() const;
65 
66  void clear() { positions_.clear(); }
67  bool empty() const { return positions_.empty(); }
68  core::Size size() const { return positions_.size(); }
69 
70  DnaPosition & operator[] ( core::Size resindex ) { return positions_[ resindex ]; }
71  DnaPosition const & operator[] ( core::Size resindex ) const
72  { return ( *( positions_.find( resindex ))).second; }
73 
75  DnaPositions const & positions() const { return positions_; }
76 
77  DnaPositions::iterator begin() { return positions_.begin(); }
78  DnaPositions::iterator end() { return positions_.end(); }
79  DnaPositions::const_iterator begin() const { return positions_.begin(); }
80  DnaPositions::const_iterator end() const { return positions_.end(); }
81 
82  // top strand resid check (looks in map keys)
83  bool is_top( core::Size index ) const
84  { if ( positions_.count(index) != 0 ) return true; return false; }
85 
86  bool contains( core::Size index ) const;
87  void print( core::pose::Pose const & pose, std::ostream & os ) const;
88 
89 private:
90  // map of DNA position info, keyed by Pose residue index
92 };
93 
94 } // namespace dna
95 } // namespace protocols
96 
97 #endif