Skip to content

Commit

Permalink
Handling and error msg for using gzipped fasta file and hmmsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
brymerr921 committed May 4, 2022
1 parent 1c16caa commit 4c63fa5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cblaster/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@


def find_sqlite_db(path):
sqlite_db = Path(path).with_suffix(".sqlite3")
sqlite_db = Path(path)
if sqlite_db.suffix == ".gz":
sqlite_db = sqlite_db.with_suffix("")
sqlite_db = sqlite_db.with_suffix(".sqlite3")
if not sqlite_db.exists():
LOG.error("Could not find matching SQlite3 database, exiting")
raise SystemExit
Expand Down
5 changes: 4 additions & 1 deletion cblaster/hmm_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def run_hmmsearch(fasta, query):
check=True,
)
except subprocess.CalledProcessError:
LOG.exception("hmmsearch failed!")
add_msg=""
if fasta.endswith("gz"):
add_msg = " Try running: \n gunzip {0} \nand then resubmit your cblaster command command, specifying:\n -db {1}.\n\n".format(fasta, fasta.replace(".gz",""))
LOG.exception("hmmsearch failed!"+add_msg)
return output


Expand Down

0 comments on commit 4c63fa5

Please sign in to comment.