-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathHaplotagProcess.h
More file actions
executable file
·87 lines (67 loc) · 2.52 KB
/
Copy pathHaplotagProcess.h
File metadata and controls
executable file
·87 lines (67 loc) · 2.52 KB
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
#ifndef HAPLOTAGPROCESS_H
#define HAPLOTAGPROCESS_H
#include "Util.h"
#include "ParsingBam.h"
#include <cmath>
struct HaplotagParameters
{
int numThreads;
int qualityThreshold;
int svWindow;
double percentageThreshold;
double svThreshold;
std::string snpFile;
std::string svFile;
std::string modFile;
std::string bamFile;
std::string fastaFile;
std::string resultPrefix;
std::string region;
std::string command;
std::string version;
std::string outputFormat;
bool tagSupplementary;
bool writeReadLog;
};
class HaplotagProcess
{
void variantParser(std::string variantFile);
void compressParser(std::string &variantFile);
void unCompressParser(std::string &variantFile);
void parserProcess(std::string &input);
void tagRead(HaplotagParameters ¶ms);
std::vector<std::string> chrVec;
std::map<std::string, int> chrLength;
// chr, variant position (0-base), allele haplotype
std::map<std::string, std::map<int, RefAlt> > chrVariant;
// chr, variant position (0-base), phased set
std::map<std::string, int > psIndex;
std::map<std::string, std::map<int, int> > chrVariantPS;
std::map<std::string, std::map<int, std::string> > chrVariantHP1;
std::map<std::string, std::map<int, std::string> > chrVariantHP2;
std::map<int, RefAlt> currentChrVariants;
std::map<int, RefAlt>::iterator firstVariantIter;
// The number of SVs occurring on different haplotypes in a read
std::map<std::string, std::map<int, int> > readSVHapCount;
// record SV region
std::map<std::string, std::vector<std::tuple<int, int, int> > > chrRegions;
std::vector<std::tuple<int, int, int> > currentchrRegions;
std::vector<std::tuple<int, int, int> >::iterator firstSVIter;
void initFlag(bam1_t *aln, std::string flag);
int judgeHaplotype(const bam_hdr_t &bamHdr,const bam1_t &aln, std::string chrName, double percentageThreshold, std::ofstream *tagResult, int &pqValue, const std::string &ref_string, int svWindow, double svThreshold);
int totalAlignment;
int totalSupplementary;
int totalSecondary;
int totalUnmapped;
int totalTagCount;
int totalUnTagCount;
std::time_t processBegin;
bool integerPS;
bool parseSnpFile;
bool parseSVFile;
bool parseMODFile;
public:
HaplotagProcess(HaplotagParameters params);
~HaplotagProcess();
};
#endif