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

Print error even if blast error message does not match pattern #160

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

apetkau
Copy link
Member

@apetkau apetkau commented Oct 26, 2022

Fix for #155

Error message

  File "/usr/local/tools/_conda/envs/__staramr@0.7.2/lib/python3.7/site-packages/staramr/blast/JobHandler.py", line 289, in _make_blast_db
    err_msg = re.findall('REF\|(.*?)\'', err_msg)[0]
IndexError: list index out of range

Cause

While we weren't able to reproduce the issue, the error itself is triggered because we are parsing the output of makeblastdb and searching for particular patterns to extract an appropriate error message (re.findall('REF\|(.*?)\''). Perhaps either STDERR of makeblastdb was empty for the above issue, or different versions of blast print different messages. See below code

except subprocess.CalledProcessError as e:
err_msg = str(e.stderr.strip())
err_msg = re.findall('REF\|(.*?)\'', err_msg)[0]
raise Exception('Could not run makeblastdb on file {}, error {}'.format(file, err_msg))

Solution

The fix works by defaulting to just printing the full STDERR of makeblastdb if we can't pull out a more specific error message (rather than crashing).

@apetkau apetkau merged commit 4e2e245 into development Oct 26, 2022
@apetkau apetkau deleted the fix/blast-error-message branch October 26, 2022 21:24
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

Successfully merging this pull request may close these issues.

2 participants