comparison completemask.py @ 4:78bbd17d0703 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 693df287d23b0fd9dfd134b41d401a438c3f5ad6"
author iuc
date Mon, 22 Jun 2020 07:31:22 -0400
parents
children
comparison
equal deleted inserted replaced
3:7f781286b55f 4:78bbd17d0703
1 #!/usr/bin/env python
2
3 import sys
4
5
6 if __name__ == '__main__':
7 with open(sys.argv[1]) as i:
8 getmasked_output = i.readline().strip()
9
10 if not getmasked_output:
11 print()
12 print('No affected primer binding sites found!')
13 else:
14 masked_primers = getmasked_output.split('\t')
15 with open(sys.argv[2]) as i:
16 amplicon_data = [line.strip().split('\t') for line in i]
17
18 masked_complete = []
19 for primer in masked_primers:
20 for amplicon in amplicon_data:
21 if primer in amplicon:
22 masked_complete += amplicon
23 result = '\t'.join(sorted(set(masked_complete)))
24 print()
25 print('Removing reads primed with any of:')
26 print(result)
27 with open(sys.argv[1], 'w') as o:
28 o.write(result + '\n')