Skip to content

Commit 74d5d77

Browse files
Just formatting
1 parent ea2865e commit 74d5d77

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

bisulfite_utils.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Part of SMITHLAB software
33
*
4-
* Copyright (C) 2008 Cold Spring Harbor Laboratory,
4+
* Copyright (C) 2008 Cold Spring Harbor Laboratory,
55
* University of Southern California and
66
* Andrew D. Smith
77
*
@@ -29,22 +29,23 @@
2929
using std::string;
3030

3131
void
32-
bisulfite_treatment(std::mt19937 &generator, string &seq, double bs_rate, double meth_rate) {
33-
std::uniform_real_distribution<double> dist(0.0,1.0);
34-
32+
bisulfite_treatment(std::mt19937 &generator, string &seq,
33+
double bs_rate, double meth_rate) {
34+
35+
std::uniform_real_distribution<double> unif(0.0,1.0);
36+
3537
const size_t seq_len = seq.length() - 1;
3638
for (size_t i = 0; i < seq_len; ++i)
3739
if (toupper(seq[i]) == 'C') {
3840
// CpG
3941
if (toupper(seq[i + 1]) == 'G' &&
40-
(dist(generator) > meth_rate || dist(generator)< bs_rate)) {
41-
seq[i] = 'T';
42+
(unif(generator) > meth_rate || unif(generator) < bs_rate)) {
43+
seq[i] = 'T';
4244
}
4345
// Regular C
44-
else if (dist(generator) < bs_rate)
45-
seq[i] = 'T';
46+
else if (unif(generator) < bs_rate)
47+
seq[i] = 'T';
4648
}
47-
if (toupper(seq[seq_len]) == 'C' && dist(generator) < bs_rate)
49+
if (toupper(seq[seq_len]) == 'C' && unif(generator) < bs_rate)
4850
seq[seq_len] = 'T';
4951
}
50-

bisulfite_utils.hpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
/*
2-
* Part of SMITHLAB software
1+
/* Part of Smith lab software
32
*
4-
* Copyright (C) 2008 Cold Spring Harbor Laboratory,
5-
* University of Southern California and
6-
* Andrew D. Smith
3+
* Copyright (C) 2020 University of Southern California and
4+
* Andrew D. Smith
75
*
8-
* Authors: Andrew D. Smith
6+
* Authors: Andrew D. Smith
97
*
10-
* This program is free software: you can redistribute it and/or modify
11-
* it under the terms of the GNU General Public License as published by
12-
* the Free Software Foundation, either version 3 of the License, or
13-
* (at your option) any later version.
8+
* This program is free software: you can redistribute it and/or
9+
* modify it under the terms of the GNU General Public License as
10+
* published by the Free Software Foundation, either version 3 of the
11+
* License, or (at your option) any later version.
1412
*
15-
* This program is distributed in the hope that it will be useful,
16-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
19-
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
13+
* This program is distributed in the hope that it will be useful, but
14+
* WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
* General Public License for more details.
2217
*/
2318

2419

@@ -29,7 +24,7 @@
2924
#include <random>
3025

3126
void
32-
bisulfite_treatment(std::mt19937 &generator, std::string &seq,
33-
double bs_rate = 1.0, double meth_rate = 0.0);
27+
bisulfite_treatment(std::mt19937 &generator, std::string &seq,
28+
double bs_rate = 1.0, double meth_rate = 0.0);
3429

3530
#endif

0 commit comments

Comments
 (0)