diff ggplot_violin.xml @ 2:43778344b955 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit f9fb73a88ab8b52ce11c25a966d4fe99e67c9fbf
author iuc
date Mon, 11 Jun 2018 16:05:43 -0400
parents a597d59df9ee
children dfd5d981b5a4
line wrap: on
line diff
--- a/ggplot_violin.xml	Tue Aug 29 09:02:49 2017 -0400
+++ b/ggplot_violin.xml	Mon Jun 11 16:05:43 2018 -0400
@@ -1,29 +1,29 @@
-<tool id="ggplot2_violin" name="Violin plot w ggplot2" version="@VERSION@">
+<tool id="ggplot2_violin" name="Violin plot w ggplot2" version="@VERSION@+galaxy0">
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="requirements">
-        <requirement type="package" version="1.4.2">r-reshape2</requirement>
+        <requirement type="package" version="1.4.3">r-reshape2</requirement>
+        <requirement type="package" version="1.2.1">r-svglite</requirement>
     </expand>
     <command detect_errors="exit_code"><![CDATA[
 cat '$script' &&
-Rscript '$script' &&
-mv output_plot.pdf $output1
+Rscript '$script'
     ]]></command>
     <configfiles>
         <configfile name="script"><![CDATA[
-
 @R_INIT@
 
 ## Import library
 library("reshape2")
 library("ggplot2")
 
-## Choose between automatically scaled x and y axis or user defined
-#if $scaling.plot_scaling == "Automatic"
+## Automatically scaled y axis or user defined
+## marco not possible because on y asis relevent
+#if $adv.scaling.plot_scaling == "Automatic"
     gg_scaley = NULL
 #else
-    gg_scaley = ylim($scaling.yaxismin, $scaling.yaxismax)
+    gg_scaley = ylim($adv.scaling.yaxismin, $adv.scaling.yaxismax)
 #end if
 
 integrated <- read.csv('$input1', sep='\t', header=TRUE)
@@ -31,19 +31,22 @@
 
 @TRANSFORM@
 
-#if $drawquartiles == "none"
+@THEME@
+
+@LEGEND@
+
+#if $adv.drawquartiles == "none"
     gg_quartile = NULL
 #else
     gg_quartile = c(0.25, 0.5, 0.75)
 #end if
 
-
-ggplot(input, aes(variable, value)) + geom_violin(scale = "area", colour = '$ggcolor', fill = '$ggfill', draw_quantiles = gg_quartile) +
-gg_scaley + theme_bw() + xlab('$xlab') + ylab('$ylab') + ggtitle('$title')
+## add advanced plotting options for final plot
+plot_out <- ggplot(input, aes(variable, value)) +
+    geom_violin(scale = "area", colour = '$adv.ggcolor', fill = '$adv.ggfill', draw_quantiles = gg_quartile) +
+    gg_scaley + gg_legend + gg_theme + xlab('$xlab') + ylab('$ylab') + ggtitle('$title')
 
-ggsave(file='output_plot.pdf')
-dev.off()
-
+@SAVE_OUTPUT@
         ]]></configfile>
     </configfiles>
     <inputs>
@@ -51,63 +54,71 @@
             help="Column headers are requirement. These will be the columns that are plotted."/>
         <expand macro="title" />
         <expand macro="xy_lab" />
-        <conditional name="scaling">
-            <param name="plot_scaling" type="select" label="Advanced - Axis scaling">
-                <option value="Automatic" selected="True">Automatic axis scaling</option>
-                <option value="Defined">User deined axis scales</option>
+        <section name="adv" title="Advanced Options" expanded="false">
+            <param name="drawquartiles" type="select" label="Indicate quartiles of your data">
+                <option value="none">Plot the data without indicating quartiles</option>
+                <option value="indicate">Draw lines to indicate each quartile</option>
+            </param>
+            <param name="ggfill" type="select" label="Violin color options">
+                <option value="blue" selected="true">Default (Blue)</option>
+                <option value="black">Black</option>
+                <option value="red">Red</option>
+                <option value="white">White</option>
+                <option value="orange">Orange</option>
+                <option value="yellow">Yellow</option>
+                <option value="green">Green</option>
+                <option value="purple">Purple</option>
+                <option value="magenta">Magenta</option>
+                <option value="cyan">Cyan</option>
+                <option value="grey">Grey</option>
+                <option value="gold">Gold</option>
             </param>
-            <when value="Automatic" />
-            <when value="Defined">
-                <param name="yaxismin" type="integer" value="0" label="minimal range of y-axis" />
-                <param name="yaxismax" type="integer" value="3" label="maximal range of y-axis" />
-            </when>
-        </conditional>
-        <expand macro="transform" />
-        <param name="drawquartiles" type="select" label="Advanced - indicate quartiles of your data">
-            <option value="none">Plot the data without indicating quartiles</option>
-            <option value="indicate">Draw lines to indicate each quartile</option>
-        </param>
-        <param name="ggfill" type="select" label="Advanced - violin color options">
-            <option value="blue" selected="True">Default (Blue)</option>
-            <option value="black">Black</option>
-            <option value="red">Red</option>
-            <option value="white">White</option>
-            <option value="orange">Orange</option>
-            <option value="yellow">Yellow</option>
-            <option value="green">Green</option>
-            <option value="purple">Purple</option>
-            <option value="magenta">Magenta</option>
-            <option value="cyan">Cyan</option>
-            <option value="grey">Grey</option>
-            <option value="gold">Gold</option>
-        </param>
-        <param name="ggcolor" type="select" label="Advanced - violin border options">
-            <option value="yellow" selected="True">Default (Yellow)</option>
-            <option value="black">Black</option>
-            <option value="red">Red</option>
-            <option value="white">White</option>
-            <option value="blue">Blue</option>
-            <option value="orange">Orange</option>
-            <option value="green">Green</option>
-            <option value="purple">Purple</option>
-            <option value="magenta">Magenta</option>
-            <option value="cyan">Cyan</option>
-            <option value="grey">Grey</option>
-            <option value="gold">Gold</option>
-        </param>
+            <param name="ggcolor" type="select" label="Violin border options">
+                <option value="yellow" selected="true">Default (Yellow)</option>
+                <option value="black">Black</option>
+                <option value="red">Red</option>
+                <option value="white">White</option>
+                <option value="blue">Blue</option>
+                <option value="orange">Orange</option>
+                <option value="green">Green</option>
+                <option value="purple">Purple</option>
+                <option value="magenta">Magenta</option>
+                <option value="cyan">Cyan</option>
+                <option value="grey">Grey</option>
+                <option value="gold">Gold</option>
+            </param>
+            <expand macro="transform" />
+            <conditional name="scaling">
+                <param name="plot_scaling" type="select" label="Axis scaling">
+                    <option value="Automatic" selected="true">Automatic axis scaling</option>
+                    <option value="Defined">User deined axis scales</option>
+                </param>
+                <when value="Automatic" />
+                <when value="Defined">
+                    <param name="yaxismin" type="integer" value="0" label="minimal range of y-axis" />
+                    <param name="yaxismax" type="integer" value="3" label="maximal range of y-axis" />
+                </when>
+            </conditional>
+            <expand macro="xy_scaling" />
+            <expand macro="theme" />
+            <expand macro="legend" />
+        </section>
+        <section name="out" title="Output Options" expanded="true">
+            <expand macro="dimensions" />
+        </section>
     </inputs>
     <outputs>
-        <data name="output1" format="pdf" from_work_dir="Rplot.pdf"/>
+        <expand macro="additional_output" />
     </outputs>
     <tests>
         <test>
             <param name="input1" value="mtcars.txt" ftype="tabular"/>
-            <output name="output1" file="ggplot_violin_result1.pdf" compare="sim_size"/>
+            <param name="additional_output_format" value="pdf" />
+            <output name="output2" file="ggplot_violin_result1.pdf" compare="sim_size"/>
         </test>
     </tests>
     <help><![CDATA[
-        Supply this tool with a text file with headers indicating the various groups to be plotted. This tool will sniff out each column with values that can be plotted and display the distribution of that data group. Note that columns may be excluded from this plot if they contain questionable characters. 
-
+        Supply this tool with a text file with headers indicating the various groups to be plotted. This tool will sniff out each column with values that can be plotted and display the distribution of that data group. Note that columns may be excluded from this plot if they contain questionable characters.
     ]]></help>
     <expand macro="citations"/>
 </tool>