comparison test-data/archaea_relplot.scr @ 0:008f5c13670e draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/locarna commit 1d1d9aac8cb96d043be07f2e4059baa3b05c2afc
author bgruening
date Wed, 28 Dec 2016 18:47:18 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:008f5c13670e
1 pdf("/tmp/tmp5yxSuG/files/000/dataset_2.dat",width=12,height=4,version="1.4")
2
3 rel <- read.table("mlocarna_results/results/result.bmreliability");
4 seqrel <- rel[[2]]
5 strrel <- rel[[3]]
6
7 if ("" != "") {
8 seq <- ""
9 seq <- strsplit(seq,split="")
10 tab <- unlist(seq)!="-"
11
12 seqrel<-seqrel[tab]
13 strrel<-strrel[tab]
14 }
15
16 len<-length(seqrel)
17
18 if (0) {
19 seqrel<-seqrel[len:1]
20 strrel<-strrel[len:1]
21 }
22
23
24
25 if (1) {
26 seqrel <- seqrel/1.0
27 }
28
29
30 totalrel <- seqrel+strrel;
31
32 anno_space<-0.075
33
34 maxy <- max(c(1,totalrel))+anno_space*(0+1);
35
36
37 firstpos <- 1
38 lastpos <- 1+len-1
39
40 if (0) {
41 the_xlim <- c(lastpos,firstpos)
42 } else {
43 the_xlim <- c(firstpos,lastpos)
44 }
45
46 # set margin
47 # b, l, t, r
48 par(mar=c(6,2.5,1,1))
49
50 # open plot (and draw threshold)
51 plot(c(0),c(0),type="l",
52 xlab="",ylab="",
53 xlim=the_xlim,ylim=c(0,maxy),
54 yaxp=c(0,1,2))
55
56 ## title inside of plot
57 legend("topleft","",bty="n")
58
59
60 # total reliability
61 polygon(c(firstpos,firstpos:lastpos,lastpos),c(0,totalrel,0),col=rgb(0.8,0.8,0.9,0.5),lwd=2,border=FALSE)
62 lines(firstpos:lastpos,totalrel,col="blue",lwd=2)
63
64 # plot structure reliability
65 polygon(c(firstpos,firstpos:lastpos,lastpos),c(0,strrel,0),col=rgb(0.3,0.3,0.5,0.8),lwd=1,border=FALSE)
66
67
68 ## draw other signals
69 signals<-c();
70 signal_sizes<-c();
71
72 signal_starts <- 1:0
73
74 signal_starts[1]<-1;
75 if (0>1) {
76 for (i in 2:0) {
77 signal_starts[i]<-signal_starts[i-1]+signal_sizes[i-1]*2+1;
78 }
79 }
80
81 colors <- c(
82 rgb(0.6,0.1,0.1,0.9),
83 rgb(0.6,0.6,0.1,0.9),
84 rgb(0.1,0.6,0.6,0.9),
85 rgb(0.6,0.1,0.6,0.9)
86 );
87 colors<-c(colors,colors);
88
89 if (0>0) {
90
91 for (i in 1:0) {
92 orientation <- signals[signal_starts[i]+signal_sizes[i]*2];
93 sig_y <- maxy-i*anno_space;
94
95 for (j in 0:(signal_sizes[i]-1)) {
96
97 sig_x <- c(signals[signal_starts[i]+j*2],signals[signal_starts[i]+j*2+1]);
98
99 ## draw arrows
100 if (orientation!=0) {
101 the_code <- 1+(orientation+1)/2;
102 arrows(sig_x[1],sig_y,sig_x[2],sig_y,lwd=4,col=colors[i],code=the_code,angle=20,length=0.15);
103 } else {
104 lines(sig_x,c(sig_y,sig_y),lwd=4,col=colors[i]);
105 }
106 }
107 }
108 }
109
110 #draw inferred on-signal
111 hit_color <- rgb(0.1,0.6,0.1,0.9)
112
113 if (0!=1) {
114
115 on <- c(0,4,33,44,49);
116 off <- c(3,20,43,48,51);
117
118 if (length(on)>0) {
119 for (i in 1:length(on)) {
120 lines(c(1+on[i],1+off[i]-1),c(maxy,maxy),lwd=7,col=hit_color);
121 }
122 }
123
124 ### draw on/off values
125 if (0) {
126 lines(c(1,1+len),c(0.0355791,0.0355791),lty=2,lwd=1)
127 lines(c(1,1+len),c(0.702675,0.702675),lty=2,lwd=1)
128 }
129 }
130
131
132 signal_names<-c();
133
134 if (length(signal_names)>0 || (0!=1)) {
135 legend("bottom",c("LocARNA",signal_names),lwd=7,col=c(hit_color,colors),horiz=TRUE,inset=-0.4);
136 # ,xpd=TRUE
137 }