Mercurial > repos > davidvanzessen > mutation_analysis
comparison mutation_analysis.py @ 108:6add3e66f4fa draft
Uploaded
author | davidvanzessen |
---|---|
date | Wed, 13 Jul 2016 09:04:15 -0400 |
parents | 01c9993865af |
children | ade5cf6fd2dc |
comparison
equal
deleted
inserted
replaced
107:01c9993865af | 108:6add3e66f4fa |
---|---|
144 cdr2Length = cdr2LengthDic[ID] | 144 cdr2Length = cdr2LengthDic[ID] |
145 for c in absentAACDR2Dic[cdr2Length]: | 145 for c in absentAACDR2Dic[cdr2Length]: |
146 absentAAbyID[c] -= 1 | 146 absentAAbyID[c] -= 1 |
147 o.write(ID + "\t" + str(cdr1Length) + "\t" + str(cdr2Length) + "\t" + genedic[ID] + "\t" + "\t".join([str(x) for x in absentAAbyID]) + "\n") | 147 o.write(ID + "\t" + str(cdr1Length) + "\t" + str(cdr2Length) + "\t" + genedic[ID] + "\t" + "\t".join([str(x) for x in absentAAbyID]) + "\n") |
148 | 148 |
149 | |
150 | |
151 aa_mutations_file = outfile[:outfile.rindex("/")] + "/aa_mutations.txt" | |
152 with open(aa_mutations_file, 'w') as o: | |
153 o.write("row.name\t" + "\t".join([str(x) for x in range(1, AALength-1)]) + "\n") | |
154 o.write("mutations.at.position\t" + "\t".join([str(x) for x in AA_mutation[1:]]) + "\n") | |
155 o.write("AA.at.position\t" + "\t".join([str(x) for x in absentAA]) + "\n") | |
156 | |
157 | |
158 aa_mutations_file_ca = outfile[:outfile.rindex("/")] + "/aa_mutations_ca.txt" | |
159 with open(aa_mutations_file_ca, 'w') as o: | |
160 o.write("row.name\t" + "\t".join([str(x) for x in range(1, AALength-1)]) + "\n") | |
161 o.write("mutations.at.position\t" + "\t".join([str(x) for x in AA_mutation_dic["ca"][1:]]) + "\n") | |
162 o.write("AA.at.position\t" + "\t".join([str(x) for x in absentAA]) + "\n") | |
163 | |
164 | |
165 aa_mutations_file_cg = outfile[:outfile.rindex("/")] + "/aa_mutations_cg.txt" | |
166 with open(aa_mutations_file_cg, 'w') as o: | |
167 o.write("row.name\t" + "\t".join([str(x) for x in range(1, AALength-1)]) + "\n") | |
168 o.write("mutations.at.position\t" + "\t".join([str(x) for x in AA_mutation_dic["cg"][1:]]) + "\n") | |
169 o.write("AA.at.position\t" + "\t".join([str(x) for x in absentAA]) + "\n") | |
170 | |
171 | |
172 aa_mutations_file_cm = outfile[:outfile.rindex("/")] + "/aa_mutations_cm.txt" | |
173 with open(aa_mutations_file_cm, 'w') as o: | |
174 o.write("row.name\t" + "\t".join([str(x) for x in range(1, AALength-1)]) + "\n") | |
175 o.write("mutations.at.position\t" + "\t".join([str(x) for x in AA_mutation_dic["cg"][1:]]) + "\n") | |
176 o.write("AA.at.position\t" + "\t".join([str(x) for x in absentAA]) + "\n") | |
177 | |
178 if linecount == 0: | 149 if linecount == 0: |
179 print "No data, exiting" | 150 print "No data, exiting" |
180 with open(outfile, 'w') as o: | 151 with open(outfile, 'w') as o: |
181 o.write("RGYW (%)," + ("0,0,0\n" * len(genes))) | 152 o.write("RGYW (%)," + ("0,0,0\n" * len(genes))) |
182 o.write("WRCY (%)," + ("0,0,0\n" * len(genes))) | 153 o.write("WRCY (%)," + ("0,0,0\n" * len(genes))) |