-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.cpp
More file actions
60 lines (51 loc) · 1.48 KB
/
check.cpp
File metadata and controls
60 lines (51 loc) · 1.48 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
#include <cstdlib>
#include <getopt.h>
#include <iostream>
#include "check.h"
#include "api/BamMultiReader.h"
#include "api/BamWriter.h"
#include "utils/bamtools_utilities.h"
using namespace std;
using namespace BamTools;
check::check(void) {
noWarnings = 0;
readCount = 0;
requireSort = false;
}
check::~check(void) {}
// Write a warning to the error log when a discrepancy is found.
void check::warning(const string& text) {
if (noWarnings < 100) {cerr << name << " " << refID << ":" << position << " - " << text << endl;}
else if (noWarnings == 100) {
cerr << "Maximum number of warnings (100) written. No more warnings will be";
cerr << " written to file." << endl;
}
noWarnings++;
}
// Fix the coordinates of the read.
void check::setNullCoords(BamAlignment& al) {
al.RefID = -1;
al.Position = -1;
al.InsertSize = 0;
requireSort = true;
}
// Fix the coordinates of the mate.
void check::setNullMateCoords(BamAlignment& al) {
al.MateRefID = -1;
al.MatePosition = -1;
al.InsertSize = 0;
}
// Set the coordinates of the read to those of the mate.
void check::setReadToMateCoords(BamAlignment& al) {
al.RefID = al.MateRefID;
al.MateRefID = refEqualID;
al.Position = al.MatePosition;
al.InsertSize = 0;
requireSort = true;
}
// Set the coordinates of the mate to those of the read.
void check::setMateToReadCoords(BamAlignment& al) {
al.MateRefID = al.RefID;//refEqualID;
al.MatePosition = al.Position;
al.InsertSize = 0;
}