# HG changeset patch # User lecorguille # Date 1549038575 18000 # Node ID b6a8143c397c526eb0817705ed60fe5f44773bcc # Parent b02797fbead14b88ba6ad038d71f9e119b43215c planemo upload commit aa538ae477bc2f901c95d916e11d70eab75b5e00 diff -r b02797fbead1 -r b6a8143c397c CAMERA.r --- a/CAMERA.r Fri Aug 17 06:45:55 2018 -0400 +++ b/CAMERA.r Fri Feb 01 11:29:35 2019 -0500 @@ -83,11 +83,6 @@ rplotspdf = listArguments[["rplotspdf"]]; listArguments[["rplotspdf"]]=NULL } -dataMatrixOutput = "dataMatrix.tsv" -if (!is.null(listArguments[["dataMatrixOutput"]])){ - dataMatrixOutput = listArguments[["dataMatrixOutput"]]; listArguments[["dataMatrixOutput"]]=NULL -} - variableMetadataOutput = "variableMetadata.tsv" if (!is.null(listArguments[["variableMetadataOutput"]])){ variableMetadataOutput = listArguments[["variableMetadataOutput"]]; listArguments[["variableMetadataOutput"]]=NULL @@ -129,7 +124,7 @@ pdf(file=rplotspdf, width=16, height=12) if (thefunction %in% c("annotatediff")) { - results_list=annotatediff(xset=xset,listArguments=listArguments,variableMetadataOutput=variableMetadataOutput,dataMatrixOutput=dataMatrixOutput) + results_list=annotatediff(xset=xset,listArguments=listArguments,variableMetadataOutput=variableMetadataOutput) xa=results_list[["xa"]] diffrep=results_list[["diffrep"]] variableMetadata=results_list[["variableMetadata"]] diff -r b02797fbead1 -r b6a8143c397c README.rst --- a/README.rst Fri Aug 17 06:45:55 2018 -0400 +++ b/README.rst Fri Feb 01 11:29:35 2019 -0500 @@ -2,6 +2,14 @@ Changelog/News -------------- +**Version 2.2.5 - 01/02/2019** + +- NEW: zip export are back for pictures (eic and boxplot) and diffreport tables + +**Version 2.2.4 - 09/10/2018** + +- NES: CAMERA.annotate no longer export a DataMatrix. fillChromPeaks does the job + **Version 2.2.3 - 30/04/2018** - NEW: support the new xcms 3.0.0 wrapper diff -r b02797fbead1 -r b6a8143c397c abims_CAMERA_annotateDiffreport.xml --- a/abims_CAMERA_annotateDiffreport.xml Fri Aug 17 06:45:55 2018 -0400 +++ b/abims_CAMERA_annotateDiffreport.xml Fri Feb 01 11:29:35 2019 -0500 @@ -1,4 +1,4 @@ - + CAMERA annotate function. Returns annotation results (isotope peaks, adducts and fragments) and a diffreport if more than one condition. @@ -18,7 +18,6 @@ ## output variableMetadataOutput '$variableMetadata' - dataMatrixOutput '$datamatrix' ## groupFWHM sigma $groupfwhm.sigma @@ -67,6 +66,8 @@ h $diffreport.options.h w $diffreport.options.w mzdec $diffreport.options.mzdec + tabular2 $diffreport.options.tabular2 + png2 $diffreport.options.png2 #end if @COMMAND_PEAKLIST@ @@ -160,6 +161,14 @@ + + + + + + + + @@ -172,7 +181,6 @@ - quick_block['quick'] == 'FALSE' @@ -183,11 +191,25 @@ quick_block['quick'] == 'TRUE' - @@ -197,23 +219,20 @@ - --> - - + - - + @@ -229,8 +248,7 @@ - - + @@ -287,19 +305,19 @@ +===========================+=======================================+================================================+ |CAMERA_combinexsAnnot |xset.annotate.Rdata | rdata.camera.positive or rdata.camera.negative | +---------------------------+---------------------------------------+------------------------------------------------+ -|Determine Vdk or Lowess |xset.annotate.dataMatrix.tsv | Tabular | +|Determine Vdk or Lowess |xset.annotate.variableMetadata.tsv | Tabular | +---------------------------+---------------------------------------+------------------------------------------------+ -|Normalization Vdk/Lowess |xset.annotate.dataMatrix.tsv | Tabular | +|Normalization Vdk/Lowess |xset.annotate.variableMetadata.tsv | Tabular | +---------------------------+---------------------------------------+------------------------------------------------+ -|Anova |xset.annotate.dataMatrix.tsv | Tabular | +|Anova |xset.annotate.variableMetadata.tsv | Tabular | +---------------------------+---------------------------------------+------------------------------------------------+ -|PCA |xset.annotate.dataMatrix.tsv | Tabular | +|PCA |xset.annotate.variableMetadata.tsv | Tabular | +---------------------------+---------------------------------------+------------------------------------------------+ -|Hierarchical Clustering |xset.annotate.dataMatrix.tsv | Tabular | +|Hierarchical Clustering |xset.annotate.variableMetadata.tsv | Tabular | +---------------------------+---------------------------------------+------------------------------------------------+ -The output file **xset.annotate.dataMatrix.tsv** is an tabular file. You can continue your analysis using it in the following tools: +The output file **xset.annotate.variableMetadata.tsv** is an tabular file. You can continue your analysis using it in the following tools: | Determine Vdk or Lowess | Normalization Vdk/Lowess @@ -361,10 +379,6 @@ | For each metabolite (row) : | the value of the intensity in each sample, fold, anova, mzmed, mzmin, mzmax, rtmed, rtmin, rtmax, npeaks, isotopes, adduct and pcgroup -xset.annotate.dataMatrix.tsv - - | A tabular file which represents for each metabolite (row), the value of the intensity in each sample (column). - xset.annotate.zip | It contains filebase_eic, filebase_box and filebase.tsv for one conditon vs another (Anova analysis). @@ -377,7 +391,7 @@ .. class:: infomark -The output **"xset.annotate.dataMatrix.tsv"** is a tabular file. You can continue your analysis using it in the following tools of the workflow: +The output **"xset.annotate.variableMetadata.tsv"** is a tabular file. You can continue your analysis using it in the following tools of the workflow: | Determine Vdk or Lowess (Data correction) | Normalization Vdk/Lowess (Data correction) @@ -418,10 +432,6 @@ Output files ------------ -**Example of an xset.annotate.dataMatrix.tsv output** - -.. image:: annotatediffreport_dataMatrix.png - **Example of a part of xset.annotate.variableMetadata.tsv output** .. image:: annotatediffreport_variableMetadata.png @@ -432,6 +442,14 @@ Changelog/News -------------- +**Version 2.2.5 - 01/02/2019** + +- NEW: zip export are back for pictures (eic and boxplot) and diffreport tables + +**Version 2.2.4 - 09/10/2018** + +- NEW: CAMERA.annotate no longer export a DataMatrix. fillChromPeaks does the job + **Version 2.2.3 - 30/04/2018** - NEW: support the new xcms 3.0.0 wrapper diff -r b02797fbead1 -r b6a8143c397c lib.r --- a/lib.r Fri Aug 17 06:45:55 2018 -0400 +++ b/lib.r Fri Feb 01 11:29:35 2019 -0500 @@ -34,6 +34,18 @@ } #@author G. Le Corguille +#The function create a zip archive from the different png generated by diffreport +diffreport_png2zip <- function() { + zip("eic.zip",dir(pattern="_eic")) + zip("box.zip",dir(pattern="_box")) +} + +#The function create a zip archive from the different tabular generated by diffreport +diffreport_tabular2zip <- function() { + zip("tabular.zip",dir(pattern="tabular/*")) +} + +#@author G. Le Corguille #This function convert if it is required the Retention Time in minutes RTSecondToMinute <- function(variableMetadata, convertRTMinute) { if (convertRTMinute){ @@ -57,7 +69,7 @@ } #The function annotateDiffreport without the corr function which bugs -annotatediff <- function(xset=xset, listArguments=listArguments, variableMetadataOutput="variableMetadata.tsv", dataMatrixOutput="dataMatrix.tsv") { +annotatediff <- function(xset=xset, listArguments=listArguments, variableMetadataOutput="variableMetadata.tsv") { # Resolve the bug with x11, with the function png options(bitmapType='cairo') @@ -108,11 +120,6 @@ peakList=getPeaklist(xa,intval=listArguments[["intval"]]) peakList=cbind(groupnames(xa@xcmsSet),peakList); colnames(peakList)[1] = c("name"); - # --- dataMatrix --- - dataMatrix = peakList[,(make.names(colnames(peakList)) %in% c("name", make.names(sampnames(xa@xcmsSet))))] - write.table(dataMatrix, sep="\t", quote=FALSE, row.names=FALSE, file=dataMatrixOutput) - - # --- Multi condition : diffreport --- diffrepOri=NULL if (!is.null(listArguments[["runDiffreport"]]) & nlevels(sampclass(xset))>=2) { @@ -149,11 +156,16 @@ write.table(diffrep, sep="\t", quote=FALSE, row.names=FALSE, file=paste("tabular/",filebase,"_tsv.tabular",sep="")) if (listArguments[["eicmax"]] != 0) { - diffreport_png2pdf(filebase) + if (listArguments[["png2"]] == "pdf") + diffreport_png2pdf(filebase) } } } } + if (listArguments[["png2"]] == "zip") + diffreport_png2zip() + if (listArguments[["tabular2"]] == "zip") + diffreport_tabular2zip() } # --- variableMetadata --- @@ -330,24 +342,24 @@ getEIC <- function(object, mzrange, rtrange = 200, groupidx, sampleidx = sampnames(object), rt = c("corrected", "raw")) { - + files <- filepaths(object) grp <- groups(object) samp <- sampnames(object) prof <- profinfo(object) - + rt <- match.arg(rt) - + if (is.numeric(sampleidx)) sampleidx <- sampnames(object)[sampleidx] sampidx <- match(sampleidx, sampnames(object)) - + if (!missing(groupidx)) { if (is.numeric(groupidx)) groupidx <- groupnames(object)[unique(as.integer(groupidx))] grpidx <- match(groupidx, groupnames(object, template = groupidx)) } - + if (missing(mzrange)) { if (missing(groupidx)) stop("No m/z range or groups specified") @@ -369,7 +381,7 @@ else if (is.null(dim(mzrange))) stop("mzrange must be a matrix") colnames(mzrange) <- c("mzmin", "mzmax") - + if (length(rtrange) == 1) { if (missing(groupidx)) rtrange <- matrix(rep(range(object@rt[[rt]][sampidx]), nrow(mzrange)), @@ -380,11 +392,11 @@ } else if (is.null(dim(rtrange))) stop("rtrange must be a matrix or single number") colnames(rtrange) <- c("rtmin", "rtmax") - + ## Ensure that we've got corrected retention time if requested. if (is.null(object@rt[[rt]])) stop(rt, " retention times not present in 'object'!") - + ## Ensure that the defined retention time range is within the rtrange of the ## object: we're using the max minimal rt of all files and the min maximal rt rtrs <- lapply(object@rt[[rt]], range) @@ -406,17 +418,17 @@ rtrange[lower_rt_outside, "rtmin"] <- rtr[1] rtrange[upper_rt_outside, "rtmax"] <- rtr[2] } - + if (missing(groupidx)) gnames <- character(0) else gnames <- groupidx - + eic <- vector("list", length(sampleidx)) names(eic) <- sampleidx - + for (i in seq(along = sampidx)) { - + ## cat(sampleidx[i], "") flush.console() ## getXcmsRaw takes care of rt correction, susetting to scanrage and other @@ -428,7 +440,7 @@ gc() } ## cat("\n") - + invisible(new("xcmsEIC", eic = eic, mzrange = mzrange, rtrange = rtrange, rt = rt, groupnames = gnames)) } @@ -449,15 +461,15 @@ metlin = FALSE, h = 480, w = 640, mzdec=2, missing = numeric(), ...) { - + if ( nrow(object@groups)<1 || length(object@groupidx) <1) { stop("No group information. Use group().") } - + if (!is.numeric(w) || !is.numeric(h)) stop("'h' and 'w' have to be numeric") ## require(multtest) || stop("Couldn't load multtest") - + value <- match.arg(value) groupmat <- groups(object) if (length(groupmat) == 0) @@ -466,20 +478,20 @@ n <- length(samples) classlabel <- sampclass(object) classlabel <- levels(classlabel)[as.vector(unclass(classlabel))] - + values <- groupval(object, "medret", value=value) indecies <- groupval(object, "medret", value = "index") - + if (!all(c(class1,class2) %in% classlabel)) stop("Incorrect Class Labels") - + ## c1 and c2 are column indices of class1 and class2 resp. c1 <- which(classlabel %in% class1) c2 <- which(classlabel %in% class2) ceic <- which(classlabel %in% classeic) if (length(intersect(c1, c2)) > 0) stop("Intersecting Classes") - + ## Optionally replace NA values with the value provided with missing if (length(missing)) { if (is.numeric(missing)) { @@ -493,21 +505,21 @@ warning("`NA` values in xcmsSet. Use fillPeaks() on the object to fill", "-in missing peak values. Note however that this will also ", "insert intensities of 0 for peaks that can not be filled in.") - + mean1 <- rowMeans(values[,c1,drop=FALSE], na.rm = TRUE) mean2 <- rowMeans(values[,c2,drop=FALSE], na.rm = TRUE) - + ## Calculate fold change. ## For foldchange <1 set fold to 1/fold ## See tstat to check which was higher fold <- mean2 / mean1 fold[!is.na(fold) & fold < 1] <- 1/fold[!is.na(fold) & fold < 1] - + testval <- values[,c(c1,c2)] ## Replace eventual infinite values with NA (CAMERA issue #33) testval[is.infinite(testval)] <- NA testclab <- c(rep(0,length(c1)),rep(1,length(c2))) - + if (min(length(c1), length(c2)) >= 2) { tstat <- mt.teststat(testval, testclab, ...) pvalue <- xcms:::pval(testval, testclab, tstat) @@ -543,18 +555,18 @@ values<-values[tsidx,] } else tsidx <- 1:nrow(values) - + if (length(filebase)) write.table(twosamp, paste(filebase, ".tsv", sep = ""), quote = FALSE, sep = "\t", col.names = NA) - + if (eicmax > 0) { if (length(unique(peaks(object)[,"rt"])) > 1) { ## This looks like "normal" LC data - + eicmax <- min(eicmax, length(tsidx)) eics <- getEIC(object, rtrange = eicwidth*1.1, sampleidx = ceic, groupidx = tsidx[seq(length = eicmax)]) - + if (length(filebase)) { eicdir <- paste(filebase, "_eic", sep="") boxdir <- paste(filebase, "_box", sep="") @@ -572,7 +584,7 @@ } } plot(eics, object, rtrange = eicwidth, mzdec=mzdec) - + if (length(filebase)) dev.off() } else { @@ -596,13 +608,13 @@ height = h/72, onefile = FALSE) } } - + plotSpecWindow(object, gidxs = tsidx[seq(length = eicmax)], borderwidth=1) - + if (length(filebase)) dev.off() } } - + invisible(twosamp) } diff -r b02797fbead1 -r b6a8143c397c repository_dependencies.xml --- a/repository_dependencies.xml Fri Aug 17 06:45:55 2018 -0400 +++ b/repository_dependencies.xml Fri Feb 01 11:29:35 2019 -0500 @@ -1,5 +1,5 @@ - + - - - + + + \ No newline at end of file