-
Notifications
You must be signed in to change notification settings - Fork 3
/
lincRNA_fig.py
59 lines (44 loc) · 1.12 KB
/
lincRNA_fig.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/python
import sys
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
file1 = open(sys.argv[1])
file2 = open(sys.argv[2])
file3 = open(sys.argv[3])
all = []
count_1 = 0
count_2 = 0
count_3 = 0
for line in file1:
line = line.strip()
if line.startswith(">"):
count_1 += 1
all.append(count_1)
for line in file2:
line = line.strip()
if line.startswith(">"):
if re.search("CAGE_PLUS", line):
count_2 += 1
all.append(count_2)
for line in file3:
line = line.strip()
if line.startswith(">"):
if re.search("known", line):
count_3 += 1
all.append(count_3)
labels = ["All lincRNA", "CAGE lincRNA", "Known lincRNA"]
sizes = all
colors = ['yellowgreen', 'mediumpurple', 'lightskyblue']
explode = [0, 0.1, 0.1]
plt.pie(sizes, # data
explode=explode,
labels=labels, # slice labels
colors=colors, # array of colours
autopct='%1.1f%%', # print the values inside the wedges
shadow=True,
startangle=90
)
plt.axis('equal')
plt.savefig('lincRNA_piechart')