changeset 45:702bdf59d6c8 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/deseq2 commit 2bcb448af8311320be0a970be37aa8ea4eed66b9
author iuc
date Fri, 19 Dec 2025 08:09:31 +0000
parents 1cb33de18af5
children
files deseq2.R deseq2.xml macros.xml
diffstat 3 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/deseq2.R	Tue Dec 09 17:43:58 2025 +0000
+++ b/deseq2.R	Fri Dec 19 08:09:31 2025 +0000
@@ -127,12 +127,19 @@
 
 trim <- function(x) gsub("^\\s+|\\s+$", "", x)
 
+# Helper function to decode base64-encoded JSON
+decode_base64_json <- function(encoded_str) {
+    decoded_bytes <- base64enc::base64decode(encoded_str)
+    decoded_str <- rawToChar(decoded_bytes)
+    return(decoded_str)
+}
+
 # switch on if 'factors' was provided:
 library("rjson")
 
 if (!is.null(opt$sample_sheet_mode)) {
     # Sample sheet mode: build factor_list from sample sheet
-    filenames_to_labels <- fromJSON(opt$files_to_labels)
+    filenames_to_labels <- fromJSON(decode_base64_json(opt$files_to_labels))
 
     # Read sample sheet
     sample_sheet <- read.table(opt$sample_sheet, sep = "\t", header = TRUE, stringsAsFactors = FALSE)
@@ -341,9 +348,9 @@
 } else {
     # Original mode: factors provided directly
     parser <- newJSONParser()
-    parser$addData(opt$factors)
+    parser$addData(decode_base64_json(opt$factors))
     factor_list <- parser$getObject()
-    filenames_to_labels <- fromJSON(opt$files_to_labels)
+    filenames_to_labels <- fromJSON(decode_base64_json(opt$files_to_labels))
 
     # For original mode, extract reference and target levels from the first factor
     # In original mode: ref=level1 (denominator), target=level2 (numerator) -> log2(level2/level1)
--- a/deseq2.xml	Tue Dec 09 17:43:58 2025 +0000
+++ b/deseq2.xml	Fri Dec 19 08:09:31 2025 +0000
@@ -38,6 +38,7 @@
 
 #import json
 #import os
+#import base64
 Rscript '${__tool_directory__}/deseq2.R'
     --cores \${GALAXY_SLOTS:-1}
     -o '$deseq_out'
@@ -90,13 +91,13 @@
                     #for $group in $level.groups.value:
                         #for $file in $select_data.countsFile.get_datasets_for_group($group):
                             $count_files.append(str($file))
-                            $filename_to_element_identifiers.__setitem__(os.path.basename(str($file)),  $file.element_identifier)
+                            $filename_to_element_identifiers.__setitem__(os.path.basename(str($file)), $file.element_identifier)
                         #end for
                     #end for
                 #else:
                     #for $file in $level.countsFile:
                         $count_files.append(str($file))
-                        $filename_to_element_identifiers.__setitem__(os.path.basename(str($file)),  $file.element_identifier)
+                        $filename_to_element_identifiers.__setitem__(os.path.basename(str($file)), $file.element_identifier)
                     #end for
                 #end if
                 $temp_factor.append( {str($level.factorLevel): $count_files} )
@@ -109,9 +110,9 @@
     $header
 
     #if $select_data.how != 'sample_sheet_contrasts':
-        -f '#echo json.dumps(temp_factor_names)#'
+        -f '#echo base64.b64encode(json.dumps(temp_factor_names).encode()).decode()#'
     #end if
-    -l '#echo json.dumps(filename_to_element_identifiers)#'
+    -l '#echo base64.b64encode(json.dumps(filename_to_element_identifiers).encode()).decode()#'
     #if $advanced_options.esf_cond.esf:
         #if $advanced_options.esf_cond.esf == "user":
             -e $advanced_options.esf_cond.size_factor_input
@@ -154,7 +155,7 @@
                 <option value="sample_sheet_contrasts">Select contrasts from sample sheet columns</option>
             </param>
             <when value="group_tags">
-                <param name="countsFile" type="data_collection" format="tabular" label="Count file(s) collection" multiple="true"/>
+                <param name="countsFile" type="data_collection" format="tabular" label="Count file(s) collection" />
                 <expand macro="factor_repeat">
                     <param name="groups" type="group_tag" data_ref="countsFile" multiple="true" label="Select groups that correspond to this factor level"/>
                 </expand>
@@ -165,7 +166,7 @@
                 </expand>
             </when>
             <when value="sample_sheet_contrasts">
-                <param name="countsFile" type="data_collection" format="tabular" label="Count file(s) collection" multiple="true"/>
+                <param name="countsFile" type="data_collection" collection_type="list" format="tabular,tsv" label="Count file(s) collection" />
                 <param name="sample_sheet" type="data" format="tabular" label="Sample sheet file" help="A tabular file containing at least two columns: one with the element identifiers (matching those in the collection) and one or more columns with factor levels."/>
                 <conditional name="design_formula_mode">
                     <param name="mode" type="select" label="Design formula specification">
@@ -174,8 +175,7 @@
                     </param>
                     <when value="automatic">
                         <param name="factor" type="data_column" use_header_names="true" data_ref="sample_sheet" multiple="true" optional="false" label="Factor levels column(s)" help="Select one or more columns from the sample sheet to define factor levels for DESeq2 analysis. First selected factor is the primary factor"/>
-                        <param name="reference_level" type="text" label="Reference level for primary factor" help="Specify the reference level for the primary factor. If left blank, the first encountered level of the primary factor will be used as reference." optional="true"/>
-                        <param name="target_level" type="text" label="Target level for primary factor" help="Specify the target level for the primary factor. If left blank, all levels will be compared against the primary factor." optional="true"/>
+                        <expand macro="reference_target_levels"/>
                      </when>
                     <when value="custom">
                         <param name="design_formula" type="text" label="Design formula" help="Specify the design formula using R formula syntax (e.g., '~ condition' or '~ batch + condition'). Column names must match those in the sample sheet. The last factor in the formula is used as the primary factor for contrasts.">
@@ -192,8 +192,7 @@
                                 </valid>
                             </sanitizer>
                         </param>
-                        <param name="reference_level" type="text" label="Reference level for primary factor" help="Specify the reference level for the primary factor. If left blank, the first encountered level of the primary factor will be used as reference." optional="true"/>
-                        <param name="target_level" type="text" label="Target level for primary factor" help="Specify the target level for the primary factor. If left blank, all levels will be compared against the primary factor." optional="true"/>
+                        <expand macro="reference_target_levels"/>
                     </when>
                 </conditional>
             </when>
--- a/macros.xml	Tue Dec 09 17:43:58 2025 +0000
+++ b/macros.xml	Fri Dec 19 08:09:31 2025 +0000
@@ -18,6 +18,10 @@
             </repeat>
         </repeat>
     </xml>
+    <xml name="reference_target_levels">
+        <param name="reference_level" type="text" label="Reference level for primary factor" help="Specify the reference level for the primary factor. If left blank, the first encountered level of the primary factor will be used as reference." optional="true"/>
+        <param name="target_level" type="text" label="Target level for primary factor" help="Specify the target level for the primary factor. If left blank, all levels will be compared against the primary factor." optional="true"/>
+    </xml>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@DESEQ2_VERSION@">bioconductor-deseq2</requirement>
@@ -30,6 +34,7 @@
             <requirement type="package" version="3.1.3">r-gplots</requirement>
             <requirement type="package" version="1.0.12">r-pheatmap</requirement>
             <requirement type="package" version="0.2.21">r-rjson</requirement>
+            <requirement type="package" version="0.1_3">r-base64enc</requirement>
         </requirements>
     </xml>
     <token name="@TOOL_VERSION@">2.11.40.8</token>