view ggplot_violin.xml @ 4:637cf21db396 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit d1da3cf72a15d88fc265edc5d64e6b820b6a2b2f
author iuc
date Sun, 24 Mar 2019 13:22:26 -0400
parents 43778344b955
children dfd5d981b5a4
line wrap: on
line source

<tool id="ggplot2_violin" name="Violin plot w ggplot2" version="@VERSION@+galaxy0">
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <requirement type="package" version="1.4.3">r-reshape2</requirement>
        <requirement type="package" version="1.2.1">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" />
            <conditional name="scaling">
                <param name="plot_scaling" type="select" label="Axis scaling">
                    <option value="Automatic" selected="true">Automatic axis scaling</option>
                    <option value="Defined">User deined axis scales</option>
                </param>
                <when value="Automatic" />
                <when value="Defined">
                    <param name="yaxismin" type="integer" value="0" label="minimal range of y-axis" />
                    <param name="yaxismax" type="integer" value="3" label="maximal range of y-axis" />
                </when>
            </conditional>
            <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>
            <param name="input1" value="mtcars.txt" ftype="tabular"/>
            <param name="additional_output_format" value="pdf" />
            <output name="output2" file="ggplot_violin_result1.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>