comparison stderr_filter.py @ 0:f6ebec6e235e draft

Uploaded
author petrn
date Thu, 19 Dec 2019 13:46:43 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f6ebec6e235e
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)