GLnexus
Scalable datastore for population genome sequencing, with on-demand joint genotyping
 All Classes Functions Variables
residuals.h
1 #ifndef GLNEXUS_RESIDUALS_H
2 #define GLNEXUS_RESIDUALS_H
3 
4 #include <fstream>
5 #include <memory>
6 #include "data.h"
7 #include "types.h"
8 #include "service_config.h"
9 
10 namespace GLnexus {
11 
12 class Residuals {
13 private:
14  const MetadataCache& cache_;
15  BCFData& data_;
16  const std::string& sampleset_;
17  const std::vector<std::string>& samples_;
18 
19 public:
20  // constructor
21  Residuals(const MetadataCache& cache, BCFData& data,
22  const std::string& sampleset, const std::vector<std::string>& samples) :
23  cache_(cache), data_(data), sampleset_(sampleset), samples_(samples)
24  {}
25 
26  // destructor
27  ~Residuals();
28 
29  // Create a Residuals object
30  static Status Open(const MetadataCache& cache, BCFData& data,
31  const std::string& sampleset, const std::vector<std::string>& samples,
32  std::unique_ptr<Residuals> &ans);
33 
34  // Create a YAML node describing a loss. The node
35  // is formatted as a string for simplicity.
36  Status gen_record(const unified_site& site,
37  const bcf_hdr_t *gl_hdr,
38  const bcf1_t *gl_call,
39  std::string &ynode);
40 };
41 
43 private:
44  std::string filename_;
45  std::ofstream ofs_;
46 
47 public:
48  // constructor
49  ResidualsFile(std::string filename) : filename_(filename) {}
50 
51  // destructor
52  ~ResidualsFile();
53 
54  static Status Open(std::string filename, std::unique_ptr<ResidualsFile> &ans);
55 
56  // write a YAML record to the end of the file, as an element in a top-level sequence.
57  Status write_record(std::string &rec);
58 };
59 
60 } // namespace GLnexus
61 #endif
Definition: types.h:198
Definition: data.h:98
Function status (return) codes.
Definition: types.h:30
Definition: data.h:61
Definition: residuals.h:42
Definition: residuals.h:12