Skip to content

Commit 7c3ab8e

Browse files
committed
Fixed a small bug where I used the options version of a variabe when I needed the model's version
1 parent 2566b92 commit 7c3ab8e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

neat/read_simulator/runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def initialize_all_models(options: Options):
9393
fraglen_model = FragmentLengthModel(options.fragment_mean, options.fragment_st_dev, rng=options.rng)
9494
else:
9595
# For single ended, fragment length will be based on read length
96-
fragment_mean = options.read_len * 1.5
96+
fragment_mean = options.read_len * 2.0
9797
fragment_st_dev = fragment_mean * 0.2
9898
fraglen_model = FragmentLengthModel(fragment_mean, fragment_st_dev, options.rng)
9999

neat/read_simulator/utils/generate_reads.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def cover_dataset(
3939

4040
final_reads = set()
4141
# sanity check
42-
if span_length/options.fragment_mean < 5:
42+
if span_length/fragment_model.fragment_mean < 5:
4343
_LOG.warning("The fragment mean is relatively large compared to the chromosome size. You may need to increase "
4444
"standard deviation, or decrease fragment mean, if NEAT cannot complete successfully.")
4545
# precompute how many reads we want
@@ -79,7 +79,7 @@ def cover_dataset(
7979
# these are equivalent of reads we expect the machine to filter out, but we won't actually use it
8080
if end - start < options.read_len:
8181
# add some random flavor to try to keep it to falling into a loop
82-
if options.rng.normal() < 0.5:
82+
if fragment_model.rng.normal() < 0.5:
8383
fragment_pool.insert(len(fragment_pool)//2, fragment)
8484
else:
8585
fragment_pool.insert(len(fragment_pool) - 3, fragment)
@@ -124,7 +124,7 @@ def cover_dataset(
124124
# Convert set to final list
125125
final_reads = list(final_reads)
126126
# Now we shuffle them to add some randomness
127-
options.rng.shuffle(final_reads)
127+
fragment_model.rng.shuffle(final_reads)
128128
# And only return the number we needed
129129
_LOG.debug(f"Coverage required {loop_count} loops")
130130
if options.paired_ended:

0 commit comments

Comments
 (0)