Mercurial > repos > petrn > repeatexplorer
comparison stderr_filter.py @ 8:3bc73f5dc785 draft
Uploaded
| author | petrn |
|---|---|
| date | Fri, 20 Dec 2019 14:17:59 +0000 |
| parents | f6ebec6e235e |
| children |
comparison
equal
deleted
inserted
replaced
| 7:c56807be3b72 | 8:3bc73f5dc785 |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 ''' | |
| 3 Purpose of this script is to filters some massages output | |
| 4 stderr to prevent galaxy to raise the error | |
| 5 ''' | |
| 6 import sys | |
| 7 | |
| 8 string_to_detect = [ | |
| 9 'Karlin-Altschul parameters', | |
| 10 'slippage may introduce errors', | |
| 11 'Examining 5 or more matches is recommended', | |
| 12 'DeprecationWarning: The binary mode of fromstring is deprecated', | |
| 13 ] | |
| 14 | |
| 15 string_to_remove = [ | |
| 16 ('error', 'errour'), | |
| 17 ('warning', 'alert') | |
| 18 ] | |
| 19 input_file = sys.argv[1] | |
| 20 | |
| 21 with open(input_file) as f: | |
| 22 for line in f: | |
| 23 for s in string_to_detect: | |
| 24 if s in line: | |
| 25 new_line = "--" + line.lower() | |
| 26 for r in string_to_remove: | |
| 27 new_line = new_line.replace(r[0], r[1]) | |
| 28 line = new_line | |
| 29 print("parsed line:", line, file=sys.stderr) |
