Mercurial > repos > davidvanzessen > shm_csr
comparison shm_csr.py @ 66:43a1aa648537 draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 07 Dec 2017 03:44:38 -0500 |
parents | 8728284105ee |
children |
comparison
equal
deleted
inserted
replaced
65:dc06e94bc1e3 | 66:43a1aa648537 |
---|---|
247 | 247 |
248 AA_mutation = [0] * AALength | 248 AA_mutation = [0] * AALength |
249 AA_mutation_dic = {"IGA": AA_mutation[:], "IGG": AA_mutation[:], "IGM": AA_mutation[:], "IGE": AA_mutation[:], "unm": AA_mutation[:], "all": AA_mutation[:]} | 249 AA_mutation_dic = {"IGA": AA_mutation[:], "IGG": AA_mutation[:], "IGM": AA_mutation[:], "IGE": AA_mutation[:], "unm": AA_mutation[:], "all": AA_mutation[:]} |
250 AA_mutation_empty = AA_mutation[:] | 250 AA_mutation_empty = AA_mutation[:] |
251 | 251 |
252 print "AALength:", AALength | |
252 aa_mutations_by_id_file = outfile[:outfile.rindex("/")] + "/aa_id_mutations.txt" | 253 aa_mutations_by_id_file = outfile[:outfile.rindex("/")] + "/aa_id_mutations.txt" |
253 with open(aa_mutations_by_id_file, 'w') as o: | 254 with open(aa_mutations_by_id_file, 'w') as o: |
254 o.write("ID\tbest_match\t" + "\t".join([str(x) for x in range(1,AALength)]) + "\n") | 255 o.write("ID\tbest_match\t" + "\t".join([str(x) for x in range(1,AALength)]) + "\n") |
255 for ID in mutationListByID.keys(): | 256 for ID in mutationListByID.keys(): |
256 AA_mutation_for_ID = AA_mutation_empty[:] | 257 AA_mutation_for_ID = AA_mutation_empty[:] |
257 for mutation in mutationListByID[ID]: | 258 for mutation in mutationListByID[ID]: |
258 if mutation[4]: | 259 if mutation[4] and mutation[5] != ";": |
259 AA_mutation_position = int(mutation[4]) | 260 AA_mutation_position = int(mutation[4]) |
260 AA_mutation[AA_mutation_position] += 1 | 261 try: |
261 AA_mutation_for_ID[AA_mutation_position] += 1 | 262 AA_mutation[AA_mutation_position] += 1 |
263 AA_mutation_for_ID[AA_mutation_position] += 1 | |
264 except Exception as e: | |
265 print e | |
266 print mutation | |
267 sys.exit() | |
262 clss = genedic[ID][:3] | 268 clss = genedic[ID][:3] |
263 AA_mutation_dic[clss][AA_mutation_position] += 1 | 269 AA_mutation_dic[clss][AA_mutation_position] += 1 |
264 o.write(ID + "\t" + genedic[ID] + "\t" + "\t".join([str(x) for x in AA_mutation_for_ID[1:]]) + "\n") | 270 o.write(ID + "\t" + genedic[ID] + "\t" + "\t".join([str(x) for x in AA_mutation_for_ID[1:]]) + "\n") |
265 | 271 |
266 | 272 |