ksahlin / NGSpeciesID

Reference-free clustering and consensus forming of long-read amplicon sequencing
GNU General Public License v3.0
50 stars 16 forks source link

Error on polish_sequences when there are 0 centers #15

Closed Coppini closed 2 years ago

Coppini commented 2 years ago

Tried running the pipeline on some FASTQ files and got the following error:

Traceback (most recent call last):
  File "/home/coppini/miniconda3/envs/NGSpeciesID/bin/NGSpeciesID", line 291, in <module>
    main(args)
  File "/home/coppini/miniconda3/envs/NGSpeciesID/bin/NGSpeciesID", line 142, in main
    centers_polished = consensus.polish_sequences(centers_filtered, args)
  File "/home/coppini/miniconda3/envs/NGSpeciesID/lib/python3.6/site-packages/modules/consensus.py", line 240, in polish_sequences
    f.close()
UnboundLocalError: local variable 'f' referenced before assignment

It appears that you're trying to close the f file here, but you only open it inside the for loop (either here or here). If there are 0 centers (such as in my file - still trying to figure out why though), the for loop is never entered, and f is never assigned.

The error occurred to me when trying to run NGSpeciesID with a high abundance_ratio, which ended up filtering out all my reads.