view test-data/archaea_relplot.scr @ 4:6e20ad2c8752 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/locarna commit 94c141a71ef115279f1090f782b6f5cdeea9c277
author bgruening
date Mon, 19 Aug 2024 18:52:41 +0000
parents 7554c0df9139
children
line wrap: on
line source

pdf("/tmp/tmpewnb251n/job_working_directory/000/2/outputs/dataset_a612ea0e-aca2-4d90-987a-39141bc61f36.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,33);
  off <- c(20,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.0139513,0.0139513),lty=2,lwd=1)
    lines(c(1,1+len),c(0.656017,0.656017),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
}