Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
variant_writer.h
Go to the documentation of this file.
1 #ifndef gamgee__variant_writer__guard
2 #define gamgee__variant_writer__guard
3 
4 #include <string>
5 #include <memory>
6 #include <zlib.h>
7 
8 #include "variant.h"
9 #include "variant_header.h"
10 
11 #include "../utils/hts_memory.h"
12 
13 #include "htslib/vcf.h"
14 
15 namespace gamgee {
16 
22 
23  public:
24 
32  explicit VariantWriter(const std::string& output_fname = "-", const bool binary = true, const int compression_level = Z_DEFAULT_COMPRESSION);
33 
42  explicit VariantWriter(const VariantHeader& header, const std::string& output_fname = "-", const bool binary = true, const int compression_level = Z_DEFAULT_COMPRESSION);
43 
48  VariantWriter(const VariantWriter& other) = delete;
49  VariantWriter& operator=(const VariantWriter& other) = delete;
50 
55  VariantWriter(VariantWriter&& other) = default;
56  VariantWriter& operator=(VariantWriter&& other) = default;
57 
62  void add_record(const Variant& body);
63 
69  void add_header(const VariantHeader& header);
70 
71  private:
72  std::unique_ptr<htsFile, utils::HtsFileDeleter> m_out_file;
73  VariantHeader m_header;
74 
75  static htsFile* open_file(const std::string& output_fname, const std::string& binary);
76  void write_header() const;
77  std::string write_mode(const bool binary, const int compression_level) const;
78 };
79 
80 }
81 
82 #endif // gamgee__variant_writer__guard
Definition: hts.h:109
VariantWriter & operator=(const VariantWriter &other)=delete
void add_header(const VariantHeader &header)
Adds a header to the file stream.
Definition: variant_writer.cpp:31
utility class to write out a VCF/BCF file to any stream
Definition: variant_writer.h:21
void add_record(const Variant &body)
Adds a record to the file stream.
Definition: variant_writer.cpp:36
Definition: exceptions.h:9
VariantWriter(const std::string &output_fname="-", const bool binary=true, const int compression_level=Z_DEFAULT_COMPRESSION)
Creates a new VariantWriter using the specified output file name.
Definition: variant_writer.cpp:9
Utility class to manipulate a Variant record.
Definition: variant.h:29
Utility class to hold a variant header.
Definition: variant_header.h:52