btllib
 All Classes Namespaces Functions Variables
seq_writer.hpp
1 #ifndef BTLLIB_SEQ_WRITER_HPP
2 #define BTLLIB_SEQ_WRITER_HPP
3 
4 #include "btllib/data_stream.hpp"
5 #include "btllib/seq.hpp"
6 
7 #include <cstdio>
8 #include <mutex>
9 #include <string>
10 
11 namespace btllib {
12 
22 class SeqWriter
23 {
24 
25 public:
26  enum Format
27  {
28  FASTA,
29  FASTQ
30  };
31 
39  SeqWriter(const std::string& sink_path,
40  Format format = FASTA,
41  bool append = false);
42 
43  void close();
44 
53  void write(const std::string& id,
54  const std::string& comment,
55  const std::string& seq,
56  const std::string& qual = "");
57 
58 private:
59  const std::string sink_path;
60  DataSink sink;
61  bool closed;
62  Format format;
63  char headerchar;
64  std::mutex mutex;
65 };
66 
67 } // namespace btllib
68 
69 #endif
void write(const std::string &id, const std::string &comment, const std::string &seq, const std::string &qual="")
Definition: seq_writer.hpp:22
SeqWriter(const std::string &sink_path, Format format=FASTA, bool append=false)