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

Changeset 25:aa252eec9229 (2021-04-07)
Previous changeset 24:c8011370e90f (2020-07-29) Next changeset 26:36480435e92b (2023-09-11)
Commit message:
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit dcc90f9cf76e6980c0a7d9698c89fab826e7adae"
modified:
README.rst
abims_xcms_retcor.xml
lib.r
macros_xcms.xml
repository_dependencies.xml
xcms_retcor.r
added:
test-data/faahKO-single-class.xset.merged.group.RData
removed:
test-data/faahKO-single-class.xset.group.RData
test-data/faahKO.xset.group.RData
test-data/faahKO_reduce.zip
b
diff -r c8011370e90f -r aa252eec9229 README.rst
--- a/README.rst Wed Jul 29 05:10:58 2020 -0400
+++ b/README.rst Wed Apr 07 12:08:25 2021 +0000
b
@@ -4,6 +4,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+galaxy1 - 13/02/2020**
 
 - NEW: if a retention time ajustment have already been applied to your data. The function applyAdjustedRtime will replace raw retention times with adjusted retention times and so alloww to cumulate the ajustments.
b
diff -r c8011370e90f -r aa252eec9229 abims_xcms_retcor.xml
--- a/abims_xcms_retcor.xml Wed Jul 29 05:10:58 2020 -0400
+++ b/abims_xcms_retcor.xml Wed Apr 07 12:08:25 2021 +0000
b
@@ -1,4 +1,4 @@
-<tool id="abims_xcms_retcor" name="xcms adjustRtime (retcor)" version="@TOOL_VERSION@+galaxy1">
+<tool id="abims_xcms_retcor" name="xcms adjustRtime (retcor)" version="@TOOL_VERSION@+galaxy0">
 
     <description>Retention Time Correction</description>
 
@@ -133,7 +133,7 @@
 
     <tests>
         <test>
-            <param name="image" value="faahKO-single-class.xset.group.RData" ftype="rdata"/>
+            <param name="image" value="faahKO-single-class.xset.merged.group.RData" ftype="rdata"/>
             <conditional name="methods">
                 <param name="method" value="PeakGroups"/>
                 <param name="extraPeaks" value="1"/>
@@ -309,7 +309,7 @@
 Changelog/News
 --------------
 
-.. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
+@HELP_XCMS_NEWVERSION_31200@
 
 **Version 3.6.1+galaxy1 - 13/02/2020**
 
b
diff -r c8011370e90f -r aa252eec9229 lib.r
--- a/lib.r Wed Jul 29 05:10:58 2020 -0400
+++ b/lib.r Wed Apr 07 12:08:25 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 c8011370e90f -r aa252eec9229 macros_xcms.xml
--- a/macros_xcms.xml Wed Jul 29 05:10:58 2020 -0400
+++ b/macros_xcms.xml Wed Apr 07 12:08:25 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 c8011370e90f -r aa252eec9229 repository_dependencies.xml
--- a/repository_dependencies.xml Wed Jul 29 05:10:58 2020 -0400
+++ b/repository_dependencies.xml Wed Apr 07 12:08:25 2021 +0000
b
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <repositories>
-    <repository changeset_revision="7800ba9a4c1e" name="no_unzip_datatype" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
-    <repository changeset_revision="544f6d2329ac" name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu"/>
+    <repository name="no_unzip_datatype" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="7800ba9a4c1e"/>
+    <repository name="rdata_xcms_datatypes" owner="lecorguille" toolshed="https://toolshed.g2.bx.psu.edu" changeset_revision="544f6d2329ac"/>
 </repositories>
\ No newline at end of file
b
diff -r c8011370e90f -r aa252eec9229 test-data/faahKO-single-class.xset.group.RData
b
Binary file test-data/faahKO-single-class.xset.group.RData has changed
b
diff -r c8011370e90f -r aa252eec9229 test-data/faahKO-single-class.xset.merged.group.RData
b
Binary file test-data/faahKO-single-class.xset.merged.group.RData has changed
b
diff -r c8011370e90f -r aa252eec9229 test-data/faahKO.xset.group.RData
b
Binary file test-data/faahKO.xset.group.RData has changed
b
diff -r c8011370e90f -r aa252eec9229 test-data/faahKO_reduce.zip
b
Binary file test-data/faahKO_reduce.zip has changed
b
diff -r c8011370e90f -r aa252eec9229 xcms_retcor.r
--- a/xcms_retcor.r Wed Jul 29 05:10:58 2020 -0400
+++ b/xcms_retcor.r Wed Apr 07 12:08:25 2021 +0000
[
@@ -1,7 +1,7 @@
 #!/usr/bin/env Rscript
 
 # ----- LOG FILE -----
-log_file=file("log.txt", open = "wt")
+log_file <- file("log.txt", open = "wt")
 sink(log_file)
 sink(log_file, type = "output")
 
@@ -10,18 +10,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")
 
@@ -38,13 +40,13 @@
 cat("\tINFILE PROCESSING INFO\n")
 
 #image is an .RData file necessary to use xset variable given by previous tools
-load(args$image); args$image=NULL
+load(args$image); args$image <- NULL
 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.*")
 
 # Handle infiles
 if (!exists("singlefile")) singlefile <- NULL
 if (!exists("zipfile")) zipfile <- NULL
-rawFilePath <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile, args)
+rawFilePath <- retrieveRawfileInTheWorkingDir(singlefile, zipfile, args)
 zipfile <- rawFilePath$zipfile
 singlefile <- rawFilePath$singlefile
 
@@ -59,9 +61,9 @@
 
 cat("\t\t\tAlignment/Retention Time correction\n")
 # clear the arguement list to remove unexpected key/value as singlefile_galaxyPath or method ...
-args <- args[names(args) %in% slotNames(do.call(paste0(method,"Param"), list()))]
+args <- args[names(args) %in% slotNames(do.call(paste0(method, "Param"), list()))]
 
-adjustRtimeParam <- do.call(paste0(method,"Param"), args)
+adjustRtimeParam <- do.call(paste0(method, "Param"), args)
 print(adjustRtimeParam)
 
 if (hasAdjustedRtime(xdata)) {
@@ -69,11 +71,7 @@
   cat("Replace raw retention times with adjusted retention times.\n")
   xdata <- applyAdjustedRtime(xdata)
 }
-xdata <- adjustRtime(xdata, param=adjustRtimeParam)
-
-#cat("\t\t\tCompute and Store TIC and BPI\n")
-#chromTIC_adjusted = chromatogram(xdata, aggregationFun = "sum")
-#chromBPI_adjusted = chromatogram(xdata, aggregationFun = "max")
+xdata <- adjustRtime(xdata, param = adjustRtimeParam)
 
 cat("\n\n")
 
@@ -97,8 +95,8 @@
 cat("\n\n")
 
 #saving R data in .Rdata file to save the variables used in the present tool
-objects2save = c("xdata","zipfile","singlefile","md5sumList","sampleNamesList") #, "chromTIC", "chromBPI", "chromTIC_adjusted", "chromBPI_adjusted")
-save(list=objects2save[objects2save %in% ls()], file="retcor.RData")
+objects2save <- c("xdata", "zipfile", "singlefile", "md5sumList", "sampleNamesList")
+save(list = objects2save[objects2save %in% ls()], file = "retcor.RData")
 
 cat("\n\n")