comparison shm_csr.py @ 40:ca2512e1e3ab draft

Uploaded
author davidvanzessen
date Thu, 29 Dec 2016 07:05:45 -0500
parents ce25fb581ca3
children 77a7ac76c7b9
comparison
equal deleted inserted replaced
39:a24f8c93583a 40:ca2512e1e3ab
36 mutationList = [] 36 mutationList = []
37 mutationListByID = {} 37 mutationListByID = {}
38 cdr1LengthDic = {} 38 cdr1LengthDic = {}
39 cdr2LengthDic = {} 39 cdr2LengthDic = {}
40 40
41 with open(infile, 'r') as i: 41 with open(infile, 'ru') as i:
42 for line in i: 42 for line in i:
43 if first: 43 if first:
44 linesplt = line.split("\t") 44 linesplt = line.split("\t")
45 IDIndex = linesplt.index("Sequence.ID") 45 IDIndex = linesplt.index("Sequence.ID")
46 best_matchIndex = linesplt.index("best_match") 46 best_matchIndex = linesplt.index("best_match")
78 cdr1LengthDic[ID] = int(cdr1Length) if cdr1Length != "X" else 0 78 cdr1LengthDic[ID] = int(cdr1Length) if cdr1Length != "X" else 0
79 cdr2LengthDic[ID] = int(cdr2Length) if cdr2Length != "X" else 0 79 cdr2LengthDic[ID] = int(cdr2Length) if cdr2Length != "X" else 0
80 80
81 IDlist += [ID] 81 IDlist += [ID]
82 82
83 print mutationList, linecount
84
83 AALength = (int(max(mutationList, key=lambda i: int(i[4]) if i[4] else 0)[4]) + 1) # [4] is the position of the AA mutation, None if silent 85 AALength = (int(max(mutationList, key=lambda i: int(i[4]) if i[4] else 0)[4]) + 1) # [4] is the position of the AA mutation, None if silent
84 if AALength < 60: 86 if AALength < 60:
85 AALength = 64 87 AALength = 64
86 88
87 AA_mutation = [0] * AALength 89 AA_mutation = [0] * AALength
171 ataIndex = 0 173 ataIndex = 0
172 tatIndex = 0 174 tatIndex = 0
173 aggctatIndex = 0 175 aggctatIndex = 0
174 atagcctIndex = 0 176 atagcctIndex = 0
175 first = True 177 first = True
176 with open(infile, 'r') as i: 178 with open(infile, 'ru') as i:
177 for line in i: 179 for line in i:
178 if first: 180 if first:
179 linesplt = line.split("\t") 181 linesplt = line.split("\t")
180 ataIndex = linesplt.index("X.a.t.a") 182 ataIndex = linesplt.index("X.a.t.a")
181 tatIndex = linesplt.index("t.a.t.") 183 tatIndex = linesplt.index("t.a.t.")