Mercurial > repos > tyty > structurefold
annotate predict/rtts_plot.py @ 67:96a827962750 draft
Uploaded updated scripts, removed *.pyc and .DS_Store
author | devteam |
---|---|
date | Fri, 21 Nov 2014 11:28:59 -0500 |
parents | afd114ef8857 |
children |
rev | line source |
---|---|
59 | 1 #!/usr/bin/env python |
2 #Make a plot of reactivity distribution | |
3 | |
4 import sys | |
67
96a827962750
Uploaded updated scripts, removed *.pyc and .DS_Store
devteam
parents:
59
diff
changeset
|
5 import os |
59 | 6 import numpy as np |
7 import matplotlib | |
8 from pylab import * | |
9 import math | |
10 | |
11 #Convert the reactivities (Make NA to 0) | |
12 def convert_react(a): | |
13 r = [] | |
14 for i in range(len(a)): | |
15 if a[i]!='NA': | |
16 r.append(float(a[i])) | |
17 else: | |
18 r.append(float(0)) | |
19 return r | |
20 | |
21 | |
22 #Make a plot of the distribution | |
23 def make_plot(ar,id_s,path): | |
24 N = len(ar) | |
25 a = convert_react(ar) | |
26 w = 1 | |
27 ind = np.arange(N) | |
28 | |
29 fig = figure() | |
30 fig, ax = subplots() | |
31 ax.bar(ind+w, a, width = w, color = 'r',edgecolor = 'r') | |
32 ax.set_ylabel('Structural Reactivity') | |
33 ax.set_xlabel('Nucleotide Index') | |
34 | |
35 | |
36 mag = int(math.log(N,10))-1 | |
37 tail = 10**mag | |
38 | |
39 intervel = int(math.ceil(float(N)/tail/5)) | |
40 print(N) | |
41 print(intervel) | |
42 tl = [] | |
43 k = 0 | |
44 upmax = int(math.ceil(float(N)/intervel/tail)*intervel*tail)+1 | |
45 ax.set_xticks(np.arange(0,upmax,intervel*tail)) | |
46 print(np.arange(0,upmax,intervel*tail)) | |
47 ax.set_xticklabels(np.arange(0,upmax,intervel*tail)) | |
48 | |
49 ax.set_title(id_s+" reactivity distribution") | |
67
96a827962750
Uploaded updated scripts, removed *.pyc and .DS_Store
devteam
parents:
59
diff
changeset
|
50 savefig(os.path.join(path, id_s+'.tif')) |
59 | 51 |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 |