-
Notifications
You must be signed in to change notification settings - Fork 4
/
caller.hpp
104 lines (87 loc) · 2.61 KB
/
caller.hpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef CALLER_HPP
#define CALLER_HPP
#include <ctime>
#include <dirent.h>
#include <iostream>
#include <map>
#include <abpoa.h>
#include <parasail.h>
#include <parasail/matrices/nuc44.h>
#include <rapidfuzz/fuzz.hpp>
#include <spdlog/spdlog.h>
#include "bam.hpp"
#include "chromosomes.hpp"
#include "clipper.hpp"
#include "clusterer.hpp"
#include "genotyper.hpp"
#include "config.hpp"
#include "sfs.hpp"
#include "sv.hpp"
using namespace std;
// AaCcGgTtNn ==> 0,1,2,3,4
static unsigned char _char26_table[256] = {
0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4 /*'-'*/, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0,
4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
class Consensus {
public:
string seq;
string chrom;
string cigar;
int s;
int e;
Consensus(const string _seq, const string _cigar, const string _chrom, int _s,
int _e) {
seq = _seq;
cigar = _cigar;
chrom = _chrom;
s = _s;
e = _e;
}
friend ostream &operator<<(ostream &os, const Consensus &c) {
os << c.chrom << ":" << c.s + 1 << "-" << c.e + 1 << "\t"
<< "0"
<< "\t" << c.chrom << "\t" << c.s + 1 << "\t"
<< "60"
<< "\t" << c.cigar << "\t"
<< "*"
<< "\t"
<< "0"
<< "\t"
<< "0"
<< "\t" << c.seq << "\t"
<< "*";
return os;
}
};
class Caller {
public:
void run();
private:
Configuration *config;
unordered_map<string, vector<SFS>> SFSs;
vector<SV> svs;
vector<Consensus> alignments;
void pcall(const vector<Cluster> &);
void clean_dups();
void filter_sv_chains();
void write_vcf();
void write_sam();
vector<Cluster> split_cluster_by_len(const Cluster &);
vector<Cluster> split_cluster(const Cluster &);
string run_poa(const vector<string> &);
// parallelize
vector<vector<SV>> _p_svs;
vector<vector<Consensus>> _p_alignments;
void print_vcf_header();
};
#endif