multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ancregion.hh
Go to the documentation of this file.
1 /* <LICENSE>
2 License for the MULTOVL multiple genomic overlap tools
3 
4 Copyright (c) 2007-2012, Dr Andras Aszodi,
5 Campus Science Support Facilities GmbH (CSF),
6 Dr-Bohr-Gasse 3, A-1030 Vienna, Austria, Europe.
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are
11 met:
12 
13  * Redistributions of source code must retain the above copyright notice,
14  this list of conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright notice,
16  this list of conditions and the following disclaimer in the documentation
17  and/or other materials provided with the distribution.
18  * Neither the name of the Campus Science Support Facilities GmbH
19  nor the names of its contributors may be used to endorse
20  or promote products derived from this software without specific prior
21  written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
24 AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27 THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 </LICENSE> */
35 #ifndef MULTOVL_ANCREGION_HEADER
36 #define MULTOVL_ANCREGION_HEADER
37 
38 // == HEADER ancregion.hh ==
39 
46 // -- Standard headers --
47 
48 #include <string>
49 #include <set>
50 #include <vector>
51 
52 // -- Boost headers --
53 
54 #include <boost/serialization/base_object.hpp>
55 
56 // -- Library headers --
57 
58 #include "region.hh" // base class for AncestorRegion
59 
60 namespace multovl {
61 
68 class AncestorRegion: public Region,
69  boost::less_than_comparable< AncestorRegion,
70  boost::equality_comparable<AncestorRegion> >
71 {
72  public:
73 
75  AncestorRegion(): Region(), _trackid(0) {}
76 
78  explicit AncestorRegion(const Region& region, unsigned int trackid = 0):
79  Region(region), _trackid(trackid) {}
80 
85  AncestorRegion(unsigned int f, unsigned int l,
86  char s, const std::string& nm, unsigned int trackid = 0):
87  Region(f, l, s, nm), _trackid(trackid) {}
88 
90  const unsigned int& track_id() const { return _trackid; }
91 
93  unsigned int track_id(unsigned int trackid);
94 
96  bool operator==(const AncestorRegion& rhs) const;
97 
100  bool operator<(const AncestorRegion& rhs) const;
101 
106  std::string to_attrstring() const;
107 
108  private:
109 
110  unsigned int _trackid;
111 
112  // "split" serialization
113  friend class boost::serialization::access;
114  template <class Archive>
115  void save(Archive& ar, const unsigned int version) const
116  {
117  ar << boost::serialization::base_object<Region>(*this);
118  ar << _trackid;
119  }
120 
121  template <class Archive>
122  void load(Archive& ar, const unsigned int version)
123  {
124  ar >> boost::serialization::base_object<Region>(*this);
125  ar >> _trackid;
126  }
127  BOOST_SERIALIZATION_SPLIT_MEMBER()
128 
129 }; // class AncestorRegion
130 
134 typedef std::multiset<AncestorRegion> ancregset_t;
135 
136 } // namespace multovl
137 
138 #endif // MULTOVL_ANCREGION_HEADER
std::multiset< AncestorRegion > ancregset_t
Definition: ancregion.hh:134
bool operator==(const AncestorRegion &rhs) const
Equality. All fields must be equal.
AncestorRegion()
Init to empty.
Definition: ancregion.hh:75
std::string to_attrstring() const
AncestorRegion objects represent the regions that give rise to overlaps. They are essentially Region-...
Definition: ancregion.hh:68
bool operator<(const AncestorRegion &rhs) const
const unsigned int & track_id() const
Returns the current track ID.
Definition: ancregion.hh:90
Instances of the Region class represent regions on a sequence. They have first and last coordinates...
Definition: region.hh:65
Genomic regions with coordinates and a name.
AncestorRegion(const Region &region, unsigned int trackid=0)
Init with base class /region/ and /trackid/ (default 0)
Definition: ancregion.hh:78
AncestorRegion(unsigned int f, unsigned int l, char s, const std::string &nm, unsigned int trackid=0)
Definition: ancregion.hh:85