phac-nml / mob-suite

MOB-suite: Software tools for clustering, reconstruction and typing of plasmids from draft assemblies
Apache License 2.0
124 stars 33 forks source link

mob_typer --multi Running error? #133

Closed Dx-wmc closed 1 year ago

Dx-wmc commented 1 year ago

Dear Sir,

The mob_typer tool does not work when the --multi parameter is used to analyze a fasta file containing multiple contigs. However, it works properly when only the mob_typer command is used.

I have pasted the error message below for you to view, hoping that you can help me find the cause of the error.

Command:mob_typer -x -i assembly.fasta -o sample_mobtyper_results.txt -g mge.report -n 20 Error infomation: 2023-04-11 15:34:55,271 mob_suite.mob_typer INFO: Running Mob-typer version 3.1.4 [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/mob_typer.py:173] 2023-04-11 15:34:55,271 mob_suite.mob_typer INFO: Processing fasta file assembly.fasta [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/mob_typer.py:175] 2023-04-11 15:34:55,271 mob_suite.mob_typer INFO: SUCCESS: Found program blastn at /home/data/usr/user/miniconda3/envs/plasmid/bin/blastn [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:592] 2023-04-11 15:34:55,272 mob_suite.mob_typer INFO: SUCCESS: Found program makeblastdb at /home/data/usr/user/miniconda3/envs/plasmid/bin/makeblastdb [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:592] 2023-04-11 15:34:55,272 mob_suite.mob_typer INFO: SUCCESS: Found program tblastn at /home/data/usr/user/miniconda3/envs/plasmid/bin/tblastn [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:592] 2023-04-11 15:35:01,349 root INFO: Blasting replicon sequences /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/databases/rep.dna.fas against /tmp/tmpxqd_qefk/fixed.input.fasta [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1150] 2023-04-11 15:35:01,792 root INFO: Filtering replicon blast results /tmp/tmpxqd_qefk/replicon_blast_results.txt [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1155] 2023-04-11 15:35:01,800 root INFO: Blasting relaxase sequences /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/databases/mob.proteins.faa against /tmp/tmpxqd_qefk/fixed.input.fasta [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1173] 2023-04-11 15:35:13,357 root INFO: Filtering relaxase blast results /tmp/tmpxqd_qefk/mobtyper_blast_results.txt [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1178] 2023-04-11 15:35:13,372 root INFO: Blasting MPF sequences /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/databases/mpf.proteins.faa against /tmp/tmpxqd_qefk/fixed.input.fasta [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1197] 2023-04-11 15:35:22,570 root INFO: Filtering MPF blast results /tmp/tmpxqd_qefk/mpf_blast_results.txt [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1212] 2023-04-11 15:35:22,571 root INFO: Blasting orit sequences /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/databases/orit.fas against /tmp/tmpxqd_qefk/fixed.input.fasta [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1221] 2023-04-11 15:35:22,658 root INFO: Filtering orit blast results /tmp/tmpxqd_qefk/orit_blast_results.txt [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/utils.py:1226] 2023-04-11 15:35:22,659 root WARNING: No BLASTN results to parse from file /tmp/tmpxqd_qefk/orit_blast_results.txt [in /home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/blast/__init__.py:181] Traceback (most recent call last): File "/home/data/usr/user/miniconda3/envs/plasmid/bin/mob_typer", line 10, in <module> sys.exit(main()) File "/home/data/usr/user/miniconda3/envs/plasmid/lib/python3.8/site-packages/mob_suite/mob_typer.py", line 547, in main mobtyper_results[i]['size'] = mobtyper_results[i]['total_length'] KeyError: 'total_length'

jrober84 commented 1 year ago

So this is a bug that will need to be addressed but the error stems from empty MGE report. So you can avoid this error by not trying to output the file. I will add protections around this for the next version.