Skip to content

Commit 3218593

Browse files
committed
changed binning rng to be dependent on the seed from preseq
1 parent 7d44610 commit 3218593

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/load_data_for_complexity.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,14 @@ SplitMappedRead(const bool VERBOSE,
751751
size_t
752752
load_coverage_counts_MR(const bool VERBOSE,
753753
const string input_file_name,
754+
const unsigned long int seed,
754755
const size_t bin_size,
755756
const size_t max_width,
756757
vector<double> &coverage_hist) {
757758

758759
srand(time(0) + getpid());
759760
//Runif runif(rand());
760-
std::random_device rd;
761-
std::mt19937 generator(rd());
761+
std::mt19937 generator(seed);
762762

763763
std::ifstream in(input_file_name.c_str());
764764
if (!in)
@@ -813,14 +813,14 @@ load_coverage_counts_MR(const bool VERBOSE,
813813

814814
size_t
815815
load_coverage_counts_GR(const string input_file_name,
816+
const unsigned long int seed,
816817
const size_t bin_size,
817818
const size_t max_width,
818819
vector<double> &coverage_hist) {
819820

820821
srand(time(0) + getpid());
821822
//Runif runif(rand());
822-
std::random_device rd;
823-
std::mt19937 generator(rd());
823+
std::mt19937 generator(seed);
824824

825825
std::ifstream in(input_file_name.c_str());
826826
if (!in)

src/load_data_for_complexity.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
size_t
2727
load_coverage_counts_MR(const bool VERBOSE,
2828
const std::string input_file_name,
29+
const unsigned long int seed,
2930
const size_t bin_size,
3031
const size_t max_width,
3132
std::vector<double> &coverage_hist);
3233

3334

3435
size_t
3536
load_coverage_counts_GR(const std::string input_file_name,
37+
const unsigned long int seed,
3638
const size_t bin_size,
3739
const size_t max_width,
3840
std::vector<double> &coverage_hist);

src/preseq.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,13 +883,13 @@ gc_extrap(const int argc, const char **argv) {
883883
if (NO_SEQUENCE) {
884884
if (VERBOSE)
885885
cerr << "BED FORMAT" << endl;
886-
n_reads = load_coverage_counts_GR(input_file_name, bin_size,
886+
n_reads = load_coverage_counts_GR(input_file_name, seed, bin_size,
887887
max_width, coverage_hist);
888888
}
889889
else {
890890
if (VERBOSE)
891891
cerr << "MAPPED READ FORMAT" << endl;
892-
n_reads = load_coverage_counts_MR(VERBOSE, input_file_name, bin_size,
892+
n_reads = load_coverage_counts_MR(VERBOSE, input_file_name, seed, bin_size,
893893
max_width, coverage_hist);
894894
}
895895

0 commit comments

Comments
 (0)