changeset 0:54c2d8ebf0cf draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/wordcloud commit 6d08a14015698273ace1032aeefd2eb7bd404862
author bgruening
date Fri, 13 Dec 2024 21:43:12 +0000
parents
children
files test-data/font.ttf test-data/mask.png test-data/output_1.png test-data/output_2.png test-data/stopwords.txt test-data/test.txt wordcloud.xml
diffstat 7 files changed, 214 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file test-data/font.ttf has changed
Binary file test-data/mask.png has changed
Binary file test-data/output_1.png has changed
Binary file test-data/output_2.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/stopwords.txt	Fri Dec 13 21:43:12 2024 +0000
@@ -0,0 +1,1 @@
+an
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.txt	Fri Dec 13 21:43:12 2024 +0000
@@ -0,0 +1,1 @@
+Galaxy is an open source, web-based platform for data intensive biomedical research.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wordcloud.xml	Fri Dec 13 21:43:12 2024 +0000
@@ -0,0 +1,212 @@
+<tool id="wordcloud" name="Generate a word cloud" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT">
+    <description>with highly customizable appearance</description>
+    <macros>
+        <token name="@TOOL_VERSION@">1.9.4</token>
+        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@PROFILE@">23.0</token>
+    </macros>
+    <requirements>
+        <requirement type="package" version="1.9.4">wordcloud</requirement>
+    </requirements>
+    <version_command>wordcloud_cli --version</version_command>
+    <command detect_errors="exit_code"><![CDATA[
+        wordcloud_cli
+            --imagefile 'output.png'
+            --text $text 
+            #if $stopwords
+                --stopwords $stopwords
+            #end if
+            #if $fontfile
+                --fontfile $fontfile
+            #end if
+            #if $min_font_size
+                --min_font_size $min_font_size
+            #end if
+            #if $max_font_size
+                --max_font_size $max_font_size
+            #end if
+            #if $font_step
+                --font_step $font_step
+            #end if
+            #if $min_word_length
+                --min_word_length $min_word_length
+            #end if
+            #if str($max_words):
+                --max_words $max_words
+            #end if
+            #if str($width):
+                --width $width
+            #end if
+            #if str($height):
+                --height $height
+            #end if
+            #if str($margin):
+                --margin $margin
+            #end if
+            #if $background
+                --background '$background'
+            #end if
+            #if $mask
+                --mask $mask
+            #end if
+            #if $color_choice == "color":
+                --color '$color'
+            #else if $color_choice == "colormask":
+                --colormask $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
+            #if str($scale):
+                --scale $scale
+            #end if
+            #if str($relative_scaling):
+                --relative_scaling $relative_scaling
+            #end if
+            $no_collocations
+            $include_numbers
+            $no_normalize_plurals
+            $repeat
+            #if $random_state
+                --random_state $random_state
+            #end if
+        ]]>
+    </command>
+    <inputs>
+        <param argument="--text" type="data" format="txt" label="Input file" help="Input file to process"/>
+        <param argument="--stopwords" type="data" format="txt" optional="true" label="Stopwords file" help="Specify file of stopwords (containing one word per line) to remove from the given text after parsing"/>
+        <param argument="--fontfile" type="data" format="binary" optional="true" label="Font file you wish to use " help="The font file you want to use"/>
+        <param argument="--min_font_size" type="integer" min="1" value="4" optional="true" label=" Smallest font size to use" />
+        <param argument="--max_font_size" type="integer" min="1" optional="true" label="Maximum font size for the largest word" />
+        <param argument="--font_step" type="integer" value="1" label="Step size for the font" help="Font_step &gt; 1 might speed up computation but give a worse fit"/>
+        <param argument="--min_word_length" type="integer" value="0" optional ="True" label="Minimum number of letters a word must have to be included"/>
+        <param argument="--max_words" type="integer" min="1" value="200" optional="true" label="Maximum number of words"/>
+        <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="color_choice" label="Choose color option">
+            <param name="color_option" type="select" label="Color option">
+                <option value="color">Color</option>
+                <option value="colormask">Color Mask</option>
+            </param>
+            <when value="color">
+                <param argument="--color" type="color" value="#00FF00" optional="true" label="Use given color as coloring for the image">
+                    <validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
+                </param>
+            </when>
+            <when value="colormask">
+                <param argument="--colormask" type="data" format="png" optional="true" label="Color Mask" help="Upload a color mask image"/>
+            </when>
+        </conditional>
+        <param argument="--colormap" type="select" value="viridis" optional="true" label="Matplotlib colormap name">
+            <option value="viridis">viridis</option>
+            <option value="plasma">plasma</option>
+            <option value="inferno">inferno</option>
+            <option value="magma">magma</option>
+            <option value="cividis">cividis</option>
+            <option value="Greys">Greys</option>
+            <option value="Purples">Purples</option>
+            <option value="Blues">Blues</option>
+            <option value="Greens">Greens</option>
+            <option value="Oranges">Oranges</option>
+            <option value="Reds">Reds</option>
+            <option value="YlOrBr">YlOrBr</option>
+            <option value="YlOrRd">YlOrRd</option>
+            <option value="OrRd">OrRd</option>
+            <option value="PuRd">PuRd</option>
+            <option value="RdPu">RdPu</option>
+            <option value="BuPu">BuPu</option>
+            <option value="GnBu">GnBu</option>
+            <option value="PuBu">PuBu</option>
+            <option value="YlGnBu">YlGnBu</option>
+            <option value="PuBuGn">PuBuGn</option>
+            <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)"/>
+        <param argument="--no_collocations" type="boolean" truevalue="--no_collocations" falsevalue="" value="True" label="Do not add collocations (bigrams) to word cloud"/>
+        <param argument="--include_numbers" type="boolean" truevalue="--include_numbers" falsevalue="" value="False" label="Whether to include numbers as phrases or not"/>
+        <param argument="--no_normalize_plurals" type="boolean" truevalue="--no_normalize_plurals" falsevalue="" label="Whether to remove trailing s from words"/>
+        <param argument="--repeat" type="boolean" truevalue="--repeat" falsevalue="" label="Whether to repeat words and phrases until max_words or min_font_size is reached"/>
+        <param argument="--random_state" type="integer" value="10" label="Random seed" />
+    </inputs>
+    <outputs>
+        <data name="output" format="png" label="Word cloud image" from_work_dir="output.png"/>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt" ftype="txt"/>
+            <param name="random_state" value="10"/>
+            <output name="output" file="output_1.png" compare="image_diff" />
+        </test>
+        <test expect_num_outputs="1">
+            <param name="text" value="test.txt" ftype="txt"/>
+            <param name="stopwords" value="stopwords.txt"/>
+            <param name="fontfile" value="font.ttf"/>
+            <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"/>
+            <param name="color" value="#1F4068"/>
+            <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>
+    </tests>
+    <help><![CDATA[
+A word cloud is a visual representation (image) of word data. In other words, it is a collection, or cluster, of words depicted in different sizes.
+The bigger and bolder the word appears, the more often it's mentioned within a given text and the more important it is.
+    ]]></help>
+    <citations>
+        <citation type="bibtex">
+            @misc{amueller2018wordcloud,
+                title={Word Clouds with Python},
+                author={Amueller, Sebastian},
+                year={2018},
+                url={https://amueller.github.io/word_cloud/}
+            }
+        </citation>
+    </citations>
+</tool>