# HG changeset patch # User iuc # Date 1638209808 0 # Node ID cd9874cb9019fd0f9adac0759f177d6dd892997d # Parent 7ff33c2d525b931c08d99bd833d9f04db580ffc7 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/deseq2 commit cbeb1c4c436be04323bd9a809a6393d00b168d07" diff -r 7ff33c2d525b -r cd9874cb9019 deseq2.R --- a/deseq2.R Fri Nov 19 21:03:55 2021 +0000 +++ b/deseq2.R Mon Nov 29 18:16:48 2021 +0000 @@ -52,6 +52,7 @@ "batch_factors", "w", 1, "character", "outfile", "o", 1, "character", "countsfile", "n", 1, "character", + "sizefactorsfile", "F", 1, "character", "rlogfile", "r", 1, "character", "vstfile", "v", 1, "character", "header", "H", 0, "logical", @@ -217,6 +218,30 @@ if (!is.null(opt$esf)) { dds <- estimateSizeFactors(dds, type = opt$esf) } + +# estimate size factors for each sample +# - https://support.bioconductor.org/p/97676/ +if (!is.null(opt$sizefactorsfile)) { + nm <- assays(dds)[["avgTxLength"]] + if (!is.null(nm)) { + ## Recommended: takes into account tximport data + cat("\nsize factors for samples: taking tximport data into account\n") + size_factors <- estimateSizeFactorsForMatrix(counts(dds) / nm) + } else { + norm_factors <- normalizationFactors(dds) + if (!is.null(norm_factors)) { + ## In practice, gives same results as above. + cat("\nsize factors for samples: no tximport data, using derived normalization factors\n") + size_factors <- estimateSizeFactorsForMatrix(norm_factors) + } else { + ## If we have no other information, estimate from raw. + cat("\nsize factors for samples: no tximport data, no normalization factors, estimating from raw data\n") + size_factors <- estimateSizeFactorsForMatrix(counts(dds)) + } + } + write.table(size_factors, file = opt$sizefactorsfile, sep = "\t", col.names = F, quote = FALSE) +} + apply_batch_factors <- function(dds, batch_factors) { rownames(batch_factors) <- batch_factors$identifier batch_factors <- subset(batch_factors, select = -c(identifier, condition)) diff -r 7ff33c2d525b -r cd9874cb9019 deseq2.xml --- a/deseq2.xml Fri Nov 19 21:03:55 2021 +0000 +++ b/deseq2.xml Mon Nov 29 18:16:48 2021 +0000 @@ -47,6 +47,9 @@ #if 'normCounts' in $output_options.output_selector: -n '$counts_out' #end if + #if 'sizefactors' in $output_options.output_selector: + -F '$sizefactors_out' + #end if #if 'normRLog' in $output_options.output_selector: -r '$rlog_out' #end if @@ -195,6 +198,7 @@
+ @@ -217,6 +221,9 @@ output_options['output_selector'] and 'pdf' in output_options['output_selector'] + + output_options['output_selector'] and 'sizefactors' in output_options['output_selector'] + output_options['output_selector'] and 'normCounts' in output_options['output_selector'] @@ -513,6 +520,65 @@ + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + +
+ +
+
+ + +
+ + + + + + + + + + +
diff -r 7ff33c2d525b -r cd9874cb9019 deseq2_macros.xml --- a/deseq2_macros.xml Fri Nov 19 21:03:55 2021 +0000 +++ b/deseq2_macros.xml Mon Nov 29 18:16:48 2021 +0000 @@ -33,7 +33,7 @@ 2.11.40.7 - 0 + 1 topic_3308