view ggplot_violin.xml @ 11:17b666467c32 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 6737c924917eea8c009c30d7f9917d5a341b9948
author iuc
date Mon, 30 Sep 2024 15:40:28 +0000
parents 0e7290688b50
children
line wrap: on
line source

<tool id="ggplot2_violin" name="Violin plot w ggplot2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools"/>
    <expand macro="requirements">
        <requirement type="package" version="1.4.4">r-reshape2</requirement>
        <requirement type="package" version="2.1.0">r-svglite</requirement>
    </expand>
    <command detect_errors="exit_code"><![CDATA[
cat '$script' &&
Rscript '$script'
    ]]></command>
    <configfiles>
        <configfile name="script"><![CDATA[
@R_INIT@

## Import library
library(reshape2)
library(ggplot2)

## Automatically scaled y axis or user defined
## marco not possible because on y asis relevent
#if $adv.scaling.plot_scaling == "Automatic"
    gg_scaley = NULL
#else
    gg_scaley = ylim($adv.scaling.yaxismin, $adv.scaling.yaxismax)
#end if

integrated <- read.csv('$input1', sep='\t', header=TRUE)
input <- melt(integrated)

@TRANSFORM@

@THEME@

@LEGEND@

#if $adv.drawquartiles == "none"
    gg_quartile = NULL
#else
    gg_quartile = c(0.25, 0.5, 0.75)
#end if

## add advanced plotting options for final plot
plot_out <- ggplot(input, aes(variable, value)) +
    geom_violin(scale = "area", colour = '$adv.ggcolor', fill = '$adv.ggfill', draw_quantiles = gg_quartile) +
    gg_scaley + gg_legend + gg_theme + xlab('$xlab') + ylab('$ylab') + ggtitle('$title')

@SAVE_OUTPUT@
        ]]></configfile>
    </configfiles>
    <inputs>
        <param name="input1" type="data" format="tabular" label="Input in tabular format"
            help="Column headers are requirement. These will be the columns that are plotted."/>
        <expand macro="title" />
        <expand macro="xy_lab" />
        <section name="adv" title="Advanced Options" expanded="false">
            <param name="drawquartiles" type="select" label="Indicate quartiles of your data">
                <option value="none">Plot the data without indicating quartiles</option>
                <option value="indicate">Draw lines to indicate each quartile</option>
            </param>
            <param name="ggfill" type="select" label="Violin color options">
                <option value="blue" selected="true">Default (Blue)</option>
                <option value="black">Black</option>
                <option value="red">Red</option>
                <option value="white">White</option>
                <option value="orange">Orange</option>
                <option value="yellow">Yellow</option>
                <option value="green">Green</option>
                <option value="purple">Purple</option>
                <option value="magenta">Magenta</option>
                <option value="cyan">Cyan</option>
                <option value="grey">Grey</option>
                <option value="gold">Gold</option>
            </param>
            <param name="ggcolor" type="select" label="Violin border options">
                <option value="yellow" selected="true">Default (Yellow)</option>
                <option value="black">Black</option>
                <option value="red">Red</option>
                <option value="white">White</option>
                <option value="blue">Blue</option>
                <option value="orange">Orange</option>
                <option value="green">Green</option>
                <option value="purple">Purple</option>
                <option value="magenta">Magenta</option>
                <option value="cyan">Cyan</option>
                <option value="grey">Grey</option>
                <option value="gold">Gold</option>
            </param>
            <expand macro="transform" />
            <expand macro="xy_scaling" />
            <expand macro="theme" />
            <expand macro="legend" />
        </section>
        <section name="out" title="Output Options" expanded="true">
            <expand macro="dimensions" />
        </section>
    </inputs>
    <outputs>
        <expand macro="additional_output" />
    </outputs>
    <tests>
        <test expect_num_outputs="2">
            <param name="input1" value="mtcars.txt" ftype="tabular"/>
            <param name="additional_output_format" value="pdf" />
            <output name="output2" file="ggplot_violin_result1.pdf" ftype="pdf" compare="sim_size"/>
        </test>
    </tests>
    <help><![CDATA[
        Supply this tool with a text file with headers indicating the various groups to be plotted. This tool will sniff out each column with values that can be plotted and display the distribution of that data group. Note that columns may be excluded from this plot if they contain questionable characters.
    ]]></help>
    <expand macro="citations"/>
</tool>