comparison seaborn.xml @ 0:293a939f28c8 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/seaborn commit 24dc6373560bd5e409fca84154634f5a528001c3
author iuc
date Wed, 14 May 2025 08:39:42 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:293a939f28c8
1 <tool id="seaborn" name="seaborn" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="23.0" license="MIT">
2 <description>generate various plots using seaborn</description>
3
4 <macros>
5 <import>macros.xml</import>
6 </macros>
7
8 <expand macro="edam"/>
9 <expand macro="requirements"/>
10 <expand macro="creator" />
11
12 <command detect_errors="exit_code"><![CDATA[
13 python3 '${run_script}'
14 ]]></command>
15
16 <configfiles>
17 <configfile name="run_script"><![CDATA[
18 index_col = False
19
20 @INIT@
21
22 plot = $plot
23
24 fig = plot(
25 data,
26 #if $xcol
27 x = data.columns.values[$xcol - 1],
28 #end if
29 #if $ycol
30 y = data.columns.values[$ycol - 1],
31 #end if
32 #if $hue
33 hue = data.columns.values[$hue - 1],
34 #end if
35 #if $col
36 col = data.columns.values[$col - 1],
37 #end if
38 #if $row
39 row = data.columns.values[$row - 1],
40 #end if
41 #if $legend
42 legend = $legend,
43 #end if
44 #if $kind
45 kind = '$kind'
46 #end if
47 )
48
49 #if $legend_pos
50 plt.legend(loc='$legend_pos')
51 #end if
52
53 plt.savefig(f"{output_file}", format=output_format, dpi=300)
54 ]]></configfile>
55 </configfiles>
56 <inputs>
57 <expand macro="inputs"/>
58 <expand macro="transformation"/>
59
60 <param name="plot" type="select" label="Plot to choose from seaborn" help="Select the type of plot you want to generate using seaborn. Each option corresponds to a specific seaborn plotting function.">
61 <option value="sns.scatterplot">scatterplot</option>
62 <option value="sns.displot">displot</option>
63 <option value="sns.jointplot">jointplot</option>
64 <option value="sns.barplot">barplot</option>
65 <option value="sns.boxplot">boxplot</option>
66 <option value="sns.violinplot">violinplot</option>
67 <option value="sns.lmplot">lmplot</option>
68 <option value="sns.histplot">histplot</option>
69 </param>
70
71 <conditional name="header">
72 <param name="has_header" type="select" display="radio" label="Does your table have a header?" help="Specify whether the input data contains a header row. If yes, column names will be used for selection." refresh_on_change="true">
73 <option value="yes" selected="true">yes</option>
74 <option value="no">no</option>
75 </param>
76 <when value="yes">
77 <expand macro="columns" header="true" />
78 </when>
79 <when value="no">
80 <expand macro="columns" header="false" />
81 </when>
82 </conditional>
83
84 <section name="advanced" title="Advanced Options">
85 <param name="kind" type="select" label="Kind specification" optional="true" help="Specify the kind of plot to generate for multi-plot functions like `sns.relplot` or `sns.catplot`.">
86 <option value="hist">hist</option>
87 <option value="kde">kde</option>
88 <option value="reg">reg</option>
89 <option value="scatter">scatter</option>
90 <option value="hex">hex</option>
91 <option value="resid">resid</option>
92 <option value="ecdf">ecdf</option>
93 </param>
94 <param name="legend" type="select" label="Legend" help="Specify the type of legend to display on the plot. Options include 'auto', 'brief', 'full', or None to disable the legend." optional="true">
95 <option value="'auto'">auto</option>
96 <option value="'brief'">brief</option>
97 <option value="'full'">full</option>
98 <option value="False">none</option>
99 <sanitizer invalid_char="">
100 <valid initial="string.ascii_letters">
101 <add value="'" />
102 </valid>
103 </sanitizer>
104 </param>
105 <param name="legend_pos" type="select" optional="true" label="Legend position" help="Choose the position of the legend on the plot. Options include various corners and sides of the plot.">
106 <option value="center right">center right</option>
107 <option value="center left">center left</option>
108 <option value="upper right">upper right</option>
109 <option value="upper left">upper left</option>
110 <option value="lower right">lower right</option>
111 <option value="lower left">lower left</option>
112 </param>
113 </section>
114 </inputs>
115 <outputs>
116 <data name="output_file" format="png" label="${tool.name} ${plot} of ${on_string}" />
117 </outputs>
118 <tests>
119 <!-- Test 1: Generate a scatterplot -->
120 <test>
121 <param name="input_data" value="mtcars.txt"/>
122 <param name="plot" value="sns.scatterplot" />
123 <conditional name="header">
124 <param name="has_header" value="yes" />
125 <param name="xcol" value="2" /> <!-- Column 2: mpg -->
126 <param name="ycol" value="3" /> <!-- Column 3: cyl -->
127 </conditional>
128 <output name="output_file">
129 <assert_contents>
130 <has_image_channels channels="4"/>
131 <has_image_height height="1440"/>
132 <has_image_width width="1920" />
133 <has_image_center_of_mass center_of_mass="960.65, 718.85" eps="0.1"/>
134 </assert_contents>
135 </output>
136 </test>
137
138 <!-- Test 2: Generate a barplot -->
139 <test>
140 <param name="input_data" value="mtcars.txt"/>
141 <param name="plot" value="sns.barplot" />
142 <conditional name="header">
143 <param name="has_header" value="yes" />
144 <param name="xcol" value="3" /> <!-- Column 3: cyl -->
145 <param name="ycol" value="2" /> <!-- Column 2: mpg -->
146 </conditional>
147 <output name="output_file">
148 <assert_contents>
149 <has_image_channels channels="4"/>
150 <has_image_height height="1440"/>
151 <has_image_width width="1920" />
152 <has_image_center_of_mass center_of_mass="971.48, 692.18" eps="0.2"/>
153 </assert_contents>
154 </output>
155 </test>
156
157 <!-- Test 3: Generate a boxplot with hue -->
158 <test>
159 <param name="input_data" value="mtcars.txt"/>
160 <param name="plot" value="sns.boxplot" />
161 <conditional name="header">
162 <param name="has_header" value="yes" />
163 <param name="xcol" value="3" /> <!-- Column 3: cyl -->
164 <param name="ycol" value="2" /> <!-- Column 2: mpg -->
165 <section name="advanced_input">
166 <param name="hue" value="4" /> <!-- Column 4: disp -->
167 </section>
168 </conditional>
169 <output name="output_file">
170 <assert_contents>
171 <has_image_channels channels="4"/>
172 <has_image_height height="1440"/>
173 <has_image_width width="1920" />
174 <has_image_center_of_mass center_of_mass="957.48, 720.14" eps="0.1"/>
175 </assert_contents>
176 </output>
177 </test>
178
179 <!-- Test 4: Generate a violinplot with advanced options -->
180 <test>
181 <param name="input_data" value="mtcars.txt"/>
182 <param name="plot" value="sns.violinplot" />
183 <conditional name="header">
184 <param name="has_header" value="yes" />
185 <param name="xcol" value="3" /> <!-- Column 3: cyl -->
186 <param name="ycol" value="2" /> <!-- Column 2: mpg -->
187 </conditional>
188 <section name="advanced">
189 <param name="legend" value="'brief'" />
190 <param name="legend_pos" value="upper right" />
191 </section>
192 <output name="output_file">
193 <assert_contents>
194 <has_image_channels channels="4"/>
195 <has_image_height height="1440"/>
196 <has_image_width width="1920" />
197 <has_image_center_of_mass center_of_mass="959.80, 716.27" eps="0.1"/>
198 </assert_contents>
199 </output>
200 </test>
201
202 <!-- Test 5: Generate a lmplot with hue -->
203 <test>
204 <param name="input_data" value="mtcars.txt"/>
205 <param name="plot" value="sns.boxplot" />
206 <conditional name="header">
207 <param name="has_header" value="yes" />
208 <param name="xcol" value="2" /> <!-- Column 2: mpg -->
209 <param name="ycol" value="5" /> <!-- Column 5: hp -->
210 <section name="advanced_input">
211 <param name="hue" value="3" /> <!-- Column 3: cyl -->
212 </section>
213 </conditional>
214 <output name="output_file">
215 <assert_contents>
216 <has_image_channels channels="4"/>
217 <has_image_height height="1440"/>
218 <has_image_width width="1920" />
219 <has_image_center_of_mass center_of_mass="958.93, 716.80" eps="0.1"/>
220 </assert_contents>
221 </output>
222 </test>
223
224 </tests>
225 <help><![CDATA[
226 .. class:: infomark
227
228 **What it does**
229
230 This tool allows you to generate a variety of plots using the Seaborn library, a Python data visualization library based on Matplotlib. It supports multiple plot types, including scatter plots, bar plots, box plots, and more. The tool is designed to work with tabular data in formats such as TSV, CSV, TXT, or Parquet.
231
232 Seaborn provides a high-level interface for drawing attractive and informative statistical graphics. This tool integrates Seaborn's functionality into Galaxy, enabling users to create publication-quality plots without requiring programming knowledge.
233
234 **Usage**
235
236 1. **Input**: Provide a tabular data file in one of the supported formats (TSV, CSV, TXT, or Parquet).
237 2. **Plot Type**: Choose the type of plot you want to generate (e.g., scatterplot, barplot, boxplot).
238 3. **Advanced Options**: Customize the plot further by specifying parameters such as legend type, legend position, and data transformations.
239 4. **Output**: The tool generates a PNG image of the plot, which can be downloaded or used in further analyses.
240
241 **Example Input**
242
243 Here is an example of a simple input dataset:
244
245 +------------+------------+------------+
246 | Category | Value1 | Value2 |
247 +============+============+============+
248 | A | 10 | 20 |
249 +------------+------------+------------+
250 | B | 15 | 25 |
251 +------------+------------+------------+
252 | C | 20 | 30 |
253 +------------+------------+------------+
254
255 **Example Output**
256
257 If you select a scatterplot with `Value1` on the x-axis and `Value2` on the y-axis, the tool will generate a scatterplot visualizing the relationship between these two variables.
258
259 **Parameters**
260
261 - **Input Data Table**: Upload your data file in TSV, CSV, TXT, or Parquet format.
262 - **Plot Type**: Select the type of plot to generate (e.g., scatterplot, barplot, etc.).
263 - **Legend**: Specify the type of legend to display (e.g., auto, brief, full, or None).
264 - **Legend Position**: Choose the position of the legend on the plot (e.g., upper right, lower left, etc.).
265 - **Data Transformation**: Apply transformations such as log10 or log2 to numerical data.
266
267 **Links**
268
269 - For more information about Seaborn, visit the official documentation: https://seaborn.pydata.org/
270 - For detailed parameter descriptions, refer to the Galaxy tool documentation.
271
272 **Output**
273
274 The tool generates a PNG file containing the plot. The file can be downloaded or used as input for other tools in Galaxy.
275
276 ]]></help>
277 <expand macro="citation"/>
278 </tool>