# HG changeset patch # User davidvanzessen # Date 1512636278 18000 # Node ID 43a1aa648537827ab031b667d2ade4ec8b4fc7a0 # Parent dc06e94bc1e34b4ef32df6872d6345c09bf83355 Uploaded diff -r dc06e94bc1e3 -r 43a1aa648537 shm_csr.py --- a/shm_csr.py Wed Dec 06 09:55:37 2017 -0500 +++ b/shm_csr.py Thu Dec 07 03:44:38 2017 -0500 @@ -249,16 +249,22 @@ AA_mutation_dic = {"IGA": AA_mutation[:], "IGG": AA_mutation[:], "IGM": AA_mutation[:], "IGE": AA_mutation[:], "unm": AA_mutation[:], "all": AA_mutation[:]} AA_mutation_empty = AA_mutation[:] + print "AALength:", AALength aa_mutations_by_id_file = outfile[:outfile.rindex("/")] + "/aa_id_mutations.txt" with open(aa_mutations_by_id_file, 'w') as o: o.write("ID\tbest_match\t" + "\t".join([str(x) for x in range(1,AALength)]) + "\n") for ID in mutationListByID.keys(): AA_mutation_for_ID = AA_mutation_empty[:] for mutation in mutationListByID[ID]: - if mutation[4]: + if mutation[4] and mutation[5] != ";": AA_mutation_position = int(mutation[4]) - AA_mutation[AA_mutation_position] += 1 - AA_mutation_for_ID[AA_mutation_position] += 1 + try: + AA_mutation[AA_mutation_position] += 1 + AA_mutation_for_ID[AA_mutation_position] += 1 + except Exception as e: + print e + print mutation + sys.exit() clss = genedic[ID][:3] AA_mutation_dic[clss][AA_mutation_position] += 1 o.write(ID + "\t" + genedic[ID] + "\t" + "\t".join([str(x) for x in AA_mutation_for_ID[1:]]) + "\n")