view chipseeker.xml @ 0:58ef4507ce5a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/chipseeker commit 9324a8e21c41d62b461dce9c3c17df544e5cd0ce
author rnateam
date Thu, 24 May 2018 18:25:40 -0400
parents
children 95f779f4adb7
line wrap: on
line source

<tool id="chipseeker" name="ChIPseeker" version="1.14.2">
    <description>for ChIP peak annotation and visualization</description>
    <requirements>
        <requirement type="package" version="1.14.2">bioconductor-chipseeker</requirement>
        <requirement type="package" version="3.4.0">bioconductor-txdb.hsapiens.ucsc.hg38.knowngene</requirement>
        <requirement type="package" version="3.2.2">bioconductor-txdb.hsapiens.ucsc.hg19.knowngene</requirement>
        <requirement type="package" version="3.4.0">bioconductor-txdb.Mmusculus.UCSC.mm10.knownGene</requirement>
        <requirement type="package" version="3.5.0">bioconductor-org.hs.eg.db</requirement>
        <requirement type="package" version="3.5.0">bioconductor-org.mm.eg.db</requirement>
    </requirements>
    <version_command><![CDATA[
echo $(R --version | grep version | grep -v GNU)", ChIPseeker version" $(R --vanilla --slave -e "library(ChIPseeker); cat(sessionInfo()\$otherPkgs\$ChIPseeker\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", TxDb.Hsapiens.UCSC.hg38.knownGene version" $(R --vanilla --slave -e "library(TxDb.Hsapiens.UCSC.hg38.knownGene); cat(sessionInfo()\$otherPkgs\$TxDb.Hsapiens.UCSC.hg38.knownGene\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", TxDb.Hsapiens.UCSC.hg19.knownGene version" $(R --vanilla --slave -e "library(TxDb.Hsapiens.UCSC.hg19.knownGene); cat(sessionInfo()\$otherPkgs\$TxDb.Hsapiens.UCSC.hg19.knownGene\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", TxDb.Mmusculus.UCSC.mm10.knownGene version" $(R --vanilla --slave -e "library(TxDb.Mmusculus.UCSC.mm10.knownGene); cat(sessionInfo()\$otherPkgs\$TxDb.Mmusculus.UCSC.mm10.knownGene\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", org.Hs.eg.db version" $(R --vanilla --slave -e "library(org.Hs.eg.db); cat(sessionInfo()\$otherPkgs\$org.Hs.eg.db\$Version)" 2> /dev/null | grep -v -i "WARNING: ")", org.Mm.eg.db version" $(R --vanilla --slave -e "library(org.Mm.eg.db); cat(sessionInfo()\$otherPkgs\$org.Mm.eg.db\$Version)" 2> /dev/null | grep -v -i "WARNING: ")
    ]]></version_command>
    <command detect_errors="exit_code"><![CDATA[
        #if $rscript:
            cp '${chipseeker_script}' '${out_rscript}' &&
        #end if
        Rscript '${chipseeker_script}'
    ]]>
    </command>
    <configfiles>
        <configfile name="chipseeker_script"><![CDATA[
options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )

# we need that to not crash galaxy with an UTF8 error on German LC settings.
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")

suppressPackageStartupMessages(library(ChIPseeker))

genome <- "${genome}"

if (genome == "hg38") {
    suppressPackageStartupMessages({
        library(TxDb.Hsapiens.UCSC.hg38.knownGene)
        library(org.Hs.eg.db)
    })
    txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
    annodb <- "org.Hs.eg.db"
} else if (genome == "hg19") {
    suppressPackageStartupMessages({
        library(TxDb.Hsapiens.UCSC.hg19.knownGene)
        library(org.Hs.eg.db)
    })
    txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
    annodb <- "org.Hs.eg.db"
} else if (genome == "mm10") {
    suppressPackageStartupMessages({
        library(TxDb.Mmusculus.UCSC.mm10.knownGene)
        library(org.Mm.eg.db)
    })
    txdb <- TxDb.Mmusculus.UCSC.mm10.knownGene
    annodb <- "org.Mm.eg.db"
} else {
    cat(paste("Genome not supported", genome))
}

peaks <- readPeakFile('$peaks_file')
peakAnno <-  annotatePeak(peaks, TxDb=txdb, annoDb=annodb)
write.table(peakAnno, file='$out_tab', sep="\t", row.names=FALSE, quote=FALSE)

if (!is.null("${pdf}")) {
    pdf("out.pdf", width=14)
    plotAnnoPie(peakAnno)
    plotAnnoBar(peakAnno)
    vennpie(peakAnno)
    upsetplot(peakAnno)
    plotDistToTSS(peakAnno, title="Distribution of transcription factor-binding loci\nrelative to TSS")
    dev.off()
}
    ]]></configfile>
    </configfiles>

    <inputs>
        <param name="peaks_file" type="data" format="bed" label="Peaks file" help="A peaks file in BED format." />
        <param name="genome" type="select" label="Genome" help="Select the genome. Options are hg38, hg19 or mm10.">
            <option value="hg38">hg38</option>
            <option value="hg19">hg19</option>
            <option value="mm10">mm10</option>
        </param>

        <param name="pdf" type="boolean" truevalue="True" falsevalue="" checked="True" label="Output a PDF file of plots?" help="Default: Yes" />
        <param name="rscript" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="False" label="Output Rscript?" help="If this option is set to Yes, the Rscript used to annotate the IDs will be provided as a text file in the output. Default: No" />
    </inputs>

        <outputs>
            <data name="out_tab" format="tabular" from_work_dir="out.tab" label="${tool.name} on ${on_string}: Annotated Peaks" />
            <data name="out_plots" format="pdf" from_work_dir="out.pdf" label="${tool.name} on ${on_string}: Plots">
                <filter>pdf</filter>
            </data>
            <data name="out_rscript" format="txt" from_work_dir="out_rscript.txt" label="${tool.name} on ${on_string}: Rscript">
                <filter>rscript</filter>
            </data>
        </outputs>

    <tests>
        <!-- Ensure outputs work -->
        <test expect_num_outputs="3">
            <param name="peaks_file" value="in.diffbind" ftype="bed"/>
            <param name="genome" value="hg19"/>
            <param name="rscript" value="True"/>
            <output name="out_tab" file="out.tab" />
            <output name="out_plots" file="out.pdf" compare="sim_size"/>
            <output name="out_rscript" >
                <assert_contents>
                    <has_text_matching expression="peakAnno.*annotatePeak" />
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[

.. class:: infomark

**What it does**

ChIPseeker_ is a Bioconductor package for annotating ChIP-seq data analysis. See
the `ChIPseeker vignette`_ for more information.

-----

**Inputs**

A peaks file in BED format e.g from MACS2 or DiffBind.

-----

**Outputs**

This tool outputs

    * a table of annotated peaks
    * a PDF of plots
    * the R script used by this tool

.. _ChIPseeker: https://bioconductor.org/packages/release/bioc/html/ChIPseeker.html
.. _`ChIPseeker vignette`: http://bioconductor.org/packages/release/bioc/vignettes/ChIPseeker/inst/doc/ChIPseeker.html

]]></help>
    <citations>
        <citation type="doi">10.1093/bioinformatics/btv145</citation>
    </citations>
</tool>