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

planemo upload for repository commit 6e466ce83e2e5c0dd0ba30356d0488cf74574b8f
author iuc
date Tue, 22 Aug 2017 07:29:56 -0400
line wrap: on
line source

<tool id="cast" name="cast" version="@VERSION@">
    <description>expand combinations of variables:values to columnar format</description>
    <expand macro="requirements"></expand>
    <command detect_errors="exit_code"><![CDATA[
cat '$script' &&
Rscript '$script'
        <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

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

        <param name="input" type="data" format="tabular" label="Input should be molten data"/>
        <data name="output" format="tabular" from_work_dir="output.tabular"/>
            <param name="input" value="melt_result1.tabular"/>
            <output name="output" file="cast_result1.tabular"/>
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:
        <citation type="bibtex">
    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 = {},