forked from zhouqiansolab/KSNP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphased_block.h
49 lines (35 loc) · 1.21 KB
/
phased_block.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
//
// Created by ixiaohu on 2022/1/30.
//
#ifndef KSNP_PHASED_BLOCK_H
#define KSNP_PHASED_BLOCK_H
#include <cstdlib>
#include <cstdint>
#include <vector>
#include "snp_dbg.h"
class PostProcess {
private:
std::vector<SNP> &snp_column;
const std::vector<Read_Allele> &read_row;
std::vector<Phased_Block> &blocks;
std::vector<int8_t> &hint;
void de_overlap();
/** Calculate MEC score for a seed template TENC on block [p, p+TLEN) */
int mec_of_template(Phased_Block &b, int p, int TLEN, uint tmp);
void error_correction();
/** Connect two neighbouring blocks in which way.
* @return 0 Connect directly
* @return 1 Connect with the second block reversed
* @return -1 Do NOT connect them */
int8_t connect_block(const Phased_Block &prev, const Phased_Block &curr);
void merge();
bool try_to_switch(const Phased_Block &b, int p);
bool try_to_flip(const Phased_Block &b, int p);
public:
PostProcess(std::vector<SNP> &snp, const std::vector<Read_Allele> &read,
std::vector<Phased_Block> &b, std::vector<int8_t> &h);
void resolve();
};
void output_vcf_header(VCF_Header &header, const char *fn);
void output_haplotype_block(const std::vector<SNP> &vcf_snp, const char *dst_fn);
#endif //KSNP_PHASED_BLOCK_H