0
|
1 #!/usr/bin/env python
|
|
2
|
|
3 import sys
|
|
4 import argparse as ap
|
|
5 import re
|
|
6 parser = ap.ArgumentParser(prog='kwip_postprocess', conflict_handler='resolve',
|
|
7 description="Postprocess galaxy kWIP output")
|
|
8
|
|
9 input = parser.add_argument_group('Input', '')
|
|
10 input.add_argument('-i', '--input', nargs=1, required=True, help="kWIP galaxy OUTPUT")
|
|
11
|
|
12
|
|
13 if len(sys.argv) == 0:
|
|
14 parser.print_usage()
|
|
15 sys.exit(1)
|
|
16
|
|
17 args = parser.parse_args()
|
|
18
|
|
19
|
|
20 with open(args.input[0]) as kwip_output:
|
|
21 with open('kwip_postprocess_output.txt', 'w') as output:
|
|
22 for line in kwip_output:
|
|
23 new_line = re.sub('(_1.fastq(.gz)*|_2.fastq(.gz)*|.fastq(.gz)*)', '', line)
|
|
24 output.write(new_line)
|
|
25
|
|
26
|
|
27
|