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

Changeset 10:dbd877060ac3 (2020-02-12)
Previous changeset 9:271c9d5f0d10 (2019-06-03) Next changeset 11:37d31fd64eb4 (2020-07-21)
Commit message:
"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit f1caf2a3bf23cf319a75dd12c86402555dd02617"
modified:
README.rst
lib.r
macros_xcms.xml
test-data/faahKO-single.xset.merged.group.retcor.RData
xcms_plot_chromatogram.r
xcms_plot_chromatogram.xml
b
diff -r 271c9d5f0d10 -r dbd877060ac3 README.rst
--- a/README.rst Mon Jun 03 07:12:50 2019 -0400
+++ b/README.rst Wed Feb 12 08:30:06 2020 -0500
b
@@ -3,6 +3,10 @@
 
 .. _News: https://bioconductor.org/packages/release/bioc/news/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_)
+
 **Version 3.4.4.0 - 08/02/2019**
 
 - UPGRADE: upgrade the xcms version from 3.0.0 to 3.4.4 (see XCMS News_)
b
diff -r 271c9d5f0d10 -r dbd877060ac3 lib.r
--- a/lib.r Mon Jun 03 07:12:50 2019 -0400
+++ b/lib.r Wed Feb 12 08:30:06 2020 -0500
[
b'@@ -42,16 +42,16 @@\n     chromBPI <- NULL\n     chromTIC_adjusted <- NULL\n     chromBPI_adjusted <- NULL\n+    md5sumList <- NULL\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 <- getRawfilePathFromArguments(singlefile, zipfile, args)\n+        rawFilePath <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile, args)\n         zipfile <- rawFilePath$zipfile\n         singlefile <- rawFilePath$singlefile\n-        retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)\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@@ -149,7 +149,7 @@\n \n     par(mfrow = c(3, 1), mar = c(4, 4, 1, 0.5))\n \n-    group_colors <- brewer.pal(3, "Set1")[1:length(unique(xdata$sample_group))]\n+    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")\n     names(group_colors) <- unique(xdata$sample_group)\n \n     xlim <- c(min(featureDefinitions(xdata)$rtmin), max(featureDefinitions(xdata)$rtmax))\n@@ -170,7 +170,7 @@\n     pdf(file="raw_vs_adjusted_rt.pdf", width=16, height=12)\n \n     # Color by group\n-    group_colors <- brewer.pal(3, "Set1")[1:length(unique(xdata$sample_group))]\n+    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")\n     if (length(group_colors) > 1) {\n         names(group_colors) <- unique(xdata$sample_group)\n         plotAdjustedRtime(xdata, col = group_colors[xdata$sample_group])\n@@ -239,15 +239,15 @@\n     pdf(pdfname, width=16, height=10)\n \n     # Color by group\n-    group_colors <- brewer.pal(3, "Set1")[1:length(unique(xdata$sample_group))]\n+    group_colors <- brewer.pal(length(unique(xdata$sample_group)), "Set1")\n     if (length(group_colors) > 1) {\n         names(group_colors) <- unique(xdata$sample_group)\n-        plot(chrom, col = group_colors[chrom$sample_group], main=main)\n+        plot(chrom, col = group_colors[as.factor(chrom$sample_group)], main=main, peakType = "none")\n         legend("topright", legend=names(group_colors), col=group_colors, cex=0.8, lty=1)\n     }\n \n     # Color by sample\n-    plot(chrom, col = rainbow(length(xdata@phenoData@data$sample_name)), main=main)\n+    plot(chrom, col = rainbow(length(xdata@phenoData@data$sample_name)), main=main, peakType = "none")\n     legend("topright", legend=xdata@phenoData@data$sample_name, col=rainbow(length(xdata@phenoData@data$sample_name)), cex=0.8, lty=1)\n \n     dev.off()\n@@ -317,142 +317,43 @@\n }\n \n \n-# This function check if xcms will found all the files\n-#@author Gildas Le Corguille lecorguille@sb-roscoff.fr ABiMS TEAM\n-checkFilesCompatibilityWithXcms <- function(directory) {\n-    cat("Checking files filenames compatibilities with xmcs...\\n")\n-    # WHAT XCMS WILL FIND\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-    files <- c(directory[!info$isdir], listed)\n-    files_abs <- file.path(getwd(), files)\n-    exists <- file.exists(files_abs)\n-    files[exists] <- files_abs[exists]\n-    files[exists] <- sub("//","/",files[exists])\n-\n-    # WHAT IS ON THE FILESYSTEM\n-    filesystem_filepaths <- system(paste0("find \\"",getwd(),"/",directory,"\\" -not -name \'\\\\.*\' -not -path \'*conda-env*\' -type f -name \\"*\\""), intern=T)\n-    filesystem_filepaths <- filesystem_filepaths[grep(filepattern, filesystem_filepaths, perl=T)]\n-\n-    # COMPARISON\n-    if (!is.na(table(filesystem_filepaths %in% files)["FALSE"])) {\n-        write("\\n\\nERROR: List of the files which will not be imported by xcmsSet",stderr())\n-        write(files'..b'ames <- unlist(strsplit(singlefile_sampleNames,"\\\\|"))\n-\n-    singlefile <- NULL\n-    for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {\n-      singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]\n-      singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]\n-      # In case, an url is used to import data within Galaxy\n-      singlefile_sampleName <- tail(unlist(strsplit(singlefile_sampleName,"/")), n=1)\n-      singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath\n-    }\n-  }\n-  return(list(zipfile=zipfile, singlefile=singlefile))\n-}\n-\n # This function retrieve the raw file in the working directory\n #   - if zipfile: unzip the file with its directory tree\n #   - if singlefiles: set symlink with the good filename\n #@author Gildas Le Corguille lecorguille@sb-roscoff.fr\n-retrieveRawfileInTheWorkingDirectory <- function(singlefile, zipfile) {\n+retrieveRawfileInTheWorkingDirectory <- function(singlefile, zipfile, args, prefix="") {\n+\n+    if (!(prefix %in% c("","Positive","Negative","MS1","MS2"))) stop("prefix must be either \'\', \'Positive\', \'Negative\', \'MS1\' or \'MS2\'")\n+\n+    # single - if the file are passed in the command arguments -> refresh singlefile\n+    if (!is.null(args[[paste0("singlefile_galaxyPath",prefix)]])) {\n+      singlefile_galaxyPaths <- unlist(strsplit(args[[paste0("singlefile_galaxyPath",prefix)]],"\\\\|"))\n+      singlefile_sampleNames <- unlist(strsplit(args[[paste0("singlefile_sampleName",prefix)]],"\\\\|"))\n+\n+      singlefile <- NULL\n+      for (singlefile_galaxyPath_i in seq(1:length(singlefile_galaxyPaths))) {\n+        singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i]\n+        singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i]\n+        # In case, an url is used to import data within Galaxy\n+        singlefile_sampleName <- tail(unlist(strsplit(singlefile_sampleName,"/")), n=1)\n+        singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath\n+      }\n+    }\n+    # zipfile - if the file are passed in the command arguments -> refresh zipfile\n+    if (!is.null(args[[paste0("zipfile",prefix)]]))\n+      zipfile <- args[[paste0("zipfile",prefix)]]\n+\n+    # single\n     if(!is.null(singlefile) && (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@@ -462,22 +363,16 @@\n \n             if (!suppressWarnings( try (file.link(singlefile_galaxyPath, singlefile_sampleName), silent=T)))\n                 file.copy(singlefile_galaxyPath, singlefile_sampleName)\n-\n+            files <- c(files, singlefile_sampleName)\n         }\n-        directory <- "."\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             print(error_message)\n             stop(error_message)\n         }\n-\n-        #list all file in the zip file\n-        #zip_files <- unzip(zipfile,list=T)[,"Name"]\n-\n-        #unzip\n         suppressWarnings(unzip(zipfile, unzip="unzip"))\n \n         #get the directory name\n@@ -489,8 +384,17 @@\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+        info <- file.info(directory)\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 (directory)\n+    return(list(zipfile=zipfile, singlefile=singlefile, files=files))\n+\n }\n \n \n'
b
diff -r 271c9d5f0d10 -r dbd877060ac3 macros_xcms.xml
--- a/macros_xcms.xml Mon Jun 03 07:12:50 2019 -0400
+++ b/macros_xcms.xml Wed Feb 12 08:30:06 2020 -0500
b
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
 <macros>
 
-    <token name="@WRAPPER_VERSION@">3.4.4</token>
+    <token name="@TOOL_VERSION@">3.6.1</token>
     <xml name="requirements">
         <requirements>
-            <requirement type="package" version="@WRAPPER_VERSION@">bioconductor-xcms</requirement>
-            <requirement type="package" version="1.1_4">r-batch</requirement>
+            <requirement type="package" version="@TOOL_VERSION@">bioconductor-xcms</requirement>
+            <requirement type="package" version="1.1_5">r-batch</requirement>
             <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
             <requirement type="package" version="6.0">unzip</requirement>
             <yield />
@@ -69,11 +69,11 @@
         </section>
     </xml>
 
-    <xml name="test_file_load_single_ko15">
+    <xml name="test_file_load_single_file" token_filename="">
         <section name="file_load_section">
             <conditional name="file_load_conditional">
                 <param name="file_load_select" value="yes" />
-                <param name="input" value="ko15.CDF" ftype="netcdf" />
+                <param name="input" value="@FILENAME@.CDF" ftype="netcdf" />
             </conditional>
         </section>
     </xml>
@@ -178,7 +178,7 @@
     </token>
 
     <xml name="input_centwave">
-        <param argument="ppm" type="integer" value="25" label="Max tolerated ppm m/z deviation in consecutive scans in ppm" help="for the initial ROI definition." />
+        <param argument="ppm" type="float" value="25" label="Max tolerated ppm m/z deviation in consecutive scans in ppm" help="for the initial ROI definition." />
         <param argument="peakwidth" type="text" value="20,50" label="Min,Max peak width in seconds" help="with the expected approximate peak width in chromatographic space.">
             <expand macro="input_validator_range_float"/>
         </param>
@@ -246,6 +246,17 @@
 
     </token>
 
+    <token name="@HELP_XCMS_NEWVERSION_3440@">
+**Version 3.4.4.0 - 08/02/2019**
+
+- UPGRADE: upgrade the xcms version from 3.0.0 to 3.4.4 (see XCMS News_)
+    </token>
+    <token name="@HELP_XCMS_NEWVERSION_3610@">
+**Version 3.6.1+galaxy* - 03/09/2019**
+
+- UPGRADE: upgrade the xcms version from 3.4.4 to 3.6.1 (see XCMS News_)
+    </token>
+
     <xml name="citation">
         <citations>
             <citation type="doi">10.1021/ac051437y</citation>
b
diff -r 271c9d5f0d10 -r dbd877060ac3 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 271c9d5f0d10 -r dbd877060ac3 xcms_plot_chromatogram.r
--- a/xcms_plot_chromatogram.r Mon Jun 03 07:12:50 2019 -0400
+++ b/xcms_plot_chromatogram.r Wed Feb 12 08:30:06 2020 -0500
b
@@ -49,8 +49,8 @@
 cat("\t\tDRAW GRAPHICS\n")
 
 register(SerialParam())
-if (!is.null(chromTIC) || is.null(chromTIC)) { cat("\t\t\tCompute TIC\n"); chromTIC <- chromatogram(xdata, aggregationFun = "sum") }
-if (!is.null(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
@@ -66,11 +66,12 @@
 print(xdata)
 cat("\n\n")
 
-cat("\txcmsSet OBJECT INFO\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")
+#xset <- getxcmsSetObject(xdata)
+#print(xset)
+#cat("\n\n")
 
 
 cat("\tDONE\n")
b
diff -r 271c9d5f0d10 -r dbd877060ac3 xcms_plot_chromatogram.xml
--- a/xcms_plot_chromatogram.xml Mon Jun 03 07:12:50 2019 -0400
+++ b/xcms_plot_chromatogram.xml Wed Feb 12 08:30:06 2020 -0500
b
@@ -1,11 +1,10 @@
-<tool id="xcms_plot_chromatogram" name="xcms plot chromatogram" version="@WRAPPER_VERSION@.0">
+<tool id="xcms_plot_chromatogram" name="xcms plot chromatogram" version="@TOOL_VERSION@.0">
     <description>Plots base peak intensity chromatogram (BPI) and total ion current chromatogram (TIC) from MSnbase or xcms experiment(s)</description>
 
     <macros>
         <import>macros.xml</import>
         <import>macros_xcms.xml</import>
     </macros>
-
     <expand macro="requirements"/>
     <expand macro="stdio"/>
 
@@ -38,8 +37,8 @@
             <param name="images" value="faahKO-single.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="600" />
-            <output name="bpisPdf" value="BPIs.pdf" ftype="pdf" compare="sim_size" delta="600" />
+            <output name="ticsPdf" value="TICs.pdf" ftype="pdf" compare="sim_size" delta="5000" />
+            <output name="bpisPdf" value="BPIs.pdf" ftype="pdf" compare="sim_size" delta="5000" />
         </test>
         <!-- DISABLE FOR TRAVIS
         <test>
@@ -105,9 +104,9 @@
 
 .. _News: https://bioconductor.org/packages/release/bioc/news/xcms/NEWS
 
-**Version 3.4.4.0 - 08/02/2019**
+@HELP_XCMS_NEWVERSION_3610@
 
-- UPGRADE: upgrade the xcms version from 3.0.0 to 3.4.4 (see XCMS News_)
+@HELP_XCMS_NEWVERSION_3440@
 
 **Version 3.0.0.0 - 07/03/2018**