-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenomeMapper.h
72 lines (54 loc) · 2.16 KB
/
GenomeMapper.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
GenomeMapper.h
Author: Izaak Coleman
*/
#ifndef GENOMEMAPPER_H
#define GENOMEMAPPER_H
#include <string>
#include <vector>
#include <fstream>
#include "SNVIdentifier.h"
#include "SamEntry.h"
#include "CigarParser.h"
// In order to sort the mulitple potential SNVs present in a
// SamEntry, each SNV is stored as a single_snv along with
// relevant information from the SamEntry.
struct single_snv {
std::string chr;
int position;
char mutation_base;
char healthy_base;
int pair_id;// REMOVE!!
};
class GenomeMapper {
private:
const int MIN_MAPQ; // Discard SamEntries with MAPQ < MIN_MAPQ
const std::string CHR; // Discard SamEntries not aligned to CHR
SNVIdentifier *snvId;
void identifySNVs(std::vector<SamEntry*> &alignments);
// Calls countSNVs() for all valid SamEntries, translating the
// consensus sequence complementarity to that of the reference genome.
void countSNVs(SamEntry* &alignment, int left, CigarParser const & cp);
// Compares consensus sequences identifying SNVs.
void parseSamFile(std::vector<SamEntry*> &alignments, std::string filename);
// Builds list of SamEntries from sam file
static bool compareSNVLocations(const single_snv &a, const single_snv &b);
// Comparison logic for single_snv data type.
static bool equalSNVs(single_snv const& a, single_snv const& b);
// Returns true of two single_snv's have equivalent fields
void outputSNVToUser(std::vector<SamEntry*> &alignments, std::string reportFilename);
// Reports the list of SNVs
char operationOfSNV(int const SNVpos, CigarParser const & cp);
// Returns the CIGAR operation in which the SNV at SNVpos is located.
int calibrateWithCIGAR(int SNVpos, CigarParser const & cp);
// Calibrates SNVPos according to the insertion/deletion information
// contained within CIGAR, such that the SNVPos is referencing the
// correct reference genome index.
bool contiguousMismatch(std::string const & tumour, std::string const & control, int ohang);
public:
GenomeMapper(SNVIdentifier &snv,
std::string const& basename,
std::string const& chr, std::string const& bwt_idx,
int min_mapq);
};
#endif