comparison mutation_analysis.py @ 85:07f7da724a77 draft

Uploaded
author davidvanzessen
date Thu, 26 May 2016 08:18:13 -0400
parents b523ce95d857
children 5ffbf40cdd4b
comparison
equal deleted inserted replaced
84:041f94f50b34 85:07f7da724a77
47 fr1Index = linesplt.index("FR1.IMGT") 47 fr1Index = linesplt.index("FR1.IMGT")
48 cdr1Index = linesplt.index("CDR1.IMGT") 48 cdr1Index = linesplt.index("CDR1.IMGT")
49 fr2Index = linesplt.index("FR2.IMGT") 49 fr2Index = linesplt.index("FR2.IMGT")
50 cdr2Index = linesplt.index("CDR2.IMGT") 50 cdr2Index = linesplt.index("CDR2.IMGT")
51 fr3Index = linesplt.index("FR3.IMGT") 51 fr3Index = linesplt.index("FR3.IMGT")
52 cdr1LengthIndex = linesplt.index("CDR1.IMGT.Nb.of.nucleotides") 52 cdr1LengthIndex = linesplt.index("CDR1.IMGT.length")
53 cdr2LengthIndex = linesplt.index("CDR2.IMGT.Nb.of.nucleotides") 53 cdr2LengthIndex = linesplt.index("CDR2.IMGT.length")
54 first = False 54 first = False
55 continue 55 continue
56 linecount += 1 56 linecount += 1
57 linesplt = line.split("\t") 57 linesplt = line.split("\t")
58 ID = linesplt[IDIndex] 58 ID = linesplt[IDIndex]
71 mutationListByID[ID] = mutationdic[ID + "_FR1"] + mutationdic[ID + "_CDR1"] + mutationdic[ID + "_FR2"] + mutationdic[ID + "_CDR2"] + mutationdic[ID + "_FR3"] 71 mutationListByID[ID] = mutationdic[ID + "_FR1"] + mutationdic[ID + "_CDR1"] + mutationdic[ID + "_FR2"] + mutationdic[ID + "_CDR2"] + mutationdic[ID + "_FR3"]
72 72
73 cdr1Length = linesplt[cdr1LengthIndex] 73 cdr1Length = linesplt[cdr1LengthIndex]
74 cdr2Length = linesplt[cdr2LengthIndex] 74 cdr2Length = linesplt[cdr2LengthIndex]
75 75
76 cdr1LengthDic[ID] = int(cdr1Length) / 3 76 cdr1LengthDic[ID] = int(cdr1Length) if cdr1Length != "X" else 0
77 cdr2LengthDic[ID] = int(cdr2Length) / 3 77 cdr2LengthDic[ID] = int(cdr2Length) if cdr2Length != "X" else 0
78 78
79 IDlist += [ID] 79 IDlist += [ID]
80 80
81 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 81 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
82 82
83 AA_mutation = [0] * AALength 83 AA_mutation = [0] * AALength