Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change input format of plotdexseq tool from rdata to rds #6709

Merged
merged 7 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/dexseq/macros.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<macros>
<token name="@TOOL_VERSION@">1.48.0</token>
<token name="@VERSION_SUFFIX@">0</token>
<token name="@PROFILE@">22.01</token>
<token name="@VERSION_SUFFIX@">1</token>
<token name="@PROFILE@">23.0</token>
<xml name="requirements">
<requirements>
<requirement type="package" version="@TOOL_VERSION@">bioconductor-dexseq</requirement>
Expand Down
10 changes: 8 additions & 2 deletions tools/dexseq/plotdexseq.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ spec <- matrix(c(
"transcripts", "t", 1, "logical",
"names", "a", 1, "logical",
"normcounts", "n", 1, "logical",
"splicing", "s", 1, "logical"
"splicing", "s", 1, "logical",
"pl_width", "w", 2, "integer",
"pl_height", "h", 2, "integer"
), byrow = TRUE, ncol = 4)
opt <- getopt(spec)

Expand All @@ -38,8 +40,12 @@ if (!is.null(opt$genefile)) {
genes <- opt$geneid
}

pdf("plot.pdf")
pl_width <- pl_height <- 7
if (!is.null(opt$pl_width)) pl_width <- opt$pl_width
if (!is.null(opt$pl_height)) pl_height <- opt$pl_height
pdf("plot.pdf", width = pl_width, height = pl_height)
for (i in genes) {
par(oma = c(pl_height * 0.2, pl_width * 0.2, pl_height * 0.2, pl_width * 0.2))
plotDEXSeq(res, i,
FDR = opt$fdr, fitExpToVar = opt$primaryfactor,
norCounts = opt$normcounts, expression = TRUE, splicing = opt$splicing,
Expand Down
35 changes: 31 additions & 4 deletions tools/dexseq/plotdexseq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ Rscript '$__tool_directory__/plotdexseq.R'
-a $names
-n $normcounts
-s $splicing
#if $pl_width:
-w $pl_width
#end if
#if $pl_height:
-h $pl_height
#end if
]]></command>
<inputs>
<param name="rdata" type="data" format="rdata" label="DEXSeqResults object" help="A DEXSeqResults object in RDS format. This can be output from the DEXSeq tool"/>
<param name="rdata" type="data" format="rds" label="DEXSeqResults object" help="A DEXSeqResults object in RDS format. This can be output from the DEXSeq tool"/>
<param name="primaryfactor" type="text" value="FactorName" label="Specify the primary factor name in the DEXSeqResults object" help="Only letters, numbers and underscores will be retained in this field">
<sanitizer>
<valid initial="string.letters,string.digits"><add value="_" /></valid>
Expand All @@ -38,7 +44,7 @@ Rscript '$__tool_directory__/plotdexseq.R'
<when value="single">
<param name="geneid" type="text" label="Gene identifier" help="Gene identifier to visualize">
<sanitizer>
<valid initial="string.letters,string.digits"><add value="_" /></valid>
<valid initial="string.letters,string.digits,string.punctuation"><add value="_" /></valid>
</sanitizer>
</param>
</when>
Expand All @@ -51,6 +57,8 @@ Rscript '$__tool_directory__/plotdexseq.R'
<param name="names" type="boolean" truevalue="True" falsevalue="False" checked="False" label="Display transcript names" help="If Yes, the names of the transcripts are shown. Default: No"/>
<param name="normcounts" type="boolean" truevalue="True" falsevalue="False" checked="False" label="Plot count values from the individual samples" help="If yes, provides a plot of the counts normalized by the size factors. Default: No"/>
<param name="splicing" type="boolean" truevalue="True" falsevalue="False" checked="False" label="Plot exon usage" help="If yes, the samples gene expression effects are averaged out, leaving only exon usage coefficients. Default: No" />
<param name="pl_width" type="integer" optional="true" value="" label="Width of the plot" help="In inches, Default: 7" />
<param name="pl_height" type="integer" optional="true" value="" label="Height of the plot" help="In inches, Default: 7" />
</inputs>

<outputs>
Expand All @@ -61,18 +69,37 @@ Rscript '$__tool_directory__/plotdexseq.R'
<test expect_num_outputs="1">
<param name="rdata" ftype="rdata" value="dexseq.rds"/>
<param name="primaryfactor" value="condition"/>
<param name="geneid" value="FBgn0000053"/>
<conditional name="genes">
<param name="genes_select" value="single" />
<param name="geneid" value="FBgn0000053"/>
</conditional>
<param name="fdr_cutoff" value="1"/>
<output name="dexseq_plot" ftype="pdf" file="plotdexseq.pdf" compare="sim_size"/>
</test>
<!-- Ensure plotting multiple genes works-->
<test expect_num_outputs="1">
<param name="rdata" ftype="rdata" value="dexseq.rds"/>
<param name="primaryfactor" value="condition"/>
<param name="genefile" ftype="tabular" value="plotdexseq_genes.tab"/>
<conditional name="genes">
<param name="genes_select" value="list" />
<param name="genefile" ftype="tabular" value="plotdexseq_genes.tab"/>
</conditional>
<param name="fdr_cutoff" value="1"/>
<output name="dexseq_plot" ftype="pdf" file="plotdexseq_multi.pdf" compare="sim_size"/>
</test>
<!-- Ensure plotting with non-default dimensions works-->
<test expect_num_outputs="1">
<param name="rdata" ftype="rdata" value="dexseq.rds"/>
<param name="primaryfactor" value="condition"/>
<conditional name="genes">
<param name="genes_select" value="list" />
<param name="genefile" ftype="tabular" value="plotdexseq_genes.tab"/>
</conditional>
<param name="fdr_cutoff" value="1"/>
<param name="pl_width" value="5"/>
<param name="pl_height" value="3"/>
<output name="dexseq_plot" ftype="pdf" file="plotdexseq_multi_custom_dim.pdf" compare="sim_size"/>
</test>
</tests>
<help><![CDATA[
.. class:: infomark
Expand Down
Binary file modified tools/dexseq/test-data/plotdexseq.pdf
Binary file not shown.
Binary file modified tools/dexseq/test-data/plotdexseq_multi.pdf
Binary file not shown.
Binary file not shown.