-
Notifications
You must be signed in to change notification settings - Fork 3
/
graph_rloops.py
54 lines (49 loc) · 1.41 KB
/
graph_rloops.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
from __future__ import division
import sys
import time
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import scipy.stats as st
import numpy as np
import random
infile = open(sys.argv[1],'r')
infile2 = open(sys.argv[2],'r')
#variables
probability = []
energy = []
#process the model_infile (fixedStep)
lines = infile.readlines()
header = lines[1].strip().split()
print header[2]
start_loci = int(header[2].split(':')[1].split('-')[0])
#end_loci = int(header[2].split(':')[1].split('-')[1])
#read the fixedStep data
for item in lines[4:]:
probability.append(float(item))
#process the model_infile (fixedStep)
lines = infile2.readlines()
header = lines[1].strip().split()
print header[2]
start_loci = int(header[2].split(':')[1].split('-')[0])
#end_loci = int(header[2].split(':')[1].split('-')[1])
#read the fixedStep data
for item in lines[4:]:
energy.append(float(item))
#output both signals to a graph
with PdfPages(sys.argv[3]+'.pdf') as pdf:
#plt.xlim(-0.14,0.00)
plt.title('---')
plt.subplot(2,1,1)
plt.ylim(0,1)
plt.xlabel('Position (bp)')
plt.ylabel('P(x)')
plt.plot(xrange(len(probability)),probability)
plt.subplot(2,1,2)
plt.plot(xrange(len(energy)),energy)
plt.xlabel('Position (bp)')
plt.ylabel('Local Avg G(x)')
plt.subplots_adjust(top=0.92, bottom=0.1, left=0.10, right=0.95, hspace=0.25, wspace=1.8)
#plt.grid(which='both')
#plt.ylim((-0.01,1))
pdf.savefig()
plt.close()