-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-graph.py
63 lines (55 loc) · 1.48 KB
/
1-graph.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
60
61
62
63
#!/usr/bin/python
import os
import matplotlib
matplotlib.use('Agg')
import pylab
from math import log10
l = []
x = []
y = []
w = []
j = 0
for file in os.listdir('.'): #for each file in this directory
if file.endswith("enr.dud"):
k= open(file)
for line in k:
l.append('empty')
x.append('empty')
y.append('empty')
w.append('empty')
l[j] = line.split(None,2)
x[j] = l[j][0]
y[j] = l[j][1]
if x[j] is "empty":
pass
else:
if float(x[j]) < 0.01:
w[j] = log10(0.01)
pass
else:
w[j] = log10(float(x[j]))
#print w[j]
j = j+1
for file in os.listdir('.'): #for each file in this directory
if file.endswith(".dat"):
p= open(file)
for line in p:
a = line.split(None,4)
pylab.figure(1, figsize=(10,20))
pylab.subplot(211)
#pylab.xlabel('% of ranked database')
#pylab.ylabel('% of known ligands found')
pylab.plot(x, y, color='darkviolet', linewidth=2, label='Model')
pylab.plot(x, x, color='slategray', linewidth=2, label='Random', linestyle='--')
#pylab.legend(loc=2)
pylab.text(80, 2, a[0]+' '+a[1], fontsize=14)
pylab.savefig('enrichment_profile.png', dpi=300)
pylab.subplot(212)
#pylab.xlabel('% of ranked database')
#pylab.ylabel('% of known ligands found')
pylab.plot(x, y, color='darkviolet', linewidth=2, label='Model')
pylab.plot(x, x, color='slategray', linewidth=2, label='Random', linestyle='--')
pylab.xscale('log')
#pylab.legend(loc=2)
pylab.text(10.5, 2, a[2]+' '+a[3], fontsize=14)
pylab.savefig('enrichment_profile.png', dpi=300)