view cast.xml @ 0:8bdfdef5fcb7 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/reshape2 commit 6e466ce83e2e5c0dd0ba30356d0488cf74574b8f
author iuc
date Tue, 22 Aug 2017 07:29:56 -0400
parents
children
line wrap: on
line source

<tool id="cast" name="cast" version="@VERSION@">
    <description>expand combinations of variables:values to columnar format</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"></expand>
    <command detect_errors="exit_code"><![CDATA[
cat '$script' &&
Rscript '$script'
    ]]></command>
    <configfiles>
        <configfile name="script"><![CDATA[
## Setup R error handling to go to stderr
options(show.error.messages=F, error=function(){cat(geterrmessage(),file=stderr());q("no",1,F)})
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")

## Import library
library("reshape2")

input <- read.csv('$input', sep='\t', header=TRUE)
cinput <- dcast(input, ... ~ variable)
write.table(cinput, "output.tabular", sep="\t", quote=FALSE, row.names=FALSE)

        ]]></configfile>
    </configfiles>
    <inputs>
        <param name="input" type="data" format="tabular" label="Input should be molten data"/>
    </inputs>
    <outputs>
        <data name="output" format="tabular" from_work_dir="output.tabular"/>
    </outputs>
    <tests>
        <test>
            <param name="input" value="melt_result1.tabular"/>
            <output name="output" file="cast_result1.tabular"/>
        </test>
    </tests>
    <help><![CDATA[
This tool will apply the dcast function of the reshape2 R package. The input data should be in a 'long' format or molten by the melt tool. The output will be in a wide format.
The cast function expands each unique variable:value combination on a single line to columnar format. Documantation on the reshape2 package can be found here: https://cran.r-project.org/web/packages/reshape2/reshape2.pdf
    ]]></help>
    <citations>
        <citation type="bibtex">
@Article{,
    title = {Reshaping Data with the {reshape} Package},
    author = {Hadley Wickham},
    journal = {Journal of Statistical Software},
    year = {2007},
    volume = {21},
    number = {12},
    pages = {1--20},
    url = {http://www.jstatsoft.org/v21/i12/},
  }
        </citation>
    </citations>
</tool>