# HG changeset patch
# User saskia-hiltemann
# Date 1446216409 14400
# Node ID d43075b3e107e69a331f5cfb583907c29371da8a
Uploaded
diff -r 000000000000 -r d43075b3e107 r_wrapper.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/r_wrapper.sh	Fri Oct 30 10:46:49 2015 -0400
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+### Run R providing the R script in $1 as standard input and passing 
+### the remaining arguments on the command line
+
+# Function that writes a message to stderr and exits
+function fail
+{
+    echo "$@" >&2
+    exit 1
+}
+
+# Ensure R executable is found
+which R > /dev/null || fail "'R' is required by this tool but was not found on path" 
+
+# Extract first argument
+infile=$1; shift
+
+# Ensure the file exists
+test -f $infile || fail "R input file '$infile' does not exist"
+
+# Invoke R passing file named by first argument to stdin
+R --vanilla --slave $* < $infile
diff -r 000000000000 -r d43075b3e107 test-data/2.tabular
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/2.tabular	Fri Oct 30 10:46:49 2015 -0400
@@ -0,0 +1,10 @@
+1	68	4.1
+2	71	4.6
+3	62	3.8
+4	75	4.4
+5	58	3.2
+6	60	3.1
+7	67	3.8
+8	68	4.1
+9	71	4.3
+10	69	3.7
diff -r 000000000000 -r d43075b3e107 test-data/XY_Plot_1_multi_out.pdf
Binary file test-data/XY_Plot_1_multi_out.pdf has changed
diff -r 000000000000 -r d43075b3e107 tool_dependencies.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Fri Oct 30 10:46:49 2015 -0400
@@ -0,0 +1,10 @@
+
+
+    
+        
+    
+    
+        
+    
+
+
diff -r 000000000000 -r d43075b3e107 xy_example.jpg
Binary file xy_example.jpg has changed
diff -r 000000000000 -r d43075b3e107 xy_plot.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xy_plot.xml	Fri Oct 30 10:46:49 2015 -0400
@@ -0,0 +1,234 @@
+
+  for multiple series and graph types and multiple output types
+  
+    R
+    fontconfig
+   
+  r_wrapper.sh $script_file
+
+  
+    
+    
+    
+    
+            
+            
+            
+            
+            
+          
+    
+      
+      
+      
+      
+        
+          
+          
+        
+        
+          
+            
+            
+            
+          
+          
+            
+            
+            
+            
+            
+            
+            
+            
+          
+          
+        
+        
+          
+            
+            
+            
+            
+            
+            
+              
+          
+          
+            
+            
+            
+            
+            
+            
+            
+            
+          
+          
+        
+      
+           
+  
+
+  
+    
+      ## Setup R error handling to go to stderr
+      options( show.error.messages=F, 
+               error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
+      ## Determine range of all series in the plot
+      xrange = c( NULL, NULL )
+      yrange = c( NULL, NULL )
+      #for $i, $s in enumerate( $series )
+        s${i} = read.table( "${s.input.file_name}" )
+        x${i} = s${i}[,${s.xcol}]
+        y${i} = s${i}[,${s.ycol}]
+        xrange = range( x${i}, xrange )
+        yrange = range( y${i}, yrange )
+      #end for
+      ## Open output PDF file
+      #if $ftype.value == "pdf"
+        pdf("outfile.pdf")
+      #else
+        "${ftype}"( "outfile.${ftype}" , type="cairo")
+      #end if      
+      ## Dummy plot for axis / labels
+      plot( NULL, type="n", xlim=xrange, ylim=yrange, main="${main}", xlab="${xlab}", ylab="${ylab}" )
+      ## Plot each series
+      #for $i, $s in enumerate( $series )
+        #if $s.series_type['type'] == "line"
+          lines( x${i}, y${i}, lty=${s.series_type.lty}, lwd=${s.series_type.lwd}, col=${s.series_type.col} )
+        #elif $s.series_type.type == "points"
+          points( x${i}, y${i}, pch=${s.series_type.pch}, cex=${s.series_type.cex}, col=${s.series_type.col} )
+        #end if
+      #end for    
+      ## Close the PDF file
+      devname = dev.off()
+    
+  
+
+  
+    
+        (ftype == 'pdf') 
+    
+    
+        (ftype == 'png') 
+        
+    
+        (ftype == 'jpeg') 
+    
+    
+        (ftype == 'bmp') 
+    
+    
+        (ftype == 'tiff') 
+    
+  
+
+    
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+        
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+        
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+        
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+        
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+        
+    
+
+.. class:: infomark
+
+This tool allows you to plot values contained in columns of a dataset against each other and also allows you to have different series corresponding to the same or different datasets in one plot.
+
+-----
+
+.. class:: warningmark
+
+This tool throws an error if the columns selected for plotting are absent or are not numeric and also if the lengths of these columns differ.
+
+-----
+
+**Example**
+
+Input file::
+
+    1   68  4.1
+    2   71  4.6
+    3   62  3.8
+    4   75  4.4
+    5   58  3.2
+    6   60  3.1
+    7   67  3.8
+    8   68  4.1
+    9   71  4.3
+    10  69  3.7 
+
+Create a two series XY plot on the above data:
+
+- Series 1: Red Dashed-Line plot between columns 1 and 2
+- Series 2: Blue Circular-Point plot between columns 3 and 2 
+
+.. image:: xy_example.jpg
+
+