Repository 'camera_annotate'
hg clone https://toolshed.g2.bx.psu.edu/repos/lecorguille/camera_annotate

Changeset 17:73d82de36369 (2018-10-09)
Previous changeset 16:a2c49996603e (2018-09-19) Next changeset 18:cb923396e70f (2019-08-29)
Commit message:
planemo upload commit 1a5357c0e28103a0325b2df858504721f6266049
modified:
CAMERA.r
README.rst
abims_CAMERA_annotateDiffreport.xml
lib.r
b
diff -r a2c49996603e -r 73d82de36369 CAMERA.r
--- a/CAMERA.r Wed Sep 19 03:22:21 2018 -0400
+++ b/CAMERA.r Tue Oct 09 06:03:01 2018 -0400
[
@@ -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"]]
b
diff -r a2c49996603e -r 73d82de36369 README.rst
--- a/README.rst Wed Sep 19 03:22:21 2018 -0400
+++ b/README.rst Tue Oct 09 06:03:01 2018 -0400
b
@@ -2,6 +2,10 @@
 Changelog/News
 --------------
 
+**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
b
diff -r a2c49996603e -r 73d82de36369 abims_CAMERA_annotateDiffreport.xml
--- a/abims_CAMERA_annotateDiffreport.xml Wed Sep 19 03:22:21 2018 -0400
+++ b/abims_CAMERA_annotateDiffreport.xml Tue Oct 09 06:03:01 2018 -0400
[
@@ -1,4 +1,4 @@
-<tool id="abims_CAMERA_annotateDiffreport" name="CAMERA.annotate" version="2.2.3">
+<tool id="abims_CAMERA_annotateDiffreport" name="CAMERA.annotate" version="2.2.4">
 
     <description>CAMERA annotate function. Returns annotation results (isotope peaks, adducts and fragments) and a diffreport if more than one condition.</description>
 
@@ -18,7 +18,6 @@
 
         ## output
         variableMetadataOutput '$variableMetadata'
-        dataMatrixOutput '$datamatrix'
 
         ## groupFWHM
         sigma $groupfwhm.sigma
@@ -172,7 +171,6 @@
 
     <outputs>
         <data name="variableMetadata" format="tabular" label="${image.name[:-6]}.annotate.variableMetadata.tsv" />
-        <data name="datamatrix" format="tabular" label="${image.name[:-6]}.annotate.dataMatrix.tsv" />
         <data name="rdata_quick_false" format="rdata.camera.quick" label="${image.name[:-6]}.annotate.${$quick_block.findadducts.polarity}.Rdata" >
             <filter>quick_block['quick'] == 'FALSE'</filter>
             <change_format>
@@ -197,23 +195,20 @@
             <expand macro="test_annotate_quick_true"/>
             <expand macro="test_file_load_zip"/>
             <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.variableMetadata.tsv" />
-            <output name="datamatrix" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.dataMatrix.tsv" />
         </test>-->
         <test>
             <param name="image" value="faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData"/>
             <expand macro="test_annotate_diffreport"/>
             <expand macro="test_annotate_quick_true"/>
             <expand macro="test_file_load_single"/>
-            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.variableMetadata.tsv" />
-            <output name="datamatrix" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.dataMatrix.tsv" />
+            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.variableMetadata.tsv" lines_diff="2" />
         </test>
         <test>
             <param name="image" value="faahKO-single.xset.merged.group.retcor.group.fillpeaks-xcms3.RData"/>
             <expand macro="test_annotate_diffreport"/>
             <expand macro="test_annotate_quick_true"/>
             <expand macro="test_file_load_single"/>
-            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.variableMetadata-xcms3.tsv" />
-            <output name="datamatrix" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.dataMatrix-xcms3.tsv" />
+            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.variableMetadata-xcms3.tsv" lines_diff="2" />
         </test>
         <test>
             <param name="image" value="faahKO-single.xset.merged.group.retcor.group.fillpeaks.RData"/>
@@ -229,8 +224,7 @@
                 </section>
             </conditional>
             <expand macro="test_file_load_single"/>
-            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.rules.variableMetadata.tsv" />
-            <output name="datamatrix" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.rules.dataMatrix.tsv" />
+            <output name="variableMetadata" file="faahKO.xset.group.retcor.group.fillPeaks.annotate.rules.variableMetadata.tsv" lines_diff="2"/>
         </test>
     </tests>
 
@@ -287,19 +281,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 +355,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 +367,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 +408,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 +418,10 @@
 Changelog/News
 --------------
 
+**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
b
diff -r a2c49996603e -r 73d82de36369 lib.r
--- a/lib.r Wed Sep 19 03:22:21 2018 -0400
+++ b/lib.r Tue Oct 09 06:03:01 2018 -0400
[
@@ -57,7 +57,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 +108,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) {
@@ -330,24 +325,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 +364,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 +375,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 +401,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 +423,7 @@
         gc()
     }
     ## cat("\n")
-    
+
     invisible(new("xcmsEIC", eic = eic, mzrange = mzrange, rtrange = rtrange,
     rt = rt, groupnames = gnames))
 }
@@ -449,15 +444,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 +461,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 +488,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 +538,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 +567,7 @@
                 }
             }
             plot(eics, object, rtrange = eicwidth, mzdec=mzdec)
-            
+
             if (length(filebase))
             dev.off()
         } else {
@@ -596,13 +591,13 @@
                     height = h/72, onefile = FALSE)
                 }
             }
-            
+
             plotSpecWindow(object, gidxs = tsidx[seq(length = eicmax)], borderwidth=1)
-            
+
             if (length(filebase))
             dev.off()
         }
     }
-    
+
     invisible(twosamp)
 }