view inspect_eset.xml @ 7:94c0b3baf8fd draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/music/ commit d5c7ca22af1d4f0eaa7a607886554bebb95e8c50
author bgruening
date Tue, 29 Oct 2024 13:39:52 +0000
parents 7705cc75ac18
children fde4c972e7c5
line wrap: on
line source

<tool id="music_inspect_eset" name="Inspect Expression Set Object" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"
      profile="21.09" license="GPL-3.0-or-later" >
    <description>Inspect an ExpressionSet object by a variety of attributes</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command detect_errors="exit_code"><![CDATA[
cat '$conf' >> /dev/stderr &&
Rscript --vanilla '$conf'
]]></command>
    <configfiles>
        <configfile name="conf" >

null_str_vec = function(gstr){
   tokens = unlist(as.vector(strsplit(gstr, split=",")))
   if (length(tokens) == 0){
      return(NULL)
   }
   if (length(tokens) == 1){
      return(tokens[[1]])
   }
   return(tokens)
}

rds_eset = readRDS('$rds_eset')
inspector = null_str_vec('$inspector')
outfile_tab='$out_tab'

suppressWarnings(suppressPackageStartupMessages(library(xbioc)))
suppressWarnings(suppressPackageStartupMessages(library(MuSiC)))

printout = function(text) {
    if (typeof(text) %in% c("list", "vector", "integer", "double", "numeric")) {
        write.table(text, file = outfile_tab, quote = F, sep = "\t",
                    col.names = NA)
    } else {
        ## text
        print(typeof(text))
        capture.output(text, file = outfile_tab)  # nolint
    }
}

if (inspector %in% c("print", "pData", "fData", "dims",
                     "experimentData", "protocolData", "exprs",
                     "signature", "annotation", "abstract")) {
    op = get(inspector)
    tab = op(rds_eset)
    printout(tab)
} else {
    stop(paste0("No such option:", inspector))
}

print(rds_eset)

        </configfile>
    </configfiles>
    <inputs>
        <param name="rds_eset" label="ESet Dataset" type="data" format="@RDATATYPE@" />
        <param name="inspector" label="Inspect" type="select"
               help="Inspect an aspect of the ESet dataset" >
            <!-- See: https://www.rdocumentation.org/packages/Biobase/versions/2.32.0/topics/eSet -->
            <option value="print" selected="true">General Information</option>
            <option value="exprs" >Expression Data Table</option>
            <option value="pData" >PhenoType Data Table</option>
            <option value="fData" >Feature Data Table</option>
            <option value="dims" >Dimension</option>
            <option value="protocolData">Protocol Data</option>
            <option value="experimentData" >Experiment Data</option>
            <option value="annotation" >Annotation</option>
            <option value="signature" >Signature (requires Annotation)</option>
            <option value="abstract" >Abstract</option>
        </param>
    </inputs>
    <outputs>
        <data name="out_tab" format="tabular" label="${tool.name} on ${on_string}: Inspection Result (${inspector})" />
    </outputs>
    <tests>
        <test expect_num_outputs="1" >
            <!-- Inspect 0 -->
            <param name="rds_eset" value="EMTABesethealthy.subset.rds" />
            <param name="inspector" value="print" />
            <output name="out_tab" >
                <assert_contents>
                    <has_text text="sampleNames: AZ_A10 AZ_A11 ... HP1502401_K15 (250 total)" />
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1" >
            <!-- Inspect 1 -->
            <param name="rds_eset" value="EMTABesethealthy.subset.rds" />
            <param name="inspector" value="pData" />
            <output name="out_tab" >
                <assert_contents>
                    <has_n_columns n="5" />
                    <has_text_matching expression="AZ_A10\s+1\s+Non T2D\s+1\s+5\s+delta" />
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="1" >
            <!-- Inspect 2 -->
            <param name="rds_eset" value="EMTABesethealthy.subset.rds" />
            <param name="inspector" value="dims" />
            <output name="out_tab" >
                <assert_contents>
                    <has_text_matching expression="Samples\s+\d{1,4}"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
Inspect an ExpressionSet object by a variety of attributes, such as experimentData, phenotype data, and annotations.

For more options and information, consult `the manual <http://www.bioconductor.org/packages/release/bioc/vignettes/Biobase/inst/doc/ExpressionSetIntroduction.pdf>`_ and the `rdocumentation <https://www.rdocumentation.org/packages/Biobase/versions/2.32.0/topics/ExpressionSet>`_
.
    ]]></help>
    <citations>
        <citation type="bibtex">
            @misc{falcon2007introduction,
            title={An introduction to bioconductor’s expressionset class},
            author={Falcon, Seth and Morgan, Martin and Gentleman, Robert},
            year={2007}
            }
        </citation>
    </citations>
</tool>