-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathpolisher.hpp
99 lines (77 loc) · 2.87 KB
/
polisher.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
/*!
* @file polisher.hpp
*
* @brief Polisher class header file
*/
#pragma once
#include <stdlib.h>
#include <vector>
#include <memory>
#include <unordered_map>
#include <thread>
namespace bioparser {
template<class T>
class Parser;
}
namespace thread_pool {
class ThreadPool;
}
namespace spoa {
class AlignmentEngine;
}
namespace racon {
class Sequence;
class Overlap;
class Window;
class Logger;
enum class PolisherType {
kC, // Contig polishing
kF // Fragment error correction
};
class Polisher;
std::unique_ptr<Polisher> createPolisher(const std::string& sequences_path,
const std::string& overlaps_path, const std::string& target_path,
PolisherType type, uint32_t window_length, double quality_threshold,
double error_threshold, bool trim, int8_t match, int8_t mismatch, int8_t gap,
uint32_t num_threads, uint32_t cuda_batches = 0,
bool cuda_banded_alignment = false, uint32_t cudaaligner_batches = 0,
uint32_t cudaaligner_band_width = 0);
class Polisher {
public:
virtual ~Polisher();
virtual void initialize();
virtual void polish(std::vector<std::unique_ptr<Sequence>>& dst,
bool drop_unpolished_sequences);
friend std::unique_ptr<Polisher> createPolisher(const std::string& sequences_path,
const std::string& overlaps_path, const std::string& target_path,
PolisherType type, uint32_t window_length, double quality_threshold,
double error_threshold, bool trim, int8_t match, int8_t mismatch, int8_t gap,
uint32_t num_threads, uint32_t cuda_batches, bool cuda_banded_alignment,
uint32_t cudaaligner_batches, uint32_t cudaaligner_band_width);
protected:
Polisher(std::unique_ptr<bioparser::Parser<Sequence>> sparser,
std::unique_ptr<bioparser::Parser<Overlap>> oparser,
std::unique_ptr<bioparser::Parser<Sequence>> tparser,
PolisherType type, uint32_t window_length, double quality_threshold,
double error_threshold, bool trim, int8_t match, int8_t mismatch, int8_t gap,
uint32_t num_threads);
Polisher(const Polisher&) = delete;
const Polisher& operator=(const Polisher&) = delete;
virtual void find_overlap_breaking_points(std::vector<std::unique_ptr<Overlap>>& overlaps);
std::unique_ptr<bioparser::Parser<Sequence>> sparser_;
std::unique_ptr<bioparser::Parser<Overlap>> oparser_;
std::unique_ptr<bioparser::Parser<Sequence>> tparser_;
PolisherType type_;
double quality_threshold_;
double error_threshold_;
bool trim_;
std::vector<std::shared_ptr<spoa::AlignmentEngine>> alignment_engines_;
std::vector<std::unique_ptr<Sequence>> sequences_;
std::vector<uint32_t> targets_coverages_;
std::string dummy_quality_;
uint32_t window_length_;
std::vector<std::shared_ptr<Window>> windows_;
std::shared_ptr<thread_pool::ThreadPool> thread_pool_;
std::unique_ptr<Logger> logger_;
};
}