SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
read.hpp
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2008,2009,2010,2011,2012 Stephan Ossowski, Korbinian Schneeberger,
4  * Felix Ott, Joerg Hagmann, Alf Scotland, Sebastian Bender
5  *
6  * This file is part of SHORE.
7  *
8  * SHORE is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * SHORE is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with SHORE. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
25 
26 #ifndef IO_READ_HPP__
27 #define IO_READ_HPP__
28 
29 #include <iostream>
30 #include <vector>
31 #include <set>
32 
37 #include "shore/base/memops.hpp"
38 
39 namespace shore {
40 
43 {
44  public:
45 
46  enum Sorting
47  {
48  SORTING_ID,
49  SORTING_SEQ,
50  SORTING_NONE
51  };
52 
53  struct config
54  {
55  bool unfiltered;
56  std::string sam_ref;
57 
58  config();
59  };
60 
61  typedef shore::read current_type;
62 
63  private:
64 
65  config m_conf;
66 
68  shore::ptrkeeper m_cleaner;
69 
70 
71  void open_path(const std::string& fn,const Sorting srt);
72 
73  public:
74 
75  read_reader(const std::string& fn,
76  const Sorting srt=SORTING_ID,const config &c=config());
77  read_reader(const std::vector<std::string>& fn,
78  const Sorting srt=SORTING_ID,const config &c=config());
79 
80  ~read_reader();
81 
82  bool has_data() const;
83  const shore::read& current() const;
84  void next();
85 
86  int current_streamid() const;
87 
88  struct rltxy
89  {
90  std::string run;
91  int lane;
92  int tile;
93  int x;
94  int y;
95  };
96 
97  static void readid2rltxy(const std::string& id,rltxy*const ret);
98  //static void check_runid(const std::string& run);
99  static std::string rltxy2readid(const std::string& run,int lane,int tile,
100  int x,int y);
101 };
102 
105 
106 } // namespace
107 
108 #endif // IO_READ_HPP__
109