Mercurial > repos > iuc > limma_voom
changeset 11:7e8af58c8052 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc
author | iuc |
---|---|
date | Mon, 11 Jun 2018 08:18:25 -0400 |
parents | e26047c4562d |
children | 81796eb60bd0 |
files | limma_voom.R limma_voom.xml |
diffstat | 2 files changed, 41 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/limma_voom.R Fri Jun 08 02:20:16 2018 -0400 +++ b/limma_voom.R Mon Jun 11 08:18:25 2018 -0400 @@ -177,7 +177,8 @@ "weightOpt", "w", 0, "logical", "topgenes", "G", 1, "integer", "treatOpt", "T", 0, "logical", - "plots", "P", 1, "character"), + "plots", "P", 1, "character", + "libinfoOpt", "L", 0, "logical"), byrow=TRUE, ncol=4) opt <- getopt(spec) @@ -250,6 +251,12 @@ wantTreat <- TRUE } +if (is.null(opt$libinfoOpt)) { + wantLibinfo <- FALSE +} else { + wantLibinfo <- TRUE +} + if (!is.null(opt$filesPath)) { # Process the separate count files (adapted from DESeq2 wrapper) @@ -283,14 +290,14 @@ } else { # Process the single count matrix - counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", stringsAsFactors=FALSE) + counts <- read.table(opt$matrixPath, header=TRUE, sep="\t", strip.white=TRUE, stringsAsFactors=FALSE) row.names(counts) <- counts[, 1] counts <- counts[ , -1] countsRows <- nrow(counts) # Process factors if (is.null(opt$factInput)) { - factorData <- read.table(opt$factFile, header=TRUE, sep="\t") + factorData <- read.table(opt$factFile, header=TRUE, sep="\t", strip.white=TRUE) factors <- factorData[, -1, drop=FALSE] } else { factors <- unlist(strsplit(opt$factInput, "|", fixed=TRUE)) @@ -313,7 +320,7 @@ # if annotation file provided if (haveAnno) { - geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", stringsAsFactors=FALSE) + geneanno <- read.table(opt$annoPath, header=TRUE, sep="\t", quote= "", strip.white=TRUE, stringsAsFactors=FALSE) } #Create output directory @@ -512,6 +519,7 @@ # Calculating normalising factors print("Calculating Normalisation Factors") +logcounts <- y #store for plots y <- calcNormFactors(y, method=opt$normOpt) # Generate contrasts information @@ -653,7 +661,11 @@ pdf(mdsamOutPdf, width=6.5, height=10) par(mfrow=c(3, 2)) for (i in 1:nsamples) { - plotMD(y, column = i) + if (opt$normOpt != "none") { + plotMD(logcounts, column=i, main=paste(colnames(logcounts)[i], "(before)")) + abline(h=0, col="red", lty=2, lwd=2) + } + plotMD(y, column=i) abline(h=0, col="red", lty=2, lwd=2) } linkName <- "MDPlots_Samples.pdf" @@ -761,6 +773,16 @@ plotData <- vData } + # Save library size info +if (wantLibinfo) { + efflibsize <- round(y$samples$lib.size * y$samples$norm.factors) + libsizeinfo <- cbind(y$samples, EffectiveLibrarySize=efflibsize) + libsizeinfo$lib.size <- round(libsizeinfo$lib.size) + names(libsizeinfo)[names(libsizeinfo)=="sampleID"] <- "SampleID" + names(libsizeinfo)[names(libsizeinfo)=="lib.size"] <- "LibrarySize" + names(libsizeinfo)[names(libsizeinfo)=="norm.factors"] <- "NormalisationFactor" + write.table(libsizeinfo, file="libsizeinfo", row.names=FALSE, sep="\t", quote=FALSE) +} print("Generating DE results")
--- a/limma_voom.xml Fri Jun 08 02:20:16 2018 -0400 +++ b/limma_voom.xml Mon Jun 11 08:18:25 2018 -0400 @@ -1,4 +1,4 @@ -<tool id="limma_voom" name="limma" version="3.34.9.6"> +<tool id="limma_voom" name="limma" version="3.34.9.7"> <description> Perform differential expression with limma-voom or limma-trend </description> @@ -81,10 +81,15 @@ -x #end if +#if $out.libinfo: + -L +#end if + #if $out.rdaOption: -r #end if + -l '$adv.lfc' -p '$adv.pVal' -d '$adv.pAdjust' @@ -271,6 +276,10 @@ label="Output Normalised Counts Table?" help="Output a file containing the normalised counts, these are in log2 counts per million (logCPM). Default: No"> </param> + <param name="libinfo" type="boolean" truevalue="1" falsevalue="0" checked="false" + label="Output Library information file?" + help="Output a tabular file showing the library sizes, normalisation factors and effective library sizes for the samples. Default: No"> + </param> <param name="rscript" type="boolean" truevalue="True" falsevalue="False" checked="False" label="Output Rscript?" help="If this option is set to Yes, the Rscript used will be provided as a text file in the output. Default: No"/> <param name="rdaOption" type="boolean" truevalue="1" falsevalue="0" checked="false" label="Output RData file?" @@ -317,6 +326,9 @@ <data name="rscript" format="txt" label="${tool.name} on ${on_string}: Rscript"> <filter>out['rscript']</filter> </data> + <data name="libinfo" format="tabular" from_work_dir="libsizeinfo" label="${tool.name} on ${on_string}: Library information"> + <filter>out['libinfo']</filter> + </data> </outputs> <tests> @@ -796,6 +808,7 @@ Optionally, under **Output Options** you can choose to output * a normalised counts table + * a library size information file * the R script used by this tool * an RData file