|
17 | 17 |
|
18 | 18 | import sys |
19 | 19 | import os |
| 20 | +import subprocess |
20 | 21 | from pathlib import Path |
21 | 22 | from Bio import SeqIO |
22 | | -from Bio.Blast.Applications import NcbiblastpCommandline |
23 | 23 | from ete3 import NCBITaxa |
24 | 24 |
|
25 | 25 | import fdog.libs.zzz as general_fn |
@@ -107,17 +107,15 @@ def check_input(args): |
107 | 107 |
|
108 | 108 | def check_blast_version(corepath, refspec): |
109 | 109 | """ Check if blast DBs in corepath is compatible with blastp version """ |
110 | | - fdog_path = os.path.realpath(__file__).replace('/libs/preparation.py','') |
111 | | - query = fdog_path + '/data/infile.fa' |
112 | | - blast_db = '%s/%s/%s' % (corepath, refspec, refspec) |
| 110 | + fdog_path = os.path.realpath(__file__).replace('/libs/preparation.py', '') |
| 111 | + query = os.path.join(fdog_path, 'data', 'infile.fa') |
| 112 | + blast_db = os.path.join(corepath, refspec, refspec) |
113 | 113 | try: |
114 | | - blastp_cline = NcbiblastpCommandline( |
115 | | - query = query, db = blast_db) |
116 | | - stdout, stderr = blastp_cline() |
117 | | - except: |
118 | | - sys.exit( |
119 | | - 'ERROR: Error running blast (probably conflict with BLAST DBs versions)\n%s' |
120 | | - % (NcbiblastpCommandline(query = query, db = blast_db))) |
| 114 | + cmd = ["blastp", "-query", query, "-db", blast_db] |
| 115 | + result = subprocess.run(cmd, capture_output=True, text=True, check=True) |
| 116 | + except subprocess.CalledProcessError as e: |
| 117 | + sys.exit(f"ERROR: Error running BLAST (probably conflict with BLAST DB versions)\n{e.stderr}") |
| 118 | + |
121 | 119 |
|
122 | 120 | def check_ranks_core_taxa(corepath, refspec, minDist, maxDist): |
123 | 121 | """ Check if refspec (or all core taxa) have a valid minDist and maxDist tax ID |
|
0 commit comments