diff ggplot_point.xml @ 15:f87634b12749 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 57b86418a4f032a5664b8dc1c9585a11be629158
author iuc
date Thu, 15 May 2025 13:02:15 +0000
parents 5298e06f14f9
children
line wrap: on
line diff
--- a/ggplot_point.xml	Mon Sep 30 15:40:11 2024 +0000
+++ b/ggplot_point.xml	Thu May 15 13:02:15 2025 +0000
@@ -1,4 +1,4 @@
-<tool id="ggplot2_point" name="Scatterplot with ggplot2" version="@TOOL_VERSION@+galaxy1" profile="20.01">
+<tool id="ggplot2_point" name="Scatterplot with ggplot2" version="@TOOL_VERSION@+galaxy2" profile="23.0">
     <macros>
         <import>macros.xml</import>
         <token name="@SIMPLE_GGLINE@">gg_line = geom_line(size=1, alpha=1, gg_factor)</token>
@@ -24,7 +24,7 @@
 
 @LEGEND@
 
-input <- read.csv('$input1', sep='\t', header=TRUE)
+input <- read.csv('$input1', sep='\t')
 
 ## renaming columns so ggplot can use them
 names(input)[$xplot] <- "xcol"
@@ -126,7 +126,7 @@
 #end if
 
 #this is the actual ggplot command to make the final plot(s)
-plot_out <- ggplot(input, aes(xcol, ycol)) + gg_point + gg_line + gg_facet +
+plot_out <- ggplot(input, aes_string(x=names(input)[$xplot], y=names(input)[$yplot])) + gg_point + gg_line + 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
 
@@ -135,8 +135,22 @@
     </configfiles>
     <inputs>
         <param name="input1" type="data" format="tabular" label="Input in tabular format" />
-        <param name="xplot" type="integer" value="8" label="Column to plot on x-axis" />
-        <param name="yplot" type="integer" value="9" label="Column to plot on y-axis" />
+
+        <conditional name="cols">
+            <param name="header" type="select" label="Does the dataset have a header?" help="If the table has a header, columns can be selected based on the name.">
+                <option value="yes" selected="true">yes</option>
+                <option value="no">no</option>
+            </param>
+            <when value="yes">
+                <param name="xplot"  type="data_column" data_ref="input1" use_header_names="true" label="Column to plot on x-axis" />
+                <param name="yplot"  type="data_column" data_ref="input1" use_header_names="true" label="Column to plot on y-axis" />
+            </when>
+            <when value="no">
+                <param name="xplot"  type="data_column" data_ref="input1" label="Column to plot on x-axis" />
+                <param name="yplot"  type="data_column" data_ref="input1" label="Column to plot on y-axis" />
+            </when>
+        </conditional>
+
 
         <expand macro="title" />
         <expand macro="xy_lab" />
@@ -207,11 +221,18 @@
         <test expect_num_outputs="2">
             <param name="input1" value="mtcars.txt" ftype="tabular" />
             <param name="additional_output_format" value="pdf" />
+            <param name="xplot" value="8"/>
+            <param name="yplot" value="9"/>
             <output name="output2" file="ggplot_point_result1.pdf" compare="sim_size" />
         </test>
         <!-- Test text options-->
         <test expect_num_outputs="2">
             <param name="input1" value="mtcars.txt" ftype="tabular" />
+            <conditional name="cols">
+                <param name="header" value="no"/>
+            </conditional>
+            <param name="xplot" value="8"/>
+            <param name="yplot" value="9"/>   
             <section name="adv">
                 <conditional name="type_conditional">
                     <param name="type_options" value="points"/>
@@ -230,6 +251,8 @@
         <!-- Test lines option -->
         <test expect_num_outputs="2">
             <param name="input1" value="mtcars.txt" ftype="tabular" />
+            <param name="xplot" value="8"/>
+            <param name="yplot" value="9"/>   
             <section name="adv">
                 <conditional name="type_conditional">
                     <param name="type_options" value="lines"/>
@@ -241,6 +264,8 @@
          <!-- Test defined point options options-->
         <test expect_num_outputs="2">
             <param name="input1" value="mtcars.txt" ftype="tabular" />
+            <param name="xplot" value="8"/>
+            <param name="yplot" value="9"/>   
             <section name="adv">
                 <conditional name="type_conditional">
                     <param name="type_options" value="points"/>