diff --git a/bifrost_chewbbaca/rule__blast_genecall.py b/bifrost_chewbbaca/rule__blast_genecall.py index 4e9d6e6..668b096 100755 --- a/bifrost_chewbbaca/rule__blast_genecall.py +++ b/bifrost_chewbbaca/rule__blast_genecall.py @@ -34,7 +34,10 @@ def run_blastn_and_parse(query_fa, db, assembly_sequences,log): # Run BLASTN and stream output with subprocess.Popen(blastn_cmd, stdout=subprocess.PIPE, text=True, stderr=open(log.err_file, "w+")) as proc: - for line in proc.stdout: + stdout = proc.communicate() + if proc.returncode != 0: + raise RuntimeError(f"Command {" ".join(blastn_cmd)} failed with code {proc.returncode}.\nCheck the logs in {log.err_file}") + for line in stdout: # Parse the BLAST output line into a dictionary cols = line.strip().split("\t") record = {