diff test-data/archaea_relplot.scr @ 0:e91e4f48875e draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/locarna commit 287021573c592fdb70fdbbc88943aa16a8740fc0
author rnateam
date Fri, 13 Jan 2017 16:49:16 -0500
parents
children e66514da3a99
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/archaea_relplot.scr	Fri Jan 13 16:49:16 2017 -0500
@@ -0,0 +1,137 @@
+pdf("/tmp/tmp5yxSuG/files/000/dataset_2.dat",width=12,height=4,version="1.4")
+
+rel    <- read.table("mlocarna_results/results/result.bmreliability");
+seqrel <- rel[[2]]
+strrel <- rel[[3]]
+
+if ("" != "") {
+  seq <- ""
+  seq <- strsplit(seq,split="")
+  tab <- unlist(seq)!="-"
+
+  seqrel<-seqrel[tab]
+  strrel<-strrel[tab]
+}
+
+len<-length(seqrel)
+
+if (0) {
+  seqrel<-seqrel[len:1]
+  strrel<-strrel[len:1]
+}
+
+
+
+if (1) {
+  seqrel <- seqrel/1.0
+}
+
+
+totalrel <- seqrel+strrel;
+
+anno_space<-0.075
+
+maxy <- max(c(1,totalrel))+anno_space*(0+1);
+
+
+firstpos <- 1
+lastpos  <- 1+len-1
+
+if (0) {
+  the_xlim <- c(lastpos,firstpos)
+} else {
+  the_xlim <- c(firstpos,lastpos)
+}
+
+# set margin
+# b, l, t, r
+par(mar=c(6,2.5,1,1))
+
+# open plot (and draw threshold)
+plot(c(0),c(0),type="l",                                        
+     xlab="",ylab="",
+     xlim=the_xlim,ylim=c(0,maxy),
+     yaxp=c(0,1,2))
+
+## title inside of plot
+legend("topleft","",bty="n")
+
+
+# total reliability
+polygon(c(firstpos,firstpos:lastpos,lastpos),c(0,totalrel,0),col=rgb(0.8,0.8,0.9,0.5),lwd=2,border=FALSE)
+lines(firstpos:lastpos,totalrel,col="blue",lwd=2)
+
+# plot structure reliability
+polygon(c(firstpos,firstpos:lastpos,lastpos),c(0,strrel,0),col=rgb(0.3,0.3,0.5,0.8),lwd=1,border=FALSE)
+
+
+## draw other signals
+signals<-c();
+signal_sizes<-c();
+
+signal_starts <- 1:0
+
+signal_starts[1]<-1;
+if (0>1) {
+  for (i in 2:0) {
+    signal_starts[i]<-signal_starts[i-1]+signal_sizes[i-1]*2+1;
+  }
+}
+
+colors <- c(
+    rgb(0.6,0.1,0.1,0.9),
+    rgb(0.6,0.6,0.1,0.9),
+    rgb(0.1,0.6,0.6,0.9),
+    rgb(0.6,0.1,0.6,0.9)
+);
+colors<-c(colors,colors);
+
+if (0>0) {
+  
+  for (i in 1:0) {
+    orientation <- signals[signal_starts[i]+signal_sizes[i]*2];
+    sig_y  <- maxy-i*anno_space;
+    
+    for (j in 0:(signal_sizes[i]-1)) {
+
+      sig_x <- c(signals[signal_starts[i]+j*2],signals[signal_starts[i]+j*2+1]);
+          
+      ## draw arrows
+      if (orientation!=0) {
+        the_code <- 1+(orientation+1)/2;
+        arrows(sig_x[1],sig_y,sig_x[2],sig_y,lwd=4,col=colors[i],code=the_code,angle=20,length=0.15);
+      } else {
+        lines(sig_x,c(sig_y,sig_y),lwd=4,col=colors[i]);
+      }
+    }
+  }
+}
+
+#draw inferred on-signal
+hit_color <- rgb(0.1,0.6,0.1,0.9)
+  
+if (0!=1) {
+  
+  on  <- c(0,4,33,44,49);
+  off <- c(3,20,43,48,51);
+
+  if (length(on)>0) {
+    for (i in 1:length(on)) {
+      lines(c(1+on[i],1+off[i]-1),c(maxy,maxy),lwd=7,col=hit_color);
+    }
+  }
+
+  ### draw on/off values
+  if (0) {
+    lines(c(1,1+len),c(0.0355791,0.0355791),lty=2,lwd=1)
+    lines(c(1,1+len),c(0.702675,0.702675),lty=2,lwd=1)
+  }
+}
+
+
+signal_names<-c();
+
+if (length(signal_names)>0 || (0!=1)) {
+  legend("bottom",c("LocARNA",signal_names),lwd=7,col=c(hit_color,colors),horiz=TRUE,inset=-0.4);
+  # ,xpd=TRUE
+}