Mercurial > repos > davidvanzessen > shm_csr
changeset 66:43a1aa648537 draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 07 Dec 2017 03:44:38 -0500 |
parents | dc06e94bc1e3 |
children | ba33b94637ca |
files | shm_csr.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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")