# HG changeset patch # User iuc # Date 1528719505 14400 # Node ID 7e8af58c805226d06cad3cb389c68b0fe6bc3a61 # Parent e26047c4562dcaf1753c7ed5589bbaa4f06cabba planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4bcbd83574ecf7194f3370aa883a9573563afdbc diff -r e26047c4562d -r 7e8af58c8052 limma_voom.R --- 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") diff -r e26047c4562d -r 7e8af58c8052 limma_voom.xml --- 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 @@ - + Perform differential expression with limma-voom or limma-trend @@ -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"> + + out['rscript'] + + out['libinfo'] + @@ -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