comparison mirbase_graphs.py @ 19:3dd4977f3277 draft

Uploaded
author glogobyte
date Wed, 20 Oct 2021 10:01:21 +0000
parents fa48ad87ae3e
children 958330b9bce3
comparison
equal deleted inserted replaced
18:01679b6e886a 19:3dd4977f3277
79 if f==0: 79 if f==0:
80 t_templ+=1 80 t_templ+=1
81 t_tem_counts += x[2] 81 t_tem_counts += x[2]
82 82
83 fig = plt.figure(figsize=(7,5)) 83 fig = plt.figure(figsize=(7,5))
84 labels = 'miRNA RefSeq','template', 'unassigned','non-template' 84 labels = 'miRNA RefSeq','templated', 'unassigned','non-templated'
85 sizes = [c_mat_counts, c_tem_counts, c_unmap_counts,c_non_counts] 85 sizes = [c_mat_counts, c_tem_counts, c_unmap_counts,c_non_counts]
86 colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue'] 86 colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue']
87 ax1 = plt.subplot2grid((1,2),(0,0)) 87 ax1 = plt.subplot2grid((1,2),(0,0))
88 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8) 88 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8)
89 [x.set_fontsize(10) for x in texts] 89 [x.set_fontsize(10) for x in texts]
90 plt.title(group_name1.capitalize() + ' Group (reads)',fontsize=12) 90 plt.title(group_name1.capitalize() + ' group (reads)',fontsize=12)
91 labels = 'miRNA RefSeq','Template', 'Unassigned','non-template' 91 labels = 'miRNA RefSeq','templated', 'Unassigned','non-templated'
92 sizes = [t_mat_counts, t_tem_counts, t_unmap_counts, t_non_counts] 92 sizes = [t_mat_counts, t_tem_counts, t_unmap_counts, t_non_counts]
93 colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue'] 93 colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue']
94 ax2 = plt.subplot2grid((1,2),(0,1)) 94 ax2 = plt.subplot2grid((1,2),(0,1))
95 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8) 95 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8)
96 [x.set_fontsize(10) for x in texts] 96 [x.set_fontsize(10) for x in texts]
97 plt.title(group_name2.capitalize() + ' Group (reads)', fontsize=12) 97 plt.title(group_name2.capitalize() + ' group (reads)', fontsize=12)
98 plt.savefig('pie_non.png',dpi=300) 98 plt.savefig('pie_non.png',dpi=300)
99 99
100 ###################################################################################################################################################### 100 ######################################################################################################################################################
101 101
102 102
156 t_templ+=1 156 t_templ+=1
157 t_tem_counts += x[2] 157 t_tem_counts += x[2]
158 158
159 159
160 fig = plt.figure() 160 fig = plt.figure()
161 labels = 'miRNA RefSeq','template', 'unassigned' 161 labels = 'miRNA RefSeq','templated', 'unassigned'
162 sizes = [c_mat_counts, c_tem_counts, c_unmap_counts] 162 sizes = [c_mat_counts, c_tem_counts, c_unmap_counts]
163 colors = ['gold', 'yellowgreen', 'lightskyblue'] 163 colors = ['gold', 'yellowgreen', 'lightskyblue']
164 explode = (0.2, 0.05, 0.1) 164 explode = (0.2, 0.05, 0.1)
165 ax1 = plt.subplot2grid((1,2),(0,0)) 165 ax1 = plt.subplot2grid((1,2),(0,0))
166 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8) 166 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8)
167 [x.set_fontsize(10) for x in texts] 167 [x.set_fontsize(10) for x in texts]
168 plt.title(group_name1.capitalize() + ' group (reads)', fontsize=12) 168 plt.title(group_name1.capitalize() + ' group (reads)', fontsize=12)
169 labels = 'miRNA RefSeq','Template', 'Unassigned' 169 labels = 'miRNA RefSeq','templated', 'unassigned'
170 sizes = [t_mat_counts, t_tem_counts, t_unmap_counts] 170 sizes = [t_mat_counts, t_tem_counts, t_unmap_counts]
171 colors = ['gold', 'yellowgreen', 'lightskyblue'] 171 colors = ['gold', 'yellowgreen', 'lightskyblue']
172 explode = (0.2, 0.05, 0.1) 172 explode = (0.2, 0.05, 0.1)
173 ax2 = plt.subplot2grid((1,2),(0,1)) 173 ax2 = plt.subplot2grid((1,2),(0,1))
174 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8) 174 patches, texts, autotexts=plt.pie(sizes, labels=labels, colors=colors, startangle=140,autopct='%1.1f%%',radius=0.8)
452 ################################################################################################################# 452 #################################################################################################################
453 453
454 def logo_seq_red(merge, flag, group_name): 454 def logo_seq_red(merge, flag, group_name):
455 455
456 if flag=="c": 456 if flag=="c":
457 titlos= group_name + " group (redundant)" 457 titlos= group_name.capitalize() + " group (redundant)"
458 file_logo="c_logo.png" 458 file_logo="c_logo.png"
459 file_bar="c_bar.png" 459 file_bar="c_bar.png"
460 if flag=="t": 460 if flag=="t":
461 titlos= group_name + " group (redundant)" 461 titlos= group_name.capitalize() + " group (redundant)"
462 file_logo="t_logo.png" 462 file_logo="t_logo.png"
463 file_bar="t_bar.png" 463 file_bar="t_bar.png"
464 464
465 c_samples=[[x[0],x[1],sum(int(i) for i in x[2:])] for x in merge] 465 c_samples=[[x[0],x[1],sum(int(i) for i in x[2:])] for x in merge]
466 466