changeset 18:ffa256d657b2 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit ed4091f895ae0f46323534ca42da290c6e103598
author iuc
date Fri, 31 Jan 2025 18:00:29 +0000
parents d104044e4257
children
files dexseq.R dexseq_count.xml macros.xml plotdexseq.R plotdexseq.xml test-data/plotdexseq.pdf test-data/plotdexseq_multi.pdf test-data/plotdexseq_multi_custom_dim.pdf
diffstat 8 files changed, 64 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/dexseq.R	Tue Apr 04 08:25:36 2023 +0000
+++ b/dexseq.R	Fri Jan 31 18:00:29 2025 +0000
@@ -16,8 +16,8 @@
 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
 args <- commandArgs(trailingOnly = TRUE)
 
-#get options, using the spec as defined by the enclosed list.
-#we read the options from the default: commandArgs(TRUE).
+# get options, using the spec as defined by the enclosed list.
+# we read the options from the default: commandArgs(TRUE).
 spec <- matrix(c(
     "verbose", "v", 2, "integer",
     "help", "h", 0, "logical",
@@ -109,7 +109,7 @@
 export_table <- as.data.frame(res_sorted)
 last_column <- ncol(export_table)
 for (i in seq_len(nrow(export_table))) {
-  export_table[i, last_column] <- paste(export_table[i, last_column][[1]], collapse = ", ")
+    export_table[i, last_column] <- paste(export_table[i, last_column][[1]], collapse = ", ")
 }
 export_table[, c(last_column)] <- sapply(export_table[, c(last_column)], as.character)
 write.table(export_table, file = opt$outfile, sep = "\t", quote = FALSE, row.names = FALSE, col.names = FALSE)
--- a/dexseq_count.xml	Tue Apr 04 08:25:36 2023 +0000
+++ b/dexseq_count.xml	Fri Jan 31 18:00:29 2025 +0000
@@ -16,18 +16,20 @@
     <command><![CDATA[
 #if $mode.mode_select == "prepare":
     dexseq_prepare_annotation.py
-        -r $mode.aggregate
-        '$mode.gtffile'
+        -r '${mode.aggregate}'
+        '${mode.gtffile}'
         '$flattened_gtf_out'
 #elif $mode.mode_select == "count":
+    ln -s -f '${mode.bamfile}' 'input.bam' &&
+    ln -s -f '${mode.bamfile.metadata.bam_index}' 'input.bam.bai' &&
     dexseq_count.py
         --format bam
-        --paired $mode.paired
-        --stranded $mode.stranded
-        --minaqual $mode.qual
-        --order $mode.order
-        $mode.flattened_gtf_in
-        '$mode.bamfile'
+        --paired '${mode.paired}'
+        --stranded '${mode.stranded}'
+        --minaqual '${mode.qual}'
+        --order '${mode.order}'
+        '${mode.flattened_gtf_in}'
+        'input.bam'
         '$counts_file'
     &&
     sed -i 's/\"//g' '$counts_file'
@@ -73,14 +75,14 @@
     </outputs>
 
     <tests>
-        <test>
+        <test expect_num_outputs="1">
             <param name="mode_select" value="prepare" />
             <param name="gtffile" ftype="gff" value="original.gtf"/>
             <param name="aggregate" value="True"/>
             <output name="flattened_gtf_out" ftype="gtf" compare="sim_size" file="flattened.gtf"/>
         </test>
         <!-- Ensure count mode works -->
-        <test>
+        <test expect_num_outputs="1">
             <param name="mode_select" value="count" />
             <param name="bamfile" ftype="bam" value="in.bam" />
             <param name="flattened_gtf_in" ftype="gff" value="flattened.gtf"/>
--- a/macros.xml	Tue Apr 04 08:25:36 2023 +0000
+++ b/macros.xml	Fri Jan 31 18:00:29 2025 +0000
@@ -1,12 +1,11 @@
-<?xml version="1.0"?>
 <macros>
-    <token name="@TOOL_VERSION@">1.44</token>
-    <token name="@VERSION_SUFFIX@">0</token>
-    <token name="@PROFILE@">22.01</token>
+    <token name="@TOOL_VERSION@">1.48.0</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>
-            <requirement type="package" version="1.20.3">r-getopt</requirement>
+            <requirement type="package" version="1.20.4">r-getopt</requirement>
             <requirement type="package" version="0.2.21">r-rjson</requirement>
         </requirements>
     </xml>
--- a/plotdexseq.R	Tue Apr 04 08:25:36 2023 +0000
+++ b/plotdexseq.R	Fri Jan 31 18:00:29 2025 +0000
@@ -14,8 +14,8 @@
 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
 args <- commandArgs(trailingOnly = TRUE)
 
-#get options, using the spec as defined by the enclosed list.
-#we read the options from the default: commandArgs(TRUE).
+# get options, using the spec as defined by the enclosed list.
+# we read the options from the default: commandArgs(TRUE).
 spec <- matrix(c(
     "rdata", "r", 1, "character",
     "primaryfactor", "p", 1, "character",
@@ -25,7 +25,9 @@
     "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)
 
@@ -38,12 +40,18 @@
     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) {
-    plotDEXSeq(res, i, FDR = opt$fdr, fitExpToVar = opt$primaryfactor,
+    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,
         displayTranscripts = opt$transcripts, names = opt$names, legend = TRUE,
-        color = NULL, color.samples = NULL, transcriptDb = NULL)
+        color = NULL, color.samples = NULL, transcriptDb = NULL
+    )
 }
 dev.off()
 
--- a/plotdexseq.xml	Tue Apr 04 08:25:36 2023 +0000
+++ b/plotdexseq.xml	Fri Jan 31 18:00:29 2025 +0000
@@ -22,9 +22,15 @@
     -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>
@@ -38,7 +44,7 @@
             <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>
@@ -51,6 +57,8 @@
         <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>
@@ -61,7 +69,10 @@
         <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>
@@ -69,10 +80,26 @@
         <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
Binary file test-data/plotdexseq.pdf has changed
Binary file test-data/plotdexseq_multi.pdf has changed
Binary file test-data/plotdexseq_multi_custom_dim.pdf has changed