aboutsummaryrefslogtreecommitdiff
path: root/src/remove_mers_from_file.py
blob: 3576e35a8df198b6812eb9db003a21497cfbe439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python2.7
import sys

if __name__ == "__main__":

	if len(sys.argv) is 1:
		exit("Filter mers, input is stdin, output is stdout, mers are argv")
	
	mers_to_delete = set()

	for mer in open(sys.argv[1], 'rU'):
		sp = mer.strip().split()
		if len(sp) == 2:
			mer = sp[0]
			mers_to_delete.add(mer)


	for line in sys.stdin:
		if line.split()[0] not in mers_to_delete:
			sys.stdout.write(line)