Mercurial > repos > petrn > repeatexplorer
diff stderr_filter.py @ 8:3bc73f5dc785 draft
Uploaded
author | petrn |
---|---|
date | Fri, 20 Dec 2019 14:17:59 +0000 |
parents | f6ebec6e235e |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stderr_filter.py Fri Dec 20 14:17:59 2019 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +''' +Purpose of this script is to filters some massages output +stderr to prevent galaxy to raise the error +''' +import sys + +string_to_detect = [ + 'Karlin-Altschul parameters', + 'slippage may introduce errors', + 'Examining 5 or more matches is recommended', + 'DeprecationWarning: The binary mode of fromstring is deprecated', +] + +string_to_remove = [ + ('error', 'errour'), + ('warning', 'alert') +] +input_file = sys.argv[1] + +with open(input_file) as f: + for line in f: + for s in string_to_detect: + if s in line: + new_line = "--" + line.lower() + for r in string_to_remove: + new_line = new_line.replace(r[0], r[1]) + line = new_line + print("parsed line:", line, file=sys.stderr)