Skip to content

Commit f041709

Browse files
committed
Fix formatting in source files.
1 parent fdd50ee commit f041709

File tree

3 files changed

+49
-47
lines changed

3 files changed

+49
-47
lines changed

bed_utils.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
#include <vector>
55
#include <string>
6-
#include <unordered_map>
6+
#include <fstream>
77
#include <sstream>
88
#include <iostream>
99
#include <iterator>
10-
#include <algorithm>
11-
#include <fstream>
1210
#include <stdlib.h>
1311
#include <assert.h>
12+
#include <algorithm>
13+
#include <unordered_map>
1414

1515
#include "lprint.hpp"
1616

converter.cpp

+40-40
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,49 @@
33
KSEQ_INIT(gzFile, gzread)
44

55
void Converter::run() {
6-
auto c = Configuration::getInstance();
7-
string fq_path = c->fastq;
8-
string sfs_path = c->bed;
9-
int tau = c->cutoff;
6+
auto c = Configuration::getInstance();
7+
string fq_path = c->fastq;
8+
string sfs_path = c->bed;
9+
int tau = c->cutoff;
1010

11-
// 1 Parsing and storing sfss
12-
map<string, vector<SFS>> SFSs = parse_sfsfile(sfs_path, tau);
11+
// 1 Parsing and storing sfss
12+
map<string, vector<SFS>> SFSs = parse_sfsfile(sfs_path, tau);
1313

14-
// 2 Parsing reads
15-
map<string, uint> allsfs;
16-
gzFile fp = gzopen(fq_path.c_str(), "r");
17-
kseq_t *seq = kseq_init(fp);
18-
int l;
19-
uint idx = 0;
20-
while ((l = kseq_read(seq)) >= 0) {
21-
string header = seq->name.s;
22-
if (SFSs.find(header) == SFSs.end()) {
23-
// cerr << "Skipping " << header << endl;
24-
continue;
25-
}
26-
for (const SFS &sfs : SFSs.at(header)) {
27-
uint st = sfs.s;
28-
uint len = sfs.l;
29-
uint c = sfs.c;
30-
string sfsseq(seq->seq.s, st, len);
31-
32-
string rcsfsseq(sfsseq);
33-
for (uint j = 0; j < sfsseq.size(); ++j)
34-
rcsfsseq[j] = RCN[sfsseq[j]];
35-
reverse(rcsfsseq.begin(), rcsfsseq.end());
36-
sfsseq = min(sfsseq, rcsfsseq);
14+
// 2 Parsing reads
15+
map<string, uint> allsfs;
16+
gzFile fp = gzopen(fq_path.c_str(), "r");
17+
kseq_t *seq = kseq_init(fp);
18+
int l;
19+
uint idx = 0;
20+
while ((l = kseq_read(seq)) >= 0) {
21+
string header = seq->name.s;
22+
if (SFSs.find(header) == SFSs.end()) {
23+
// cerr << "Skipping " << header << endl;
24+
continue;
25+
}
26+
for (const SFS &sfs : SFSs.at(header)) {
27+
uint st = sfs.s;
28+
uint len = sfs.l;
29+
uint c = sfs.c;
30+
string sfsseq(seq->seq.s, st, len);
31+
string rcsfsseq(sfsseq);
32+
for (uint j = 0; j < sfsseq.size(); ++j) {
33+
rcsfsseq[j] = RCN[sfsseq[j]];
34+
}
35+
reverse(rcsfsseq.begin(), rcsfsseq.end());
36+
sfsseq = min(sfsseq, rcsfsseq);
3737

38-
string qual(len, '-');
39-
cout << "@" << header << "#" << idx << "#" << st << "#" << st + len - 1
40-
<< "#" << c << "\n"
41-
<< sfsseq << "\n"
42-
<< "+"
43-
<< "\n"
44-
<< qual << endl;
45-
++idx;
38+
string qual(len, '-');
39+
cout << "@" << header << "#" << idx << "#" << st << "#" << st + len - 1
40+
<< "#" << c << "\n"
41+
<< sfsseq << "\n"
42+
<< "+"
43+
<< "\n"
44+
<< qual << endl;
45+
++idx ;
46+
}
4647
}
47-
}
4848

49-
kseq_destroy(seq);
50-
gzclose(fp);
49+
kseq_destroy(seq);
50+
gzclose(fp);
5151
}

converter.hpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#ifndef CONVERTER_HPP
22
#define CONVERTER_HPP
33

4-
#include "config.hpp"
5-
#include "kseq.h"
6-
#include "sfsutils.hpp"
74
#include <algorithm>
5+
6+
#include "kseq.h"
87
#include <zlib.h>
98

9+
#include "config.hpp"
10+
#include "sfsutils.hpp"
11+
1012
using namespace std;
1113

1214
class Converter {
1315
public:
14-
void run();
16+
void run();
1517
};
1618

1719
#endif

0 commit comments

Comments
 (0)