comparison script_imgt.py @ 5:d8de51314d3f draft

Uploaded
author davidvanzessen
date Thu, 14 Aug 2014 07:17:26 -0400
parents 94fada165724
children 7eeb7b808af9
comparison
equal deleted inserted replaced
4:1726dc8f3e0a 5:d8de51314d3f
12 12
13 refdic = dict() 13 refdic = dict()
14 with open(args.ref, 'r') as ref: 14 with open(args.ref, 'r') as ref:
15 currentSeq = "" 15 currentSeq = ""
16 currentId = "" 16 currentId = ""
17 for line in ref.readlines(): 17 for line in ref:
18 if line[0] is ">": 18 if line[0] is ">":
19 if currentSeq is not "" and currentId is not "": 19 if currentSeq is not "" and currentId is not "":
20 refdic[currentId[1:]] = currentSeq 20 refdic[currentId[1:]] = currentSeq
21 currentId = line.rstrip() 21 currentId = line.rstrip()
22 currentSeq = "" 22 currentSeq = ""
46 46
47 47
48 48
49 currentSeq = "" 49 currentSeq = ""
50 currentId = "" 50 currentId = ""
51 first=True
51 with open(args.input, 'r') as i: 52 with open(args.input, 'r') as i:
52 with open(args.output, 'a') as o: 53 with open(args.output, 'a') as o:
53 o.write(">>>" + args.id + "\n") 54 o.write(">>>" + args.id + "\n")
54 outputdic = dict() 55 outputdic = dict()
55 for line in i.readlines()[1:]: 56 for line in i:
57 if first:
58 first = False
59 continue
56 linesplt = line.split("\t") 60 linesplt = line.split("\t")
57 ref = filterGene(linesplt[1], vPattern) 61 ref = filterGene(linesplt[1], vPattern)
58 if not ref or not linesplt[2].rstrip(): 62 if not ref or not linesplt[2].rstrip():
59 continue 63 continue
60 if ref in outputdic: 64 if ref in outputdic: