gbouras13 / dnaapler

Reorients assembled microbial sequences
MIT License
102 stars 3 forks source link

Error with dnaapler all on bacterial chromosome and plasmids #38

Closed samnooij closed 1 year ago

samnooij commented 1 year ago

The dnaapler workflow crashes right after the BLAST step on some PacBio HiFi assemblies. I've been running dnaapler all on bacterial assemblies of PacBio HiFi reads (made with Flye). The assemblies are all nearly identical and consist of a circular chromosome of ~4Mb and two plasmids of ~20kb. This works quite nicely, but fails in one case. The clue I'm getting in the log file is copied below. If you have any suggestion how to fix this, I'd be happy to adjust some code and test it! Thanks in advance.

2023-08-29 13:28:48.143 | INFO     | dnaapler.utils.external_tools:run:52 - Done running blastx -db .../lib/python3.11/site-packages/dnaapler/db/all_db -evalue 1e-10 -num_threads 4 -outfmt ' 6 qseqid qlen sseqid slen length qstart qend sstart send pident nident gaps mismatch evalue bitscore qseq sseq ' -out data/tmp/example_blast_output.txt -query data/tmp/example-assembly/assembly.fasta

Traceback (most recent call last):
  File ".../bin/dnaapler", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File ".../lib/python3.11/site-packages/dnaapler/__init__.py", line 728, in main
    main_cli()
  File ".../lib/python3.11/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/dnaapler/__init__.py", line 709, in all
    all_process_blast_output_and_reorient(
  File ".../lib/python3.11/site-packages/dnaapler/utils/all.py", line 269, in all_process_blast_output_and_reorient
    genes.append(gene)
                 ^^^^
UnboundLocalError: cannot access local variable 'gene' where it is not associated with a value
gbouras13 commented 1 year ago

It's a bug by me - line 269 shouldn't be

genes.append(gene)

it should simply be

genes.append(message)

Let me know how that goes!

George

samnooij commented 1 year ago

Thanks for the amazingly fast fix! It works now. :smile:

gbouras13 commented 1 year ago

No problem @samnooij, thanks for spotting the bug - if you can push a PR that would be much appreciated, I'll make a patch release soon :)