rewrite of findall.py and MakeRdsFromBam to fix bugs resulting from poor initial...
[erange.git] / rnaAToIFilter.py
1 import sys
2
3
4 def main(argv=None):
5     if not argv:
6         argv = sys.argv
7
8     usage = "usage: python %s infile outfile" % sys.argv[0]
9
10     if len(argv) < 3:
11         print usage
12         sys.exit(1)
13
14     infile = open(argv[1])
15     outfile = open(argv[2], "w")
16
17     lines = infile.readlines()
18     outputLines = rnaAToIFilter(lines)
19
20     for line in outputLines:
21         outfile.write(line)
22
23     outfile.close()
24
25
26 def rnaAToIFilter(snpPropertiesList):
27     outputLines = []
28     for line in snpPropertiesList:
29         fields = line.split()
30         if fields[13] == "F" and fields[7] == "A-G":
31             outputLines.append(line)
32         elif fields[13] == "R" and fields[7] == "T-C":
33             outputLines.append(line)
34
35     return outputLines
36
37
38 if __name__ == '__main__':
39     pass