-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot.py
67 lines (50 loc) · 1.23 KB
/
plot.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
64
65
66
import matplotlib.pyplot as plt
import sys
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
from time import time,ctime
plt.rc('xtick', labelsize=10)
plt.rc('ytick', labelsize=10)
font = {'family' : 'sans-serif',
'weight' : 'normal',
'size' : 15}
plt.rc('font', **font)
print ' Python plotting...'
pos=[]
ins=[]
nins=[]
file_name = sys.argv[1]
chromosome = sys.argv[2]
fp = open(file_name, 'r')
for line in fp:
col= line.split()
pos.append(float(col[1]))
ins.append(float(col[2]))
nins.append(float(col[3]))
fp.close()
x = np.array(pos)
y = np.array(ins)
ny= np.array(nins)
myfig = PdfPages(chromosome + '.pdf')
fig = plt.figure(figsize=(13,6.5))
# change hor scale to include all genome length?
fig.add_subplot(1,2,1)
plt.ylabel('Insert Size')
plt.xlabel('Position on Chromosome '+ chromosome)
#text(x, y, s, fontsize=12)
plt.plot(x,y,'ro')
plt.axhline(y=0)
plt.tight_layout()
#plt.show()
fig.add_subplot(1,2,2)
plt.ylim((-1,1))
plt.ylabel('Normalized Insert Size')
plt.xlabel('Position on Chromosome '+ chromosome)
#text(x, y, s, fontsize=12)
plt.plot(x,ny,'ro')
plt.axhline(y=0)
plt.tight_layout()
plt.show()
#myfig = PdfPages(chromosome + '.pdf')
myfig.savefig(fig)
myfig.close()