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

Changeset 13:024974037c4e (2021-04-07)
Previous changeset 12:0cab69429e1e (2020-09-24) Next changeset 14:8846a03995d3 (2023-09-11)
Commit message:
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
modified:
README.rst
lib.r
macros_xcms.xml
xcms_plot_chromatogram.r
xcms_plot_chromatogram.xml
added:
test-data/faahKO-single-class.xset.merged.group.retcor.RData
removed:
test-data/faahKO-single.xset.merged.group.retcor.RData
b
diff -r 0cab69429e1e -r 024974037c4e README.rst
--- a/README.rst Thu Sep 24 08:08:50 2020 +0000
+++ b/README.rst Wed Apr 07 12:07:49 2021 +0000
b
@@ -3,6 +3,10 @@
 
 .. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
 
+**Version 3.12.0+galaxy* - 03/03/2020**
+
+- UPGRADE: upgrade the xcms version from 3.6.1 to 3.12.0 (see XCMS News_)
+
 **Version 3.6.1.0 - 03/09/2019**
 
 - UPGRADE: upgrade the xcms version from 3.4.4 to 3.6.1 (see XCMS News_)
b
diff -r 0cab69429e1e -r 024974037c4e lib.r
--- a/lib.r Thu Sep 24 08:08:50 2020 +0000
+++ b/lib.r Wed Apr 07 12:07:49 2021 +0000
[
b'@@ -6,8 +6,8 @@\n parseCommandArgs <- function(...) {\n     args <- batch::parseCommandArgs(...)\n     for (key in names(args)) {\n-        if (args[key] %in% c("TRUE","FALSE"))\n-            args[key] = as.logical(args[key])\n+        if (args[key] %in% c("TRUE", "FALSE"))\n+            args[key] <- as.logical(args[key])\n     }\n     return(args)\n }\n@@ -17,14 +17,20 @@\n # - load the packages\n # - display the sessionInfo\n loadAndDisplayPackages <- function(pkgs) {\n-    for(pkg in pkgs) suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))\n+    for (pkg in pkgs) suppressPackageStartupMessages(stopifnot(library(pkg, quietly = TRUE, logical.return = TRUE, character.only = TRUE)))\n \n-    sessioninfo = sessionInfo()\n-    cat(sessioninfo$R.version$version.string,"\\n")\n+    sessioninfo <- sessionInfo()\n+    cat(sessioninfo$R.version$version.string, "\\n")\n     cat("Main packages:\\n")\n-    for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\\t") }; cat("\\n")\n+    for (pkg in names(sessioninfo$otherPkgs)) {\n+      cat(paste(pkg, packageVersion(pkg)), "\\t")\n+    }\n+    cat("\\n")\n     cat("Other loaded packages:\\n")\n-    for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\\t") }; cat("\\n")\n+    for (pkg in names(sessioninfo$loadedOnly)) {\n+      cat(paste(pkg, packageVersion(pkg)), "\\t")\n+    }\n+    cat("\\n")\n }\n \n #@author G. Le Corguille\n@@ -43,20 +49,20 @@\n     chromTIC_adjusted <- NULL\n     chromBPI_adjusted <- NULL\n     md5sumList <- NULL\n-    for(image in args$images) {\n+    for (image in args$images) {\n \n         load(image)\n         # Handle infiles\n         if (!exists("singlefile")) singlefile <- NULL\n         if (!exists("zipfile")) zipfile <- NULL\n-        rawFilePath <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile, args)\n+        rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args)\n         zipfile <- rawFilePath$zipfile\n         singlefile <- rawFilePath$singlefile\n \n         if (exists("raw_data")) xdata <- raw_data\n         if (!exists("xdata")) stop("\\n\\nERROR: The RData doesn\'t contain any object called \'xdata\'. This RData should have been created by an old version of XMCS 2.*")\n \n-        cat(sampleNamesList$sampleNamesOrigin,"\\n")\n+        cat(sampleNamesList$sampleNamesOrigin, "\\n")\n \n         if (!exists("xdata_merged")) {\n             xdata_merged <- xdata\n@@ -68,14 +74,14 @@\n             chromTIC_adjusted_merged <- chromTIC_adjusted\n             chromBPI_adjusted_merged <- chromBPI_adjusted\n         } else {\n-            if (is(xdata, "XCMSnExp")) xdata_merged <- c(xdata_merged,xdata)\n-            else if (is(xdata, "OnDiskMSnExp")) xdata_merged <- xcms:::.concatenate_OnDiskMSnExp(xdata_merged,xdata)\n+            if (is(xdata, "XCMSnExp")) xdata_merged <- c(xdata_merged, xdata)\n+            else if (is(xdata, "OnDiskMSnExp")) xdata_merged <- xcms:::.concatenate_OnDiskMSnExp(xdata_merged, xdata)\n             else stop("\\n\\nERROR: The RData either a OnDiskMSnExp object called raw_data or a XCMSnExp object called xdata")\n \n-            singlefile_merged <- c(singlefile_merged,singlefile)\n-            md5sumList_merged$origin <- rbind(md5sumList_merged$origin,md5sumList$origin)\n-            sampleNamesList_merged$sampleNamesOrigin <- c(sampleNamesList_merged$sampleNamesOrigin,sampleNamesList$sampleNamesOrigin)\n-            sampleNamesList_merged$sampleNamesMakeNames <- c(sampleNamesList_merged$sampleNamesMakeNames,sampleNamesList$sampleNamesMakeNames)\n+            singlefile_merged <- c(singlefile_merged, singlefile)\n+            md5sumList_merged$origin <- rbind(md5sumList_merged$origin, md5sumList$origin)\n+            sampleNamesList_merged$sampleNamesOrigin <- c(sampleNamesList_merged$sampleNamesOrigin, sampleNamesList$sampleNamesOrigin)\n+            sampleNamesList_merged$sampleNamesMakeNames <- c(sampleNamesList_merged$sampleNamesMakeNames, sampleNamesList$sampleNamesMakeNam'..b'length("singlefile") > 0)) {\n         files <- vector()\n         for (singlefile_sampleName in names(singlefile)) {\n             singlefile_galaxyPath <- singlefile[[singlefile_sampleName]]\n-            if(!file.exists(singlefile_galaxyPath)){\n-                error_message <- paste("Cannot access the sample:",singlefile_sampleName,"located:",singlefile_galaxyPath,". Please, contact your administrator ... if you have one!")\n+            if (!file.exists(singlefile_galaxyPath)) {\n+                error_message <- paste("Cannot access the sample:", singlefile_sampleName, "located:", singlefile_galaxyPath, ". Please, contact your administrator ... if you have one!")\n                 print(error_message); stop(error_message)\n             }\n \n-            if (!suppressWarnings( try (file.link(singlefile_galaxyPath, singlefile_sampleName), silent=T)))\n+            if (!suppressWarnings(try(file.link(singlefile_galaxyPath, singlefile_sampleName), silent = T)))\n                 file.copy(singlefile_galaxyPath, singlefile_sampleName)\n             files <- c(files, singlefile_sampleName)\n         }\n     }\n     # zipfile\n-    if(!is.null(zipfile) && (zipfile != "")) {\n-        if(!file.exists(zipfile)){\n-            error_message <- paste("Cannot access the Zip file:",zipfile,". Please, contact your administrator ... if you have one!")\n+    if (!is.null(zipfile) && (zipfile != "")) {\n+        if (!file.exists(zipfile)) {\n+            error_message <- paste("Cannot access the Zip file:", zipfile, ". Please, contact your administrator ... if you have one!")\n             print(error_message)\n             stop(error_message)\n         }\n-        suppressWarnings(unzip(zipfile, unzip="unzip"))\n+        suppressWarnings(unzip(zipfile, unzip = "unzip"))\n \n         #get the directory name\n-        suppressWarnings(filesInZip <- unzip(zipfile, list=T))\n-        directories <- unique(unlist(lapply(strsplit(filesInZip$Name,"/"), function(x) x[1])))\n+        suppressWarnings(filesInZip <- unzip(zipfile, list = T))\n+        directories <- unique(unlist(lapply(strsplit(filesInZip$Name, "/"), function(x) x[1])))\n         directories <- directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir]\n         directory <- "."\n         if (length(directories) == 1) directory <- directories\n \n-        cat("files_root_directory\\t",directory,"\\n")\n+        cat("files_root_directory\\t", directory, "\\n")\n \n-        filepattern <- c("[Cc][Dd][Ff]", "[Nn][Cc]", "([Mm][Zz])?[Xx][Mm][Ll]","[Mm][Zz][Dd][Aa][Tt][Aa]", "[Mm][Zz][Mm][Ll]")\n-        filepattern <- paste(paste("\\\\.", filepattern, "$", sep=""),collapse="|")\n+        filepattern <- c("[Cc][Dd][Ff]", "[Nn][Cc]", "([Mm][Zz])?[Xx][Mm][Ll]", "[Mm][Zz][Dd][Aa][Tt][Aa]", "[Mm][Zz][Mm][Ll]")\n+        filepattern <- paste(paste("\\\\.", filepattern, "$", sep = ""), collapse = "|")\n         info <- file.info(directory)\n-        listed <- list.files(directory[info$isdir], pattern=filepattern,recursive=TRUE, full.names=TRUE)\n+        listed <- list.files(directory[info$isdir], pattern = filepattern, recursive = TRUE, full.names = TRUE)\n         files <- c(directory[!info$isdir], listed)\n         exists <- file.exists(files)\n         files <- files[exists]\n \n     }\n-    return(list(zipfile=zipfile, singlefile=singlefile, files=files))\n+    return(list(zipfile = zipfile, singlefile = singlefile, files = files))\n \n }\n \n@@ -417,15 +437,15 @@\n getxcmsSetObject <- function(xobject) {\n     # XCMS 1.x\n     if (class(xobject) == "xcmsSet")\n-        return (xobject)\n+        return(xobject)\n     # XCMS 3.x\n     if (class(xobject) == "XCMSnExp") {\n         # Get the legacy xcmsSet object\n-        suppressWarnings(xset <- as(xobject, \'xcmsSet\'))\n+        suppressWarnings(xset <- as(xobject, "xcmsSet"))\n         if (!is.null(xset@phenoData$sample_group))\n             sampclass(xset) <- xset@phenoData$sample_group\n         else\n             sampclass(xset) <- "."\n-        return (xset)\n+        return(xset)\n     }\n }\n'
b
diff -r 0cab69429e1e -r 024974037c4e macros_xcms.xml
--- a/macros_xcms.xml Thu Sep 24 08:08:50 2020 +0000
+++ b/macros_xcms.xml Wed Apr 07 12:07:49 2021 +0000
b
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <macros>
 
-    <token name="@TOOL_VERSION@">3.6.1</token>
+    <token name="@TOOL_VERSION@">3.12.0</token>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@TOOL_VERSION@">bioconductor-xcms</requirement>
@@ -243,6 +243,7 @@
 .. _xcms: https://bioconductor.org/packages/release/bioc/html/xcms.html
 .. _manual: http://www.bioconductor.org/packages/release/bioc/manuals/xcms/man/xcms.pdf
 .. _example: https://bioconductor.org/packages/release/bioc/vignettes/xcms/inst/doc/xcms.html
+.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
 
     </token>
 
@@ -256,6 +257,11 @@
 
 - UPGRADE: upgrade the xcms version from 3.4.4 to 3.6.1 (see XCMS News_)
     </token>
+    <token name="@HELP_XCMS_NEWVERSION_31200@">
+**Version 3.12.0+galaxy* - 03/03/2020**
+
+- UPGRADE: upgrade the xcms version from 3.6.1 to 3.12.0 (see XCMS News_)
+    </token>
 
     <xml name="citation">
         <citations>
b
diff -r 0cab69429e1e -r 024974037c4e test-data/faahKO-single-class.xset.merged.group.retcor.RData
b
Binary file test-data/faahKO-single-class.xset.merged.group.retcor.RData has changed
b
diff -r 0cab69429e1e -r 024974037c4e test-data/faahKO-single.xset.merged.group.retcor.RData
b
Binary file test-data/faahKO-single.xset.merged.group.retcor.RData has changed
b
diff -r 0cab69429e1e -r 024974037c4e xcms_plot_chromatogram.r
--- a/xcms_plot_chromatogram.r Thu Sep 24 08:08:50 2020 +0000
+++ b/xcms_plot_chromatogram.r Wed Apr 07 12:07:49 2021 +0000
[
@@ -5,18 +5,20 @@
 cat("\tSESSION INFO\n")
 
 #Import the different functions
-source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
+source_local <- function(fname) {
+  argv <- commandArgs(trailingOnly = FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep = "/"))
+}
 source_local("lib.r")
 
-pkgs <- c("xcms","batch","RColorBrewer")
+pkgs <- c("xcms", "batch", "RColorBrewer")
 loadAndDisplayPackages(pkgs)
 cat("\n\n");
 
 
 # ----- ARGUMENTS -----
 cat("\tARGUMENTS INFO\n")
-args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
-write.table(as.matrix(args), col.names=F, quote=F, sep='\t')
+args <- parseCommandArgs(evaluate = FALSE) #interpretation of arguments given in command line as an R list of objects
+write.table(as.matrix(args), col.names = F, quote = F, sep = "\t")
 
 cat("\n\n")
 
@@ -49,14 +51,18 @@
 cat("\t\tDRAW GRAPHICS\n")
 
 register(SerialParam())
-if (!exists("chromTIC") || is.null(chromTIC)) { cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum") }
-if (!exists("chromBPI") || is.null(chromBPI)) { cat("\t\t\tCompute BPI\n"); chromBPI <- chromatogram(xdata, aggregationFun = "max") }
+if (!exists("chromTIC") || is.null(chromTIC)) {
+  cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum")
+}
+if (!exists("chromBPI") || is.null(chromBPI)) {
+  cat("\t\t\tCompute BPI\n"); chromBPI <- chromatogram(xdata, aggregationFun = "max")
+}
 
 if (!is.null(chromTIC_adjusted)) chromTIC <- chromTIC_adjusted
 if (!is.null(chromBPI_adjusted)) chromBPI <- chromBPI_adjusted
 
-getPlotChromatogram(chromTIC, xdata, pdfname="TICs.pdf", aggregationFun = "sum")
-getPlotChromatogram(chromBPI, xdata, pdfname="BPIs.pdf", aggregationFun = "max")
+getPlotChromatogram(chromTIC, xdata, pdfname = "TICs.pdf", aggregationFun = "sum")
+getPlotChromatogram(chromBPI, xdata, pdfname = "BPIs.pdf", aggregationFun = "max")
 
 cat("\n\n")
 
@@ -66,12 +72,5 @@
 print(xdata)
 cat("\n\n")
 
-# 2020-01-17 - disable because xcms 3.4.4 raises an error with xdata build with xcms 3.6.1
-#cat("\txcmsSet OBJECT INFO\n")
-# Get the legacy xcmsSet object
-#xset <- getxcmsSetObject(xdata)
-#print(xset)
-#cat("\n\n")
-
 
 cat("\tDONE\n")
b
diff -r 0cab69429e1e -r 024974037c4e xcms_plot_chromatogram.xml
--- a/xcms_plot_chromatogram.xml Thu Sep 24 08:08:50 2020 +0000
+++ b/xcms_plot_chromatogram.xml Wed Apr 07 12:07:49 2021 +0000
b
@@ -1,4 +1,4 @@
-<tool id="xcms_plot_chromatogram" name="xcms plot chromatogram" version="@TOOL_VERSION@+galaxy2">
+<tool id="xcms_plot_chromatogram" name="xcms plot chromatogram" version="@TOOL_VERSION@+galaxy0">
     <description>Plots base peak intensity chromatogram (BPI) and total ion current chromatogram (TIC) from MSnbase or xcms experiment(s)</description>
 
     <macros>
@@ -34,7 +34,7 @@
 
     <tests>
         <test>
-            <param name="images" value="faahKO-single.xset.merged.group.retcor.RData" ftype="rdata"/>
+            <param name="images" value="faahKO-single-class.xset.merged.group.retcor.RData" ftype="rdata"/>
             <expand macro="test_file_load_single"/>
             <param name="sampleMetadata" value="sampleMetadata.tab" ftype="tabular"/>
             <output name="ticsPdf" value="TICs.pdf" ftype="pdf" compare="sim_size" delta="5000" />
@@ -102,12 +102,12 @@
 Changelog/News
 --------------
 
+@HELP_XCMS_NEWVERSION_31200@
+
 **Galaxy Version 3.6.1+galaxy2 - 23/09/2020**
 
 - BUGFIX: sample group colours did not match group labels.
 
-.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
-
 @HELP_XCMS_NEWVERSION_3610@
 
 @HELP_XCMS_NEWVERSION_3440@