changeset 3:7b583659453b draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/wordcloud commit 0d8a75dc9f4c31bebffa9364cec730c787f08009
author bgruening
date Thu, 11 Sep 2025 16:52:09 +0000
parents 57e3de4b3b0d
children
files test-data/mask.png test-data/output0.png test-data/output1.png test-data/output2.png test-data/output3.png test-data/output4.png test-data/output_1.png test-data/output_2.png wordcloud.xml
diffstat 9 files changed, 121 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
Binary file test-data/mask.png has changed
Binary file test-data/output0.png has changed
Binary file test-data/output1.png has changed
Binary file test-data/output2.png has changed
Binary file test-data/output3.png has changed
Binary file test-data/output4.png has changed
Binary file test-data/output_1.png has changed
Binary file test-data/output_2.png has changed
--- a/wordcloud.xml	Thu Jun 05 19:09:27 2025 +0000
+++ b/wordcloud.xml	Thu Sep 11 16:52:09 2025 +0000
@@ -2,7 +2,7 @@
     <description>with highly customizable appearance</description>
     <macros>
         <token name="@TOOL_VERSION@">1.9.4</token>
-        <token name="@VERSION_SUFFIX@">2</token>
+        <token name="@VERSION_SUFFIX@">3</token>
         <token name="@PROFILE@">23.0</token>
     </macros>
     <requirements>
@@ -47,29 +47,28 @@
             #if str($margin):
                 --margin $margin
             #end if
-            #if $background
-                --background '$background'
+            --mode $background_options.mode
+            #if str($background_options.mode) == 'RGB'
+                --background '$background_options.background_color'
+                #if str($background_options.cloud_shape.cloud_shape_options) == 'mask'
+                    --mask $background_options.cloud_shape.mask
+                    --contour_width $background_options.cloud_shape.contour_width
+                    --contour_color '$background_options.cloud_shape.contour_color'
+                #end if
+            #else
+                --background None
+                #if str($background_options.cloud_shape.cloud_shape_options) == 'mask'
+                    --mask $background_options.cloud_shape.mask
+                #end if
             #end if
-            #if $mask
-                --mask $mask
-            #end if
-            #if $color_choice == "color":
-                --color '$color'
-            #else if $color_choice == "colormask":
-                --colormask $colormask
+            #if $color_choice.color_option == "color":
+                --color '$color_choice.color'
+            #else if $color_choice.color_option == "colormask":
+                --colormask $color_choice.colormask
             #end if
             #if $colormap
                 --colormap $colormap
             #end if
-            #if $mode
-                --mode $mode
-            #end if
-            #if $contour_width
-                --contour_width $contour_width
-            #end if
-            #if $contour_color
-                --contour_color '$contour_color'
-            #end if
             #if str($prefer_horizontal):
                 --prefer_horizontal $prefer_horizontal
             #end if
@@ -120,10 +119,43 @@
         <param argument="--width" type="integer" min="1" value="400" optional="true" label="Define output image width"/>
         <param argument="--height" type="integer" min="1" value="200" optional="true" label="Define output image height"/>
         <param argument="--margin" type="integer" value="2" label="Spacing to leave around words"/>
-        <param argument="--background" type="color" value="#000000" optional="true" label="Use given color as background color for the image">
-            <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
-        </param>
-        <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/>
+        <conditional name="background_options">
+            <param argument="--mode" type="select" label="Use RGB or RGBA for transparent background">
+                <option value="RGB" selected="true">RGB</option>
+                <option value="RGBA">RGBA</option>
+            </param>
+            <when value="RGB">
+                <param argument="--background_color" type="color" value="#000000" optional="true" label="Use given color as background color for the image">
+                    <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
+                </param>
+                <conditional name="cloud_shape">
+                    <param name="cloud_shape_options" type="select" label="Choose word cloud shape">
+                        <option value="rectangle" selected="true">Default - Rectangle</option>
+                        <option value="mask">Mask from image input</option>
+                    </param>
+                    <when value="rectangle"/>
+                    <when value="mask">
+                        <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/>
+                        <param argument="--contour_width" type="float" min="0" value="0" optional="true" label="Contour width" help="Use given color as mask contour color"/>
+                        <param argument="--contour_color" type="color" value="#000000" optional="true" label="Contour color">
+                            <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
+                        </param>
+                    </when>
+                </conditional>
+            </when>
+            <when value="RGBA">
+                <conditional name="cloud_shape">
+                    <param name="cloud_shape_options" type="select" label="Choose word cloud shape">
+                        <option value="rectangle" selected="true">Default - Rectangle</option>
+                        <option value="mask">Mask from image input</option>
+                    </param>
+                    <when value="rectangle"/>
+                    <when value="mask">
+                        <param argument="--mask" type="data" format="png" optional="true" label="Mask to use for the image form"/>
+                    </when>
+                </conditional>
+            </when>
+        </conditional>
         <conditional name="color_choice" label="Choose color option">
             <param name="color_option" type="select" label="Color option">
                 <option value="color">Color</option>
@@ -163,14 +195,6 @@
             <option value="BuGn">BuGn</option>
             <option value="YlGn">YlGn</option>
         </param>
-        <param argument="--mode" type="select" value="RGB" optional="true" label="Use RGB or RGBA for transparent background">
-            <option value="RGB">RGB</option>
-            <option value="RGBA">RGBA</option>
-        </param>
-        <param argument="--contour_width" type="float" min="0" value="0" optional="true" label="Contour width" help="Use given color as mask contour color"/>
-        <param argument="--contour_color" type="color" value="#000000" optional="true" label="Contour color">
-            <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
-        </param>
         <param argument="--prefer_horizontal" type="float" min="0" max="1" value="0.9" optional="true" label="Ratio of times to try horizontal fitting as opposed to vertical"/>
         <param argument="--scale" type="float" value="1.0" optional="True" label="Scaling between computation and drawing"/>
         <param argument="--relative_scaling" type="float" min="0.0" max="1.0" value="0.0" optional="true" label="Scaling of words by frequency (0 - 1)"/>
@@ -185,85 +209,84 @@
     </outputs>
     <tests>
         <test expect_num_outputs="1">
-            <param name="text" value="test.txt" ftype="txt"/>
-            <conditional name="color_choice">
-                <param name="color_option" value="color"/>
-                <param name="color" value="#00ff00"/>
+            <param name="text" value="test.txt"/>
+            <param name="font_step" value="2"/>
+            <param name="min_word_length" value="2"/>
+            <param name="width" value="200"/>
+            <param name="height" value="100"/>
+            <param name="colormap" value="inferno"/>
+            <param name="scale" value="1.8"/>
+            <param name="no_collocations" value="false"/>
+            <conditional name="fonts">
+                <param name="fonts_selector" value="none"/>
             </conditional>
-            <param name="contour_color" value="#1f4068"/>
-            <param name="random_state" value="10"/>
-            <param name="background" value="#000000"/>
-            <output name="output" file="output_1.png" compare="image_diff" />
+            <output name="output" file="output0.png" ftype="png"/>
         </test>
+        
         <test expect_num_outputs="1">
-            <param name="text" value="test.txt" ftype="txt"/>
+            <param name="text" value="test.txt"/>
+            <param name="stopwords" value="stopwords.txt"/>
+            <conditional name="fonts">
+                <param name="fonts_selector" value="cached"/>
+                <param name="fonts_select" value="Test Font"/>
+            </conditional>
+            <output name="output" file="output1.png" ftype="png"/>
+        </test>
+        
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt"/>
             <param name="stopwords" value="stopwords.txt"/>
             <conditional name="fonts">
-                <param name="fonts_selector" value="cached" />
-                <param name="fonts_select" value="test_font"/>
+                <param name="fonts_selector" value="history"/>
+                <param name="fontfile" value="font.ttf"/>
             </conditional>
-            <param name="min_font_size" value="4"/>
-            <param name="max_font_size" value="100"/>
-            <param name="font_step" value="1"/>
-            <param name="min_word_length" value="0"/>
-            <param name="max_words" value="200"/>
-            <param name="width" value="800"/>
-            <param name="height" value="600"/>
-            <param name="margin" value="0"/>
-            <param name="background" value="#ffffff"/>
-            <param name="mask" value="mask.png"/>
+            <output name="output" file="output1.png" ftype="png"/>
+        </test>
+        
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt"/>
+            <param name="stopwords" value="stopwords.txt"/>
+            <conditional name="background_options">
+                <param name="mode" value="RGB"/>
+                <param name="background_color" value="#9141ac"/>
+                <conditional name="cloud_shape">
+                    <param name="cloud_shape_options" value="mask"/>
+                    <param name="mask" value="mask.png"/>
+                    <param name="contour_width" value="1.8"/>
+                    <param name="contour_color" value="#e01b24"/>
+                </conditional>
+            </conditional>
+            <output name="output" file="output2.png" ftype="png"/>
+        </test>
+    
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt"/>
+            <param name="stopwords" value="stopwords.txt"/>
+            <param name="include_numbers" value="true"/>
+            <param name="no_normalize_plurals" value="false"/>
+            <param name="repeat" value="false"/>
+            <param name="random_state" value="10"/>
             <conditional name="color_choice">
                 <param name="color_option" value="color"/>
-                <param name="color" value="#1f4068"/>
+                <param name="color" value="#99c1f1"/>
             </conditional>
-            <param name="colormap" value="viridis"/>
-            <param name="mode" value="RGB"/>
-            <param name="contour_width" value="8"/>
-            <param name="contour_color" value="#1f4068"/>
-            <param name="prefer_horizontal" value="0.9"/>
-            <param name="scale" value="1.0"/>
-            <param name="relative_scaling" value="0.0"/>
-            <param name="no_collocations" value="True"/>
-            <param name="include_numbers" value="False"/>
-            <param name="no_normalize_plurals" value="True"/>
-            <param name="repeat" value="True"/>
-            <param name="random_state" value="10"/>
-            <output name="output" file="output_2.png" compare="image_diff" />
-        </test>
-        <test expect_num_outputs="1">
-            <param name="text" value="test.txt" ftype="txt"/>
-            <param name="stopwords" value="stopwords.txt"/>
-            <conditional name="fonts">
-                <param name="fonts_selector" value="history" />
-                <param name="fontfile" value="font.ttf"/>
+            <conditional name="background_options">
+                <param name="mode" value="RGBA"/>
+                <conditional name="cloud_shape">
+                    <param name="cloud_shape_options" value="rectangle"/>
+                </conditional>
             </conditional>
-            <param name="min_font_size" value="4"/>
-            <param name="max_font_size" value="100"/>
-            <param name="font_step" value="1"/>
-            <param name="min_word_length" value="0"/>
-            <param name="max_words" value="200"/>
-            <param name="width" value="800"/>
-            <param name="height" value="600"/>
-            <param name="margin" value="0"/>
-            <param name="background" value="#ffffff"/>
-            <param name="mask" value="mask.png"/>
+            <output name="output" file="output3.png" ftype="png"/>
+        </test>
+        
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt"/>
+            <param name="stopwords" value="stopwords.txt"/>
             <conditional name="color_choice">
-                <param name="color_option" value="color"/>
-                <param name="color" value="#1f4068"/>
+                <param name="color_option" value="colormask"/>
+                <param name="colormask" value="mask.png"/>
             </conditional>
-            <param name="colormap" value="viridis"/>
-            <param name="mode" value="RGB"/>
-            <param name="contour_width" value="8"/>
-            <param name="contour_color" value="#1f4068"/>
-            <param name="prefer_horizontal" value="0.9"/>
-            <param name="scale" value="1.0"/>
-            <param name="relative_scaling" value="0.0"/>
-            <param name="no_collocations" value="True"/>
-            <param name="include_numbers" value="False"/>
-            <param name="no_normalize_plurals" value="True"/>
-            <param name="repeat" value="True"/>
-            <param name="random_state" value="10"/>
-            <output name="output" file="output_2.png" compare="image_diff" />
+            <output name="output" file="output4.png" ftype="png"/>
         </test>
     </tests>
     <help><![CDATA[