Repository 'deseq2'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/deseq2

Changeset 31:9a882d108833 (2023-07-18)
Previous changeset 30:8fe98f7094de (2022-08-26)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit 469558ddf5bc6249874fe5826637fd6ee81588cf
modified:
deseq2.R
deseq2.xml
added:
macros.xml
test-data/size_factors_out.tsv
removed:
deseq2_macros.xml
b
diff -r 8fe98f7094de -r 9a882d108833 deseq2.R
--- a/deseq2.R Fri Aug 26 11:16:15 2022 +0000
+++ b/deseq2.R Tue Jul 18 14:58:52 2023 +0000
[
@@ -36,9 +36,6 @@
   q("no", 1, FALSE)
 })
 
-# we need that to not crash galaxy with an UTF8 error on German LC settings.
-loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
-
 library("getopt")
 library("tools")
 options(stringAsFactors = FALSE, useFancyQuotes = FALSE)
@@ -69,7 +66,7 @@
   "outlier_replace_off", "a", 0, "logical",
   "outlier_filter_off", "b", 0, "logical",
   "auto_mean_filter_off", "c", 0, "logical",
-  "beta_prior_off", "d", 0, "logical",
+  "use_beta_priors", "d", 0, "logical",
   "alpha_ma", "A", 1, "numeric",
   "prefilter", "P", 0, "logical",
   "prefilter_value", "V", 1, "numeric"
@@ -217,11 +214,27 @@
 }
 
 dds <- get_deseq_dataset(sample_table, header = opt$header, design_formula = design_formula, tximport = opt$tximport, txtype = opt$txtype, tx2gene = opt$tx2gene)
-# estimate size factors for the chosen method
+
+# use/estimate size factors with the chosen method
 if (!is.null(opt$esf)) {
-    dds <- estimateSizeFactors(dds, type = opt$esf)
+    if (opt$esf %in% list("ratio", "poscounts", "iterate")) {
+        cat("Calculating size factors de novo\n")
+        dds <- estimateSizeFactors(dds, type = opt$esf)
+    } else {
+        sf_table <- read.table(opt$esf)
+        # Sort the provided size factors just in case the order differs from the input file order.
+        merged_table <- merge(sample_table, sf_table, by.x = 0, by.y = 1, sort = FALSE)
+        sf_values <- as.numeric(unlist(merged_table[5]))
+        "sizeFactors"(dds) <- sf_values
+
+        cat("Using user-provided size factors:\n")
+        print(sf_values)
+    }
+} else {
+    cat("No size factor was used\n")
 }
 
+
 # estimate size factors for each sample
 # - https://support.bioconductor.org/p/97676/
 if (!is.null(opt$sizefactorsfile)) {
@@ -312,12 +325,15 @@
 }
 
 # shrinkage of LFCs
-if (is.null(opt$beta_prior_off)) {
-  beta_prior <- TRUE
+if (is.null(opt$use_beta_priors)) {
+  beta_prior <- FALSE
+  if (verbose)
+    cat("Applied default - beta prior off\n")
 } else {
-  beta_prior <- FALSE
-  if (verbose) cat("beta prior off\n")
+  beta_prior <- opt$use_beta_priors
 }
+sprintf("use_beta_prior is set to %s", beta_prior)
+
 
 # dispersion fit type
 if (is.null(opt$fit_type)) {
b
diff -r 8fe98f7094de -r 9a882d108833 deseq2.xml
--- a/deseq2.xml Fri Aug 26 11:16:15 2022 +0000
+++ b/deseq2.xml Tue Jul 18 14:58:52 2023 +0000
[
b'@@ -1,24 +1,24 @@\n-<tool id="deseq2" name="DESeq2" version="@TOOL_VERSION@+galaxy@SUFFIX_VERSION@">\n+<tool id="deseq2" name="DESeq2" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">\n     <description>Determines differentially expressed features from count tables</description>\n     <macros>\n-        <import>deseq2_macros.xml</import>\n+        <import>macros.xml</import>\n     </macros>\n+    <expand macro=\'edam_ontology\'/>\n+    <expand macro=\'xrefs\'/>\n     <expand macro=\'requirements\'/>\n-    <expand macro=\'edam_ontology\' />\n-    <expand macro=\'xrefs\'/>\n     <stdio>\n         <regex match="Execution halted"\n            source="both"\n            level="fatal"\n-           description="Execution halted." />\n+           description="Execution halted."/>\n         <regex match="Error in"\n            source="both"\n            level="fatal"\n-           description="An undefined error occurred, please check your input carefully and contact your administrator." />\n+           description="An undefined error occurred, please check your input carefully and contact your administrator."/>\n         <regex match="Fatal error"\n            source="both"\n            level="fatal"\n-           description="An undefined error occurred, please check your input carefully and contact your administrator." />\n+           description="An undefined error occurred, please check your input carefully and contact your administrator."/>\n     </stdio>\n     <version_command><![CDATA[\n echo $(R --version | grep version | grep -v GNU)", DESeq2 version" $(R --vanilla --slave -e "library(DESeq2); cat(sessionInfo()\\$otherPkgs\\$DESeq2\\$Version)" 2> /dev/null | grep -v -i "WARNING: ")\n@@ -85,8 +85,12 @@\n \n     -f \'#echo json.dumps(temp_factor_names)#\'\n     -l \'#echo json.dumps(filename_to_element_identifiers)#\'\n-    #if $advanced_options.esf:\n-        -e $advanced_options.esf\n+    #if $advanced_options.esf_cond.esf:\n+        #if $advanced_options.esf_cond.esf == "user":\n+            -e $advanced_options.esf_cond.size_factor_input\n+        #else:\n+            -e $advanced_options.esf_cond.esf\n+        #end if\n     #end if\n     -t $advanced_options.fit_type\n     #if $batch_factors:\n@@ -96,15 +100,12 @@\n         $advanced_options.prefilter_conditional.prefilter\n         -V $advanced_options.prefilter_conditional.prefilter_value\n     #end if\n-    #if $advanced_options.outlier_replace_off:\n-        -a\n-    #end if\n-    #if $advanced_options.outlier_filter_off:\n-        -b\n-    #end if\n-    #if $advanced_options.auto_mean_filter_off:\n-        -c\n-    #end if\n+    \n+    $advanced_options.outlier_replace_off\n+    $advanced_options.outlier_filter_off\n+    $advanced_options.auto_mean_filter_off\n+    $advanced_options.use_beta_priors\n+\n     #if \'many_contrasts\' in $output_options.output_selector\n         -m\n     #end if\n@@ -116,7 +117,6 @@\n         #else:\n             -x mapping.txt\n         #end if\n-\n     #end if\n ]]></command>\n     <inputs>\n@@ -139,7 +139,7 @@\n         </conditional>\n \n         <param name="batch_factors" type="data" format="tabular" optional="true" label="(Optional) provide a tabular file with additional batch factors to include in the model." help="You can produce this file using RUVSeq or svaseq."/>\n-        <param name="header" type="boolean" truevalue="-H" falsevalue="" checked="true" label="Files have header?" help="If this option is set to Yes, the tool will assume that the count files have column headers in the first row. Default: Yes" />\n+        <param name="header" type="boolean" truevalue="-H" falsevalue="" checked="true" label="Files have header?" help="If this option is set to Yes, the tool will assume that the count files have column headers in the first row. Default: Yes"/>\n \n         <conditional name="tximport">\n             <param name="tximport_selector" type="select" label="Choice of Input data">\n@@ -165,39 +165,49 @@\n                     </when>\n                 </conditional>\n             </when>\n-            <when value="'..b'ching expression="sailfish_quant\\.sf3\\.tab\\t1\\.0\\d+" />\n+                    <has_text_matching expression="sailfish_quant\\.sf4\\.tab\\t0\\.8\\d+"/>\n+                    <has_text_matching expression="sailfish_quant\\.sf3\\.tab\\t1\\.0\\d+"/>\n+                </assert_contents>\n+            </output>\n+        </test>\n+        <!--Test alpha_ma option, but with user-provided size factors -->\n+        <test expect_num_outputs="1">\n+            <repeat name="rep_factorName">\n+                <param name="factorName" value="Treatment"/>\n+                <repeat name="rep_factorLevel">\n+                    <param name="factorLevel" value="Treated"/>\n+                    <param name="countsFile" value="sailfish_ensembl/sailfish_quant.sf1.tab,sailfish_ensembl/sailfish_quant.sf2.tab,sailfish_ensembl/sailfish_quant.sf3.tab"/>\n+                </repeat>\n+                <repeat name="rep_factorLevel">\n+                    <param name="factorLevel" value="Untreated"/>\n+                    <param name="countsFile" value="sailfish_ensembl/sailfish_quant.sf4.tab,sailfish_ensembl/sailfish_quant.sf5.tab,sailfish_ensembl/sailfish_quant.sf6.tab"/>\n+                </repeat>\n+            </repeat>\n+            <section name="advanced_options">\n+                <param name="use_beta_priors" value="1"/>\n+                <conditional name="esf_cond">\n+                    <param name="esf" value="user"/>\n+                    <param name="size_factor_input" value="size_factors_out.tsv"/>\n+                </conditional>\n+            </section>\n+            <section name="output_options">\n+                <param name="output_selector" value=""/>\n+                <param name="alpha_ma" value="0.05"/>\n+            </section>\n+            <param name="tximport_selector" value="tximport"/>\n+            <param name="txtype" value="sailfish"/>\n+            <param name="mapping_format_selector" value="gtf"/>\n+            <param name="gtf_file" value="Homo_sapiens.GRCh38.94.gtf" ftype="gtf"/>\n+            <output name="deseq_out">\n+                <assert_contents>\n+                    <has_text_matching expression="ENSG00000168671\\t1.90.*\\t-0.05.*\\t0.75.*\\t-0.07.*\\t0.94.*\\t0.95.*"/>\n                 </assert_contents>\n             </output>\n         </test>\n@@ -580,7 +680,7 @@\n                 </repeat>\n             </repeat>\n             <section name="advanced_options">\n-                <param name="esf" value="poscounts" />\n+                <param name="esf" value="poscounts"/>\n             </section>\n             <section name="output_options">\n                 <param name="output_selector" value="sizefactors"/>\n@@ -592,8 +692,8 @@\n             <param name="gtf_file" value="Homo_sapiens.GRCh38.94.gtf" ftype="gtf"/>\n             <output name="sizefactors_out" >\n                 <assert_contents>\n-                    <has_text_matching expression="sailfish_quant\\.sf4\\.tab\\t0\\.8\\d+" />\n-                    <has_text_matching expression="sailfish_quant\\.sf3\\.tab\\t1\\.0\\d+" />\n+                    <has_text_matching expression="sailfish_quant\\.sf4\\.tab\\t0\\.8\\d+"/>\n+                    <has_text_matching expression="sailfish_quant\\.sf3\\.tab\\t1\\.0\\d+"/>\n                 </assert_contents>\n             </output>\n         </test>\n@@ -636,7 +736,7 @@\n \n **What it does**\n \n-Estimate variance-mean dependence in count data from high-throughput sequencing assays and test for differential expression based on a model using the negative binomial distribution\n+Uses DESeq2 version @DESEQ2_VERSION@ to estimate variance-mean dependence in count data from high-throughput sequencing assays and test for differential expression based on a model using the negative binomial distribution.\n \n -----\n \n@@ -732,5 +832,5 @@\n .. _DESeq2: http://master.bioconductor.org/packages/release/bioc/html/DESeq2.html\n .. _tximport: https://bioconductor.org/packages/devel/bioc/vignettes/tximport/inst/doc/tximport.html\n     ]]></help>\n-    <expand macro="citations" />\n+    <expand macro="citations"/>\n </tool>\n'
b
diff -r 8fe98f7094de -r 9a882d108833 deseq2_macros.xml
--- a/deseq2_macros.xml Fri Aug 26 11:16:15 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,55 +0,0 @@
-<macros>
-    <xml name="factor_repeat">
-        <repeat name="rep_factorName" title="Factor" min="1">
-            <param name="factorName" type="text" value="FactorName" label="Specify a factor name, e.g. effects_drug_x or cancer_markers"
-                help="Only letters, numbers and underscores will be retained in this field">
-                <sanitizer>
-                    <valid initial="string.letters,string.digits"><add value="_" /></valid>
-                </sanitizer>
-            </param>
-            <repeat name="rep_factorLevel" title="Factor level" min="2" default="2">
-                <param name="factorLevel" type="text" value="FactorLevel" label="Specify a factor level, typical values could be 'tumor', 'normal', 'treated' or 'control'"
-                    help="Only letters, numbers and underscores will be retained in this field">
-                    <sanitizer>
-                        <valid initial="string.letters,string.digits"><add value="_" /></valid>
-                    </sanitizer>
-                </param>
-                <yield/>
-            </repeat>
-        </repeat>
-    </xml>
-    <xml name="requirements">
-        <requirements>
-            <requirement type="package" version="1.34.0">bioconductor-deseq2</requirement>
-            <!-- Optional dependency of tximport, needed to import kallisto results https://github.com/galaxyproject/usegalaxy-playbook/issues/161 -->
-            <requirement type="package" version="2.38.0">bioconductor-rhdf5</requirement>
-            <requirement type="package" version="1.22.0">bioconductor-tximport</requirement>
-            <requirement type="package" version="1.46.1">bioconductor-genomicfeatures</requirement>
-            <requirement type="package" version="1.20.3">r-getopt</requirement>
-            <requirement type="package" version="0.9.1">r-ggrepel</requirement>
-            <requirement type="package" version="3.1.1">r-gplots</requirement>
-            <requirement type="package" version="1.0.12">r-pheatmap</requirement>
-            <requirement type="package" version="0.2.20">r-rjson</requirement>
-        </requirements>
-    </xml>
-    <token name="@TOOL_VERSION@">2.11.40.7</token>
-    <token name="@SUFFIX_VERSION@">2</token>
-    <xml name="edam_ontology">
-        <edam_topics>                                                                                  
-            <edam_topic>topic_3308</edam_topic>
-        </edam_topics>
-        <edam_operations>
-            <edam_operation>operation_3800</edam_operation>
-        </edam_operations>
-    </xml>
-    <xml name="citations">
-        <citations>
-            <citation type="doi">10.1186/s13059-014-0550-8</citation>
-        </citations>
-    </xml>
-    <xml name="xrefs">
-        <xrefs>
-          <xref type='bio.tools'>DESeq2</xref>
-        </xrefs>
-      </xml>
-</macros>
\ No newline at end of file
b
diff -r 8fe98f7094de -r 9a882d108833 macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Tue Jul 18 14:58:52 2023 +0000
b
@@ -0,0 +1,58 @@
+<macros>
+    <xml name="factor_repeat">
+        <repeat name="rep_factorName" title="Factor" min="1">
+            <param name="factorName" type="text" value="FactorName" label="Specify a factor name, e.g. effects_drug_x or cancer_markers"
+                help="Only letters, numbers and underscores will be retained in this field">
+                <sanitizer>
+                    <valid initial="string.letters,string.digits"><add value="_" /></valid>
+                </sanitizer>
+            </param>
+            <repeat name="rep_factorLevel" title="Factor level" min="2" default="2">
+                <param name="factorLevel" type="text" value="FactorLevel" label="Specify a factor level, typical values could be 'tumor', 'normal', 'treated' or 'control'"
+                    help="Only letters, numbers and underscores will be retained in this field">
+                    <sanitizer>
+                        <valid initial="string.letters,string.digits"><add value="_" /></valid>
+                    </sanitizer>
+                </param>
+                <yield/>
+            </repeat>
+        </repeat>
+    </xml>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@DESEQ2_VERSION@">bioconductor-deseq2</requirement>
+            <!-- Optional dependency of tximport, needed to import kallisto results https://github.com/galaxyproject/usegalaxy-playbook/issues/161 -->
+            <requirement type="package" version="2.44.0">bioconductor-rhdf5</requirement>
+            <requirement type="package" version="1.28.0">bioconductor-tximport</requirement>
+            <requirement type="package" version="1.52.1">bioconductor-genomicfeatures</requirement>
+            <requirement type="package" version="1.20.3">r-getopt</requirement>
+            <requirement type="package" version="0.9.3">r-ggrepel</requirement>
+            <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>
+        </requirements>
+    </xml>
+    <token name="@TOOL_VERSION@">2.11.40.8</token>
+    <token name="@DESEQ2_VERSION@">1.40.2</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <token name="@PROFILE@">22.01</token>
+    <xml name="edam_ontology">
+        <edam_topics>
+            <edam_topic>topic_3308</edam_topic>
+        </edam_topics>
+        <edam_operations>
+            <edam_operation>operation_3800</edam_operation>
+        </edam_operations>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1186/s13059-014-0550-8</citation>
+        </citations>
+    </xml>
+    <xml name="xrefs">
+        <xrefs>
+            <xref type="bio.tools">DESeq2</xref>
+            <xref type="bioconductor">deseq2</xref>
+        </xrefs>
+      </xml>
+</macros>
b
diff -r 8fe98f7094de -r 9a882d108833 test-data/size_factors_out.tsv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/size_factors_out.tsv Tue Jul 18 14:58:52 2023 +0000
b
@@ -0,0 +1,6 @@
+sailfish_quant.sf4.tab 0.84800690799672
+sailfish_quant.sf5.tab 1.10790786350701
+sailfish_quant.sf6.tab 1.21319523337605
+sailfish_quant.sf1.tab 1.19061589081921
+sailfish_quant.sf2.tab 0.712203801356132
+sailfish_quant.sf3.tab 1.03464248515867