-
Notifications
You must be signed in to change notification settings - Fork 0
/
bcf_utils.h
49 lines (41 loc) · 1.14 KB
/
bcf_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __BCF_UTILS_H
#define __BCF_UTILS_H
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include "htslib/vcf.h"
#include "qgenlib/hts_utils.h"
class bcf_record {
public:
// pointers to htslib objects
bcf_hdr_t* hdr;
bcf1_t* rec;
// site-level information
int32_t an;
std::vector<double> acs;
std::string varID;
// sample-level information
std::vector<std::string> sm_ids;
std::vector<int32_t> sm_icols;
int32_t* gts; // GT
int32_t n_gts;
int32_t* dps; // DP
int32_t n_dps;
int32_t* ads; // AD
int32_t n_ads;
//std::vector<uint8_t> ploidies;
bcf_record(bcf_hdr_t* _hdr);
~bcf_record();
int32_t set_samples(std::set<std::string>& sample_ids);
inline int32_t get_nsamples() { return(int32_t)sm_icols.size(); }
inline const std::string& get_sample_id(int32_t idx) { return sm_ids[sm_icols[idx]]; }
bool set_variant(bcf1_t* v);
// method to parse the fields from VCF
bool parse_genotypes();
bool parse_total_depths(const char* name = "DP");
bool parse_allele_depths(const char* name = "AD");
std::string& get_var_ID();
};
#endif // __BCF_UTILS_H