HadrienG / InSilicoSeq

:rocket: A sequencing simulator
https://insilicoseq.readthedocs.io
MIT License
176 stars 32 forks source link

Bug: local variable 'n_reads' referenced before assignment when running with "coverage" #253

Closed ghoresh11 closed 4 months ago

ghoresh11 commented 4 months ago

Hello,

Thank you for this tool and for the updated version, the performance seems to have really improved and it will come in handy for my work!

I am trying to simulate a metagenome with the "coverage" option rather than abundance (i.e. I would like to consider the genome-length in the final output), and I would like iss to generate the log-normal coverage distribution for me.

I tried running as follows:

iss generate --draft *fasta --model hiseq --coverage lognormal --n_reads 1M

And I get the following error:

Traceback (most recent call last):
  File "/home/ghoresh/.cache/pypoetry/virtualenvs/simulate-metagenome-oP5jUgnD-py3.9/bin/iss", line 8, in <module>
    sys.exit(main())
  File "/home/ghoresh/.cache/pypoetry/virtualenvs/simulate-metagenome-oP5jUgnD-py3.9/lib/python3.9/site-packages/iss/app.py", line 454, in main
    args.func(args)
  File "/home/ghoresh/.cache/pypoetry/virtualenvs/simulate-metagenome-oP5jUgnD-py3.9/lib/python3.9/site-packages/iss/app.py", line 81, in generate_reads
    n_read_pairs = n_reads // 2
UnboundLocalError: local variable 'n_reads' referenced before assignment

Your assistance would be appreciated! Many thanks Gal

HadrienG commented 4 months ago

Hi! Thanks for reporting this. I'll fix and push a bugfix release asap.

HadrienG commented 4 months ago

Should be fixed in 2.0.1, now available with pip. Should be in conda shortly.

ghoresh11 commented 4 months ago

Please ignore my previous comments, I found where the issue was coming from in my code. Thanks again for fixing this so quickly!! 🙂