view ggplot_violin.xml @ 1:d85535076554 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 97544038b04c02170ab82877db666fa3022e4469
author iuc
date Tue, 29 Aug 2017 09:02:49 -0400
parents a597d59df9ee
children 43778344b955
line wrap: on
line source

<tool id="ggplot2_violin" name="Violin plot w ggplot2" version="@VERSION@">
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements">
        <requirement type="package" version="1.4.2">r-reshape2</requirement>
    </expand>
    <command detect_errors="exit_code"><![CDATA[
cat '$script' &&
Rscript '$script' &&
mv output_plot.pdf $output1
    ]]></command>
    <configfiles>
        <configfile name="script"><![CDATA[

@R_INIT@

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

## Choose between automatically scaled x and y axis or user defined
#if $scaling.plot_scaling == "Automatic"
    gg_scaley = NULL
#else
    gg_scaley = ylim($scaling.yaxismin, $scaling.yaxismax)
#end if

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

@TRANSFORM@

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


ggplot(input, aes(variable, value)) + geom_violin(scale = "area", colour = '$ggcolor', fill = '$ggfill', draw_quantiles = gg_quartile) +
gg_scaley + theme_bw() + xlab('$xlab') + ylab('$ylab') + ggtitle('$title')

ggsave(file='output_plot.pdf')
dev.off()

        ]]></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" />
        <conditional name="scaling">
            <param name="plot_scaling" type="select" label="Advanced - 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="transform" />
        <param name="drawquartiles" type="select" label="Advanced - 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="Advanced - 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="Advanced - 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>
    </inputs>
    <outputs>
        <data name="output1" format="pdf" from_work_dir="Rplot.pdf"/>
    </outputs>
    <tests>
        <test>
            <param name="input1" value="mtcars.txt" ftype="tabular"/>
            <output name="output1" 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>