Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wordcloud #1552

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tools/wordcloud/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: wordcloud
owner: bgruening
description: A little word cloud generator in Python.
long_description: |
The wordcloud library allows you to create word clouds from text data.
It is highly customizable and can generate word clouds in various shapes and colors.
The wordcloud library is available as an open-source project on GitHub.
remote_repository_url: https://github.com/bgruening/galaxytools/tree/master/tools/wordcloud
homepage_url: https://github.com/amueller/word_cloud
type:
categories:
- Visualization
8 changes: 8 additions & 0 deletions tools/wordcloud/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<macros>
<token name="@TOOL_VERSION@">1.9.4</token>
<token name="@VERSION_SUFFIX@">0</token>
<token name="@PROFILE@">23.0</token>
<xml name="requirements">
<requirement type="package" version="1.9.4">wordcloud</requirement>
</xml>
</macros>
Binary file added tools/wordcloud/test-data/DroidSansMono.ttf
Binary file not shown.
Binary file added tools/wordcloud/test-data/colormask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/wordcloud/test-data/font.ttf
Binary file not shown.
Binary file added tools/wordcloud/test-data/mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tools/wordcloud/test-data/regxp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\w[\w']+
7 changes: 7 additions & 0 deletions tools/wordcloud/test-data/stopwords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
is
an
for
the
open
source
platform
1 change: 1 addition & 0 deletions tools/wordcloud/test-data/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Galaxy is an open source, web-based platform for data intensive biomedical research. Galaxy contains more than 800 different single analysis tools and ready-to-use pipelines for different applications.
174 changes: 174 additions & 0 deletions tools/wordcloud/wordcloud.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<tool id="wordcloud" name="wordcloud" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@" license="MIT">
<description>A little word cloud generator in Python.</description>
<macros>
<import>macros.xml</import>
</macros>
<requirements>
<expand macro="requirements"/>
</requirements>
<command detect_errors="exit_code"><![CDATA[
wordcloud_cli \
--text $text
#if $regexp
--regexp $regexp
#end if
#if $stopwords
--stopwords $stopwords
#end if
--fontfile $fontfile
--min_font_size $min_font_size
--max_font_size $max_font_size
--font_step $font_step
--margin $margin
--color $color
--background $background
#if $mask
--mask $mask
#end if
#if $colormask
--colormask $colormask
#end if
--contour_width $contour_width
--contour_color $contour_color
--relative_scaling $relative_scaling
#if $no_collocations == "True"
--no_collocations
#end if
#if $include_numbers == "True"
--include_numbers
#end if
--min_word_length $min_word_length
--prefer_horizontal $prefer_horizontal
--scale $scale
--colormap $colormap
--mode $mode
--max_words $max_words
--width $width
--height $height
#if $random_state
--random_state $random_state
#end if
#if $no_normalize_plurals == "True"
--no_normalize_plurals
#end if
#if $repeat == "True"
--repeat
#end if
--imagefile wordcloud.png
]]></command>
<inputs>
<param argument="--text" type="data" format="txt" label="Input file" help="Input file to process"/>
<param argument="--regexp" type="data" format="txt" optional="True" label="Regular expression to filter words" help="regular expression to filter words"/>
<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="ttf" label="Font file you wish to use " help=" The font file you want to use"/>
<param argument="--min_font_size" value="4" type="integer" label=" Smallest font size to use" optional="False"/>
<param argument="--max_font_size" type="integer" label="Maximum font size for the largest word" optional="False"/>
<param argument="--font_step" value="1" type="integer" label="Step size for the font" help="Font_step &gt; 1 might speed up computation but give a worse fit"/>
<param argument="--margin" value="2" type="integer" label="Spacing to leave around words"/>
<param argument="--color" type="color" label="Use given color as coloring for the image" value="#00FF00">
<validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
</param>
<param argument="--background" type="color" label="Use given color as background color for the image" value="#000000">
<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"/>
<param argument="--colormask" type="data" format="png" optional="True" label="Color mask to use for image coloring"/>
<param argument="--contour_width" value="0" min="0" type="float" label="Contour width" help="Use given color as mask contour color"/>
<param argument="--contour_color" type="color" label="Contour color" value="#000000">
<validator type="regex" message="Please select a valid RGB color">[#][0-9A-Fa-f]{6}</validator>
</param>
<param argument="--relative_scaling" value="0.0" min="0.0" max="1.0" type="float" label="Scaling of words by frequency (0 - 1)"/>
<param argument="--no_collocations" type="boolean" truevalue="True" falsevalue="False" value="True" label="Do not add collocations (bigrams) to word cloud"/>
<param argument="--include_numbers" type="boolean" truevalue="True" falsevalue="False" value="False" label="Whether to include numbers as phrases or not"/>
<param argument="--min_word_length" value="0" type="integer" label="Minimum number of letters a word must have to be included"/>
<param argument="--prefer_horizontal" value="0.9" type="float" label="Ratio of times to try horizontal fitting as opposed to vertical" min="0" max="1"/>
<param argument="--scale" value="1.0" type="float" label="Scaling between computation and drawing"/>
<param argument="--colormap" type="select" label="Matplotlib colormap name" value="viridis">
<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" label="Use RGB or RGBA for transparent background" value="RGB">
<option value="RGB">RGB</option>
<option value="RGBA">RGBA</option>
</param>
<param argument="--max_words" value="200" type="integer" label="Maximum number of words"/>
<param argument="--width" value="400" type="integer" label="Define output image width"/>
<param argument="--height" type="integer" value="200" label="Define output image height"/>
<param argument="--random_state" type="integer" label="Random seed"/>
<param argument="--no_normalize_plurals" value="True" type="boolean" optional="True" label="Whether to remove trailing s from words"/>
<param argument="--repeat" type="boolean" truevalue="True" falsevalue="False" value="False" label="Whether to repeat words and phrases until max_words or min_font_size is reached"/>
</inputs>
<outputs>
<data name="output_image" format="png" from_work_dir="wordcloud.png" label="${tool.name} on ${on_string}.png">
<filter>'png' in output_format</filter>
</data>
</outputs>
<tests>
<test expect_num_outputs="1">
<param name="text" value="test.txt"/>
<param name="regexp" value="regxp.txt"/>
<param name="stopwords" value="stopwords.txt"/>
<param name="fontfile" value="font.ttf"/>
<param name="mask" value="mask.png"/>
<param name="colormask" value="colormask.png"/>
<param name="contour_width" value="1"/>
<param name="contour_color" value="#000000"/>
<param name="relative_scaling" value="1"/>
<param name="margin" value="1"/>
<param name="width" value="400"/>
<param name="height" value="400"/>
<param name="color" value="#00FF00"/>
<param name="background" value="#FF0000"/>
<param name="no_collocations" value="False"/>
<param name="include_numbers" value="True"/>
<param name="min_word_length" value="1"/>
<param name="prefer_horizontal" value="0.5"/>
<param name="scale" value="1"/>
<param name="colormap" value="viridis"/>
<param name="mode" value="RGB"/>
<param name="max_words" value="100"/>
<param name="min_font_size" value="1"/>
<param name="max_font_size" value="100"/>
<param name="font_step" value="1"/>
<param name="random_state" value="10"/>
<param name="no_normalize_plurals" value="False"/>
<param name="repeat" value="False"/>
<output name="output_image" file="wordcloud.png"/>
</test>
</tests>
<help><![CDATA[
A little word cloud generator in Python.
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>
Loading