multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
shuffleovl.hh
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_PROB_SHUFFLEOVL_HEADER
36 #define MULTOVL_PROB_SHUFFLEOVL_HEADER
37 
38 // == HEADER shuffleovl.hh ==
39 
43 
44 // -- Library headers --
45 
46 #include "multioverlap.hh"
47 #include "randomplacer.hh"
48 
49 // -- Boost headers --
50 
51 // -- Standard headers --
52 
53 #include <map>
54 
55 namespace multovl {
56 namespace prob {
57 
58 // == Classes ==
59 
61 class ShuffleOvl: public MultiOverlap
62 {
63 public:
64 
67  explicit ShuffleOvl(const std::vector<Region>& frees);
68 
75  bool fit_into_frees(const Region& reg) const { return _freeregions.fit(reg); }
76 
81  bool add_randomplacer(unsigned int reglen, unsigned int trackid);
82 
86  unsigned int shuffle(UniformGen& rng);
87 
88 private:
89 
90  // data
91  FreeRegions _freeregions;
92  typedef std::map<unsigned int, RandomPlacer> rpm_t; // track ID => RandomPlacer for the "shufflable tracks"
93  rpm_t _rpm;
94  unsigned int _shufflecount;
95 
96 #if 0
97  // serialization LATER (if at all)
98  friend class boost::serialization::access;
99  template <class Archive>
100  void serialize(Archive& ar, const unsigned int version)
101  {
102  ar & boost::serialization::base_object<multovl::MultiOverlap>(*this);
103  // TODO ar & _freeregions & _rpm; ???
104  }
105 #endif
106 };
107 
108 } // namespace prob
109 } // namespace multovl
110 
111 #endif // MULTOVL_PROB_SHUFFLEOVL_HEADER
112 
unsigned int shuffle(UniformGen &rng)
bool fit_into_frees(const Region &reg) const
Definition: shuffleovl.hh:75
ShuffleOvl(const std::vector< Region > &frees)
Multiple genomic region overlaps.
bool add_randomplacer(unsigned int reglen, unsigned int trackid)
Convenience class that wraps a uniform RND generator.
Definition: randomgen.hh:51
Instances of the Region class represent regions on a sequence. They have first and last coordinates...
Definition: region.hh:65
Definition: multioverlap.hh:75
Definition: freeregions.hh:67
Class for calculating multiple overlaps repeatedly after reshuffling some of the tracks.
Definition: shuffleovl.hh:61
bool fit(const Region &reg) const