Skip to content

Commit

Permalink
Fixed a small bug where I used the options version of a variabe when …
Browse files Browse the repository at this point in the history
…I needed the model's version
  • Loading branch information
joshfactorial committed Jun 17, 2024
1 parent 2566b92 commit 7c3ab8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion neat/read_simulator/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def initialize_all_models(options: Options):
fraglen_model = FragmentLengthModel(options.fragment_mean, options.fragment_st_dev, rng=options.rng)
else:
# For single ended, fragment length will be based on read length
fragment_mean = options.read_len * 1.5
fragment_mean = options.read_len * 2.0
fragment_st_dev = fragment_mean * 0.2
fraglen_model = FragmentLengthModel(fragment_mean, fragment_st_dev, options.rng)

Expand Down
6 changes: 3 additions & 3 deletions neat/read_simulator/utils/generate_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def cover_dataset(

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

0 comments on commit 7c3ab8e

Please sign in to comment.