SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcf.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_VCF_HPP__
27 #define IO_VCF_HPP__
28 
29 #include <iostream>
30 #include <map>
31 #include <string>
32 
35 #include "shore/stream/streams.hpp"
36 
37 namespace shore {
38 
39 
44 {
45  private:
46 
47  shore::ostreams m_out;
48 
49  std::map<std::string,shore::sequence_record> m_refseq;
50 
51  std::string m_samplename;
52 
53  std::string m_chr;
54  long m_pos;
55  std::string m_refbases;
56  std::string m_varbases;
57  size_t m_ref_noanchorofs;
58  size_t m_var_noanchorofs;
59  std::vector<int> m_qual;
60  std::vector<int> m_supp;
61 
62  void wbuf();
63 
64  public:
65 
67 
68  vcf_writer(const std::string& fn,const std::string& ref);
69  vcf_writer(std::ostream& os,const std::string& ref);
70 
71  void append(const shore::local_variant& f);
72  void flush();
73 };
74 
77 
80 {
81  private:
82 
83  shore::local_variant m_current;
84 
85  shore::istreams m_in;
86 
87  bool m_hasdata;
88 
89  public:
90 
92 
93  qualvar_reader(const std::string& qv_fn);
94  qualvar_reader(std::istream& in);
95 
96  bool has_data() const;
97  const shore::local_variant& current() const;
98  void next();
99 };
100 
101 std::istream& operator>>(std::istream& in,shore::local_variant& e);
102 
105 
106 } // namespace
107 
108 #endif // IO_VCF_HPP__
109