dc9155afe40ba3849ca54140789a925e3dcfdd77
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
5 import cPickle
6 import sys
8 filename = sys.argv[1]
12 correct = {}
13 off = {}
14 wrong = {}
16 split_count = [0]*36
18 for elem in predict:
19 current_elem = elem['realRestPos']
21 split_count[current_elem] += 1
23 if len(elem['predExons']) != 4:
25 try:
26 wrong[current_elem] += 1
27 except:
28 wrong[current_elem] = 1
30 else:
31 e1b = elem['e1_b_off']
32 e1e = elem['e1_e_off']
33 e2b = elem['e2_b_off']
34 e2e = elem['e2_e_off']
36 if e1b == 0 and e1e == 0 and e2b == 0 and e2e == 0:
37 try:
38 correct[current_elem] += 1
39 except:
40 correct[current_elem] = 1
42 if not (e1b == 0 and e1e == 0 and e2b == 0 and e2e == 0):
43 try:
44 off[current_elem] += 1
45 except:
46 off[current_elem] = 1
48 import pylab
50 print split_count
52 y_values = []
53 for overlap in range(36):
54 result = 0
55 try:
56 cv = off[overlap]
57 except:
58 cv = 0
60 result += cv
62 try:
63 cv = wrong[overlap]
64 except:
65 cv = 0
67 result += cv
69 if split_count[overlap] > 0:
70 result = result/(1.0*split_count[overlap])
71 else:
72 result = 0
74 y_values.append(result)
76 outfile = filename.replace('_allPredictions','')
78 import numpy
79 import pylab
80 pylab.bar(range(36),y_values,width=0.2,align='center')
81 pylab.xticks( numpy.arange(0,36,1) )
82 pylab.savefig('%s_error_vs_overlap.eps'%outfile)
83 pylab.clf()
84 #raw_input()