multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
probpipeline.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_PIPELINE_HEADER
36 #define MULTOVL_PROB_PIPELINE_HEADER
37 
38 // == Header probpipeline.hh ==
39 
40 // -- Own headers --
41 
42 #include "basepipeline.hh"
43 #include "stat.hh"
44 #include "shuffleovl.hh"
45 #include "probopts.hh"
46 
47 namespace multovl {
48 namespace prob {
49 
50 // -- Classes --
51 
58 {
59 public:
60 
64  ProbPipeline(int argc, char* argv[]);
65 
66  ~ProbPipeline();
67 
68 protected:
69 
72  ProbPipeline();
73 
77  {
78  public:
79 
81  typedef std::map<unsigned int, unsigned int> mtolen_t;
82 
84  OvlenCounter(): _mtolen() {}
85 
89  void update(const MultiOverlap::multiregvec_t& overlaps);
90 
92  const mtolen_t& mtolen() const { return _mtolen; }
93 
94  private:
95 
96  mtolen_t _mtolen;
97 
98  }; // end of class OvlenCounter
99 
101  typedef std::map<std::string, ShuffleOvl> chrom_shufovl_map;
102 
109  virtual
110  unsigned int read_input();
111 
118  virtual
119  unsigned int detect_overlaps();
120 
123  unsigned int calc_actual_overlaps();
124 
127  virtual
128  bool write_output();
129 
131  virtual
132  ProbOpts* opt_ptr() { return dynamic_cast<ProbOpts*>(opt_pimpl()); }
133 
135  const chrom_shufovl_map& csovl() const { return _csovl; }
136 
138  chrom_shufovl_map& csovl() { return _csovl; }
139 
141  const Stat& stat() const { return _stat; }
142 
144  virtual // because ParProbPipeline needs a thread-safe variant
145  Stat& stat() { return _stat; }
146 
147 private:
148 
149  chrom_shufovl_map _csovl;
150  Stat _stat;
151 
152  unsigned int read_tracks(
153  const std::vector<std::string>& inputfiles,
154  unsigned int& trackid,
155  bool shuffle);
156  unsigned int read_free_regions(const std::string& freefile);
157  void write_comments() const;
158 
159 };
160 
161 } // namespace prob
162 } // namespace multovl
163 
164 #endif // MULTOVL_PROB_PIPELINE_HEADER
virtual ProbOpts * opt_ptr()
Definition: probpipeline.hh:132
std::map< std::string, ShuffleOvl > chrom_shufovl_map
There is one ShuffleOvl object for each chromosome.
Definition: probpipeline.hh:101
virtual unsigned int read_input()
MultovlOptbase * opt_pimpl()
Definition: basepipeline.hh:132
void update(const MultiOverlap::multiregvec_t &overlaps)
const mtolen_t & mtolen() const
Definition: probpipeline.hh:92
OvlenCounter()
Init to empty.
Definition: probpipeline.hh:84
chrom_shufovl_map & csovl()
Definition: probpipeline.hh:138
virtual Stat & stat()
Definition: probpipeline.hh:145
unsigned int calc_actual_overlaps()
Definition: probpipeline.hh:76
std::map< unsigned int, unsigned int > mtolen_t
multiplicity => total overlap length map
Definition: probpipeline.hh:81
Definition: stat.hh:67
virtual unsigned int detect_overlaps()
Option handling for the file-based multovl tools.
Definition: probopts.hh:57
Definition: probpipeline.hh:57
const chrom_shufovl_map & csovl() const
Definition: probpipeline.hh:135
Definition: basepipeline.hh:69
const Stat & stat() const
Definition: probpipeline.hh:141