Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mob_typer -d with not-yet-initialized db path fails #150

Closed
phyden opened this issue Aug 23, 2023 · 3 comments
Closed

mob_typer -d with not-yet-initialized db path fails #150

phyden opened this issue Aug 23, 2023 · 3 comments

Comments

@phyden
Copy link

phyden commented Aug 23, 2023

Hi,

I stumbled across an issue regarding -d argument of mob_typer.

To reproduce this error:
I installed mobsuite v 3.1.6 using

mamba create -c conda-forge -c bioconda -p /path/to/conda/mobsuite-conda mob_typer

and tried to run mob_typer specifying a different db-path which did not exist at this time. The reason is, that I would like to have the environment and the database on separate paths.
However, running this code produced a weird error message, telling me that -i and -o are invalid arguments.
mob_typer -i contigs.fa -o mobtyper_results.txt -d /db/mobsuite/typer

cmd-output:

2023-08-23 14:39:24,717 mob_suite.mob_typer INFO: Running Mob-typer version 3.1.6 [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/mob_typer.py:173]
2023-08-23 14:39:24,717 mob_suite.mob_typer INFO: Processing fasta file contigs.fa [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/mob_typer.py:175]
2023-08-23 14:39:24,718 mob_suite.mob_typer INFO: SUCCESS: Found program blastn at /path/to/conda/mobsuite-conda/bin/blastn [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/utils.py:592]
2023-08-23 14:39:24,718 mob_suite.mob_typer INFO: SUCCESS: Found program makeblastdb at /path/to/conda/mobsuite-conda/bin/makeblastdb [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/utils.py:592]
2023-08-23 14:39:24,718 mob_suite.mob_typer INFO: SUCCESS: Found program tblastn at /path/to/conda/mobsuite-conda/bin/tblastn [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/utils.py:592]
2023-08-23 14:39:24,718 mob_suite.mob_typer INFO: Warning! Needed database missing "/db/mobsuite/typer/rep.dna.fas" [in /path/to/conda/mobsuite-conda/lib/python3.8/site-packages/mob_suite/mob_typer.py:321]
usage: mob_typer [-h] [-d DATABASE_DIRECTORY] [-v] [-V]
mob_typer: error: unrecognized arguments: -i contigs.fa -o mobtyper_results.txt

I was puzzled by this message, but it seems that the usage printed is actually the one from mob_init. So apparently the parameters just get forwarded into mob_init, which couldn't handle these additional arguments.
The solution in my case was to just run mob_init -d /db/mobsuite/typer first and retried the mob_typer command, which ran to completion. However, due to the misleading usage-message I was very confused in the first place and thought I'd report this minor issue.

br
Patrick

@kbessonov1984
Copy link
Collaborator

Hi, looks like your database directory is missing the rep.dna.fas file or not initialized by mob_init -d <path to your external dir>. Also make sure your database external directory has all files downloaded and initialized by mob_init utility and the status.txt file is present.

def verify_init(logger, database_dir):

Also check these similar issues #121 and #7

Hope you will soon resolve your issue

@phyden
Copy link
Author

phyden commented Aug 24, 2023

Thanks for your quick response. I did manage to resolve the issue by running mob_init instead of blindly using mob_typer without pre-fetching the database.

But I wanted to communicate this issue because the fall-back solution of mob_typer calling mob_init fails because mob_init tries to again parse the commandline-args which are not recognized by this argparser (-i and -o)

You could resolve this by changing the way arguments are parsed in mob_init like in this SO-post:

args, unknown = parser.parse_known_args()

@kbessonov1984
Copy link
Collaborator

Fixed in release 3.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants