multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
multiregion.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_MULTIREGION_HEADER
36 #define MULTOVL_MULTIREGION_HEADER
37 
38 // == Header multiregion.hh ==
39 
44 
45 // -- Library headers --
46 
47 #include "ancregion.hh" // pulls in region.hh
48 
49 // -- Boost headers --
50 
51 #include "boost/serialization/set.hpp" // other serialization headers come from [anc]region.hh
52 
53 // == CLASSES ==
54 
55 namespace multovl {
56 
62 class MultiRegion: public Region
63 {
64  public:
65 
67  MultiRegion();
68 
81  MultiRegion(unsigned int first, unsigned int last,
82  const ancregset_t& ancestors = ancregset_t(), unsigned int mult = 0);
83 
86  void add_ancestor(const AncestorRegion& anc);
87 
91  unsigned int multiplicity() const { return _mult; }
92 
94  const ancregset_t& ancestors() const { return _ancestors; }
95 
97  std::vector<int> ancestor_trackids() const;
98 
104  bool solitary() const { return _solitary; }
105 
109  std::string anc_str() const;
110 
111  private:
112 
113  bool update_solitary();
114 
115  ancregset_t _ancestors; // ancestors
116  bool _solitary;
117  unsigned int _mult;
118 
119  // serialization
120  friend class boost::serialization::access;
121  template <class Archive>
122  void serialize(Archive& ar, const unsigned int version)
123  {
124  ar & boost::serialization::base_object<Region>(*this);
125  ar & _ancestors & _solitary & _mult;
126  }
127 
128 }; // class MultiRegion
129 
130 } // namespace multovl
131 
132 #endif // MULTOVL_MULTIREGION_HEADER
const unsigned int & first() const
Returns the first coordinate.
Definition: region.hh:111
std::string anc_str() const
std::multiset< AncestorRegion > ancregset_t
Definition: ancregion.hh:134
MultiRegion()
Init to empty (to be used by STL containers etc)
bool solitary() const
Definition: multiregion.hh:104
Ancestor regions representing the regions giving rise to overlaps.
Definition: multiregion.hh:62
AncestorRegion objects represent the regions that give rise to overlaps. They are essentially Region-...
Definition: ancregion.hh:68
Instances of the Region class represent regions on a sequence. They have first and last coordinates...
Definition: region.hh:65
const ancregset_t & ancestors() const
Returns the set of ancestors.
Definition: multiregion.hh:94
unsigned int multiplicity() const
Definition: multiregion.hh:91
void add_ancestor(const AncestorRegion &anc)
std::vector< int > ancestor_trackids() const
Return the track IDs of the ancestors in a vector.
const unsigned int & last() const
Returns the last coordinate.
Definition: region.hh:114