Skip to content

Commit 64aef7a

Browse files
committed
Fix a bug with Clipper.
1 parent 93298fe commit 64aef7a

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

caller.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
#include <ctime>
2+
13
#include "caller.hpp"
24

5+
using namespace std ;
6+
37
void Caller::run() {
8+
time_t t ;
9+
time(&t) ;
410
config = Configuration::getInstance();
511
lprint({"PingPong SV Caller running on", to_string(config->threads), "threads.."}) ;
612
// load reference genome and SFS
@@ -60,7 +66,9 @@ void Caller::run() {
6066
ovcf << sv << endl ;
6167
}
6268
ovcf.close() ;
63-
lprint({"Complete. Exiting.."}) ;
69+
time_t e ;
70+
time(&e) ;
71+
lprint({"Complete. Runtime:", to_string(e - t) + " seconds."}) ;
6472
}
6573

6674
void Caller::load_input_sfs() {
@@ -103,7 +111,7 @@ void Caller::load_input_sfs() {
103111
c += read.second.size() ;
104112
}
105113
}
106-
lprint({"Loaded", to_string(c), "SFS strings on", to_string(r), " reads."}) ;
114+
lprint({"Loaded", to_string(c), "SFS strings on", to_string(r), "reads."}) ;
107115
}
108116

109117
void Caller::print_vcf_header() {

caller.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "extender.hpp"
1414
#include "chromosomes.hpp"
1515

16-
using namespace std;
17-
1816
class Caller {
1917

2018
public:

clipper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vector<Clip> Clipper::remove_duplicates(const vector<Clip> &clips) {
2121
return unique_clips;
2222
}
2323

24-
vector<Clip> Clipper::combine(const vector<Clip> &clips) {
24+
vector<Clip> Clipper::combine(const vector<Clip>& clips) {
2525
int threads = 4 ;
2626
vector<vector<Clip>> _p_combined_clips ;
2727
_p_combined_clips.resize(threads) ;
@@ -47,7 +47,7 @@ vector<Clip> Clipper::combine(const vector<Clip> &clips) {
4747
}
4848
}
4949
vector<Clip> combined_clips ;
50-
for (int i = 0; i < chromosomes.size(); i++) {
50+
for (int i = 0; i < threads; i++) {
5151
combined_clips.insert(combined_clips.begin(), _p_combined_clips[i].begin(), _p_combined_clips[i].end()) ;
5252
}
5353
return combined_clips ;

extender.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pair<int, int> Extender::get_unique_kmers(const vector<pair<int, int>> &alpairs,
121121

122122
// Parallelize within each chromosome
123123
void Extender::extend_parallel() {
124-
lprint({"Extending superstrings on.."}) ;
124+
lprint({"Extending superstrings on", to_string(threads), "threads.."}) ;
125125
int p = 0 ;
126126
int b = 0 ;
127127
for (int i = 0; i < 2; i++) {
@@ -174,7 +174,7 @@ void Extender::extend_parallel() {
174174
if (s - t == 0) {
175175
s += 1 ;
176176
}
177-
cerr << "[I] Processed batch " << std::left << std::setw(7) << b << ". Reads so far " << std::right << std::setw(12) << u << ". Reads per second: " << u / (s - t) << ". Time: " << std::setw(8) << std::fixed << s - t << "\r" ;
177+
cerr << "[I] Processed batch " << std::left << std::setw(7) << b << ". Reads so far: " << std::right << std::setw(12) << u << ". Reads per second: " << u / (s - t) << ". Time: " << std::setw(8) << std::fixed << s - t << "\r" ;
178178
printed = true ;
179179
}
180180
if (printed) {
@@ -399,9 +399,8 @@ void Extender::cluster_no_interval_tree() {
399399
[] (const ExtSFS& lhs, const ExtSFS& rhs) {
400400
return lhs.e - lhs.s < rhs.e - rhs.s ;
401401
}) ;
402-
// TODO: is this good?
403402
int dist = (r->e - r->s) * 1.1 ;
404-
lprint({"Maximum extended-SFS length:", to_string(dist), "bp."}) ;
403+
lprint({"Maximum extended-SFS length:", to_string(dist), "bp. Using separation distance", to_string(dist) + "."}) ;
405404
// find large gaps
406405
int prev_i = 0 ;
407406
int prev_e = extended_sfs[0].e ;

0 commit comments

Comments
 (0)