diff ggplot_point.xml @ 2:9a482995958c 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:04:40 -0400
parents 1bff6682e780
children 52b8083a6159
line wrap: on
line diff
--- a/ggplot_point.xml	Tue Aug 29 09:02:26 2017 -0400
+++ b/ggplot_point.xml	Mon Jun 11 16:04:40 2018 -0400
@@ -1,32 +1,26 @@
-<tool id="ggplot2_point" name="Scatterplot w ggplot2" version="@VERSION@">
+<tool id="ggplot2_point" name="Scatterplot w ggplot2" version="@VERSION@+galaxy0">
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements"></expand>
+    <expand macro="requirements">
+        <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("ggplot2")
+library(ggplot2)
 
 @XY_SCALING@
 
-## Choose theme for plot
-#if $theme == "bw"
-    gg_theme = theme_bw()
-#else
-    gg_theme = NULL
-#end if
+@THEME@
 
-gg_width = $with_output_dim
-gg_height = $height_output_dim
+@LEGEND@
 
 input <- read.csv('$input1', sep='\t', header=TRUE)
 
@@ -35,91 +29,87 @@
 names(input)[$yplot] <- "ycol"
 
 ## choosing whether to plot data as multiple groups on one plot(factoring) OR multiple groups on different plots
-#if $factor.factoring == "Multiple"
+#if $adv.factor.factoring == "Multiple"
      gg_facet = facet_wrap( ~ factor)
      gg_factor = NULL
      color_scale = NULL
-     #if $points.pointoptions == "Default"
+     #if $adv.points.pointoptions == "Default"
         gg_point = geom_point(size=1, alpha=1, gg_factor)
      #else
-        gg_point = geom_point(size='$points.size', alpha='$points.alpha', colour='$points.pointcolor')
+        gg_point = geom_point(size='$adv.points.size', alpha='$adv.points.alpha', colour='$adv.points.pointcolor')
      #end if
 
-    names(input)[$factor.factorcol] <- "factor"
+    names(input)[$adv.factor.factorcol] <- "factor"
 
-#elif $factor.factoring == "Single"
+#elif $adv.factor.factoring == "Single"
     gg_facet = NULL
     gg_factor = aes(colour=factor(factor))
 
-        #if $points.pointoptions == "default"
-            gg_point = geom_point(size=1, alpha=1, gg_factor)
-        #else
-            gg_point = geom_point(size=$points.size, alpha='$points.alpha', gg_factor)
-        #end if
+    #if $adv.points.pointoptions == "default"
+        gg_point = geom_point(size=1, alpha=1, gg_factor)
+    #else
+        gg_point = geom_point(size=$adv.points.size, alpha='$adv.points.alpha', gg_factor)
+    #end if
 
-      #if $colors == "Default"
-          color_scale = scale_colour_hue(direction='$factor.colororder')
-      #else
-          color_scale = scale_color_brewer(palette='$colors', direction='$factor.colororder')
-      #end if
+    #if $adv.colors == "Default"
+        color_scale = scale_colour_hue(direction='$adv.factor.colororder')
+    #else
+        color_scale = scale_color_brewer(palette='$adv.colors', direction='$adv.factor.colororder')
+    #end if
 
-    names(input)[$factor.factorcol] <- "factor"
+    names(input)[$adv.factor.factorcol] <- "factor"
 #else
-      gg_facet = NULL
-      gg_factor = NULL
-      color_scale = NULL
+    gg_facet = NULL
+    gg_factor = NULL
+    color_scale = NULL
 
-        #if $points.pointoptions == "default"
-            gg_point = geom_point(size=1, alpha=1, gg_factor)
-        #else
-            gg_point = geom_point(size=$points.size, alpha='$points.alpha', colour='$points.pointcolor')
-        #end if
+    #if $adv.points.pointoptions == "default"
+        gg_point = geom_point(size=1, alpha=1, gg_factor)
+    #else
+        gg_point = geom_point(size=$adv.points.size, alpha='$adv.points.alpha', colour='$adv.points.pointcolor')
+    #end if
 #end if
 
 @TRANSFORM@
 
 ##axis label custization
-#if $axis_title_customization.axis_customization == "default"
+#if $adv.axis_title_customization.axis_customization == "default"
     gg_axistitle = theme(axis.title = element_text(color = NULL, size = NULL, face = NULL))
 #else
-    gg_axistitle = theme(axis.title = element_text(color = '$color', size = '$size', face = '$face'))
+    gg_axistitle = theme(axis.title = element_text(color = '$adv.color', size = '$adv.size', face = '$adv.face'))
 #end if
 
-
 ##axis text(tick) custization
-#if $axis_text_customization.axis_customization == "default"
+#if $adv.axis_text_customization.axis_customization == "default"
     gg_axistext = theme(axis.text = element_text(color = NULL, size = NULL, face = NULL))
 #else
-    gg_axistext = theme(axis.text = element_text(color = '$color', size = '$size', face = '$face'))
+    gg_axistext = theme(axis.text = element_text(color = '$adv.color', size = '$adv.size', face = '$adv.face'))
 #end if
 
 ##plot title custimization
-#if $plot_title_customization.axis_customization == "default"
+#if $adv.plot_title_customization.axis_customization == "default"
     gg_plottitle = theme(plot.title = element_text(color = NULL, size = NULL, face = NULL))
 #else
-    gg_plottitle = theme(plot.title = element_text(color='$color', size='$size', face='$face'))
+    gg_plottitle = theme(plot.title = element_text(color='$adv.color', size='$adv.size', face='$adv.face'))
 #end if
 
-
-
 ## grid line customization
-#if $gridlinecust == "default"
+#if $adv.gridlinecust == "default"
     gg_gridline = NULL
-#elif $gridlinecust == "hidemajor"
+#elif $adv.gridlinecust == "hidemajor"
     gg_gridline = theme(panel.grid.major = element_blank())
-#elif $gridlinecust == "hideminor"
+#elif $adv.gridlinecust == "hideminor"
     gg_gridline = theme(panel.grid.minor = element_blank())
-#elif $gridlinecust == "hideboth"
+#elif $adv.gridlinecust == "hideboth"
     gg_gridline = theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank())
 #end if
 
 #this is the actual ggplot command to make the final plot(s)
-ggplot(input, aes(xcol,ycol)) + gg_point + gg_facet+
-gg_theme + gg_scalex + gg_scaley + color_scale + ggtitle('$title') + xlab('$xlab') + ylab('$ylab')+
-gg_axistitle + gg_axistext + gg_plottitle + gg_gridline
+plot_out <- ggplot(input, aes(xcol, ycol)) + gg_point + gg_facet +
+    gg_theme + gg_scalex + gg_scaley + color_scale + gg_legend + ggtitle('$title') + xlab('$xlab') + ylab('$ylab')+
+    gg_axistitle + gg_axistext + gg_plottitle + gg_gridline
 
-ggsave(file='output_plot.pdf', width=gg_width, height=gg_height)
-dev.off()
+@SAVE_OUTPUT@
         ]]></configfile>
     </configfiles>
     <inputs>
@@ -129,104 +119,99 @@
 
         <expand macro="title" />
         <expand macro="xy_lab" />
-
-        <conditional name="points">
-            <param name="pointoptions" type="select" label="Advanced - data point options">
-                <option value="default" selected="True">Default</option>
-                <option value="defined">User defined point options</option>
-            </param>
-            <when value="default">
-                <!--Do nothing here -->
-            </when>
-            <when value="defined">
-                <param name="size" type="float" value="1" label="relative size of points" />
-                <param name="alpha" type="float" value="1" label="Transparency of points (On a scale of 0-1; 0=transparent, 1=default)" />
-                <param name="pointcolor" type="select" label="Color of data points" >
-                    <option value="black">Black (default)</option>
-                    <option value="red">Red</option>
-                    <option value="white">White</option>
-                    <option value="blue">Blue</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>
+        <section name="adv" title="Advanced Options" expanded="false">
+            <conditional name="points">
+                <param name="pointoptions" type="select" label="Data point options">
+                    <option value="default" selected="true">Default</option>
+                    <option value="defined">User defined point options</option>
                 </param>
-            </when>
-        </conditional>
-        <conditional name="factor">
-            <param name="factoring" type="select" label="Advanced - plotting multiple groups" >
-                <option value="Default" selected="True">No thanks - just plot the data as one group</option>
-                <option value="Single">Plot multiple groups of data on one plot</option>
-                <option value="Multiple">Plot multiple groups of data on individual plots</option>
+                <when value="default">
+                    <!--Do nothing here -->
+                </when>
+                <when value="defined">
+                    <param name="size" type="float" value="1" label="relative size of points" />
+                    <param name="alpha" type="float" value="1" label="Transparency of points (On a scale of 0-1; 0=transparent, 1=default)" />
+                    <param name="pointcolor" type="select" label="Color of data points" >
+                        <option value="black">Black (default)</option>
+                        <option value="red">Red</option>
+                        <option value="white">White</option>
+                        <option value="blue">Blue</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>
+            </conditional>
+            <conditional name="factor">
+                <param name="factoring" type="select" label="Plotting multiple groups" >
+                    <option value="Default" selected="true">No thanks - just plot the data as one group</option>
+                    <option value="Single">Plot multiple groups of data on one plot</option>
+                    <option value="Multiple">Plot multiple groups of data on individual plots</option>
+                </param>
+                <when value="Default">
+                    <!--Do nothing here -->
+                </when>
+                <when value="Single">
+                    <param name="factorcol" type="integer" value="1" label="column differentiating the different groups" />
+                    <expand macro="colors" />
+                    <param name="colororder" type="select" label="Reverse color scheme" >
+                        <option value="1">Default order of color scheme</option>
+                        <option value="-1">Reverse the order of my color scheme</option>
+                    </param>
+                </when>
+                <when value="Multiple">
+                    <param name="factorcol" type="integer" value="1" label="column differentiating the different groups" />
+                </when>
+            </conditional>
+            <conditional name="axis_title_customization">
+                <expand macro="axis_customization" label="Axis title options" />
+            </conditional>
+            <conditional name="axis_text_customization">
+                <expand macro="axis_customization" label="Axis text options" />
+            </conditional>
+            <conditional name="plot_title_customization">
+                <expand macro="axis_customization" label="Plot title options" />
+            </conditional>
+            <param name="gridlinecust" type="select" label="Grid lines">
+              <option value="default">Default grid lines</option>
+              <option value="hidemajor">Hide major grid lines</option>
+              <option value="hideminor">Hide minor grid lines</option>
+              <option value="hideboth">Hide major and minor grid lines</option>
             </param>
-            <when value="Default">
-                <!--Do nothing here -->
-            </when>
-            <when value="Single">
-                <param name="factorcol" type="integer" value="1" label="column differentiating the different groups" />
-                <expand macro="colors" />
-                <param name="colororder" type="select" label="Reverse color scheme" >
-                    <option value="1">Default order of color scheme</option>
-                    <option value="-1">Reverse the order of my color scheme</option>
-                </param> 
-            </when>
-            <when value="Multiple">
-                <param name="factorcol" type="integer" value="1" label="column differentiating the different groups" />
-            </when>
-        </conditional>
-        <expand macro="transform" />
-
-        <expand macro="xy_scaling" />
-
-        <param name="theme" type="select" label="Advanced - backgound theme for plot">
-          <option value="bw">Black and white</option>
-          <option value="Default">Default (grey)</option>
-        </param>
-
-        <conditional name="axis_title_customization">
-            <expand macro="axis_customization" label="Advanced - axis title options" />
-        </conditional>
-        <conditional name="axis_text_customization">
-            <expand macro="axis_customization" label="Advanced - axis text options" />
-        </conditional>
-        <conditional name="plot_title_customization">
-            <expand macro="axis_customization" label="Advanced - Plot title options" />
-        </conditional>
-        <param name="gridlinecust" type="select" label="Advanced - grid lines">
-          <option value="default">Default grid lines</option>
-          <option value="hidemajor">Hide major grid lines</option>
-          <option value="hideminor">Hide minor grid lines</option>
-          <option value="hideboth">Hide major and minor grid lines</option>
-        </param>
-        <expand macro="dimensions" />
+            <expand macro="transform" />
+            <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="png" from_work_dir="Rplot.png"/>
-            ToDo: It would be nice to have different output formats for all tools
-        -->
-        <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_point_result1.pdf" compare="sim_size" />
+            <param name="additional_output_format" value="pdf" />
+            <output name="output2" file="ggplot_point_result1.pdf" compare="sim_size" />
         </test>
     </tests>
     <help><![CDATA[
-        This tool will generate a scatterplot representing data from two groups/conditions. 
+This tool will generate a scatterplot representing data from two groups/conditions.
 
-        The input data should be in tabular format and the user can determine which groups (columns) to plot.
+The input data should be in tabular format and the user can determine which groups (columns) to plot.
 
-        Multiple groups can be plotted on the same or multiple plots by providing a column with a group identifier under "Advanced - plotting multiple groups".
+Multiple groups can be plotted on the same or multiple plots by providing a column with a group identifier under "Advanced - plotting multiple groups".
 
-        Feel free to explore the (many) advanced options to customize your plot. Galaxy makes this type optimization easy for the user!  
+Feel free to explore the (many) advanced options to customize your plot. Galaxy makes this type optimization easy for the user!
 
-        The ouput is a pdf file with your scatterplot. The dimensions of this file can be modified under "Advanced - output dimensions"
-
+The ouput is a pdf file with your scatterplot. The dimensions of this file can be modified under "Advanced - output dimensions"
     ]]></help>
     <expand macro="citations"/>
 </tool>