# HG changeset patch
# User lecorguille
# Date 1453237084 18000
# Node ID 467dc9b12da560fcef55478bf4d31bc8949b174c
# Parent 753cde95b6a84f0ce6867426a420ed1df5bbe7b8
Uploaded
diff -r 753cde95b6a8 -r 467dc9b12da5 xcms_report.r
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xcms_report.r Tue Jan 19 15:58:04 2016 -0500
@@ -0,0 +1,132 @@
+#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
+# version="0.1.0"
+#@author Gildas Le Corguille lecorguille@sb-roscoff.fr ABIMS TEAM
+
+
+
+# ----- ARGUMENTS BLACKLIST -----
+#xcms.r
+argBlacklist=c("zipfile","xfunction","xsetRdataOutput","sampleMetadataOutput","ticspdf","bicspdf","rplotspdf")
+#CAMERA.r
+argBlacklist=c(argBlacklist,"dataMatrixOutput","variableMetadataOutput","new_file_path")
+
+# ----- PACKAGE -----
+
+pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")
+for(pkg in pkgs) {
+ suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
+}
+
+
+# ----- FUNCTION -----
+writehtml = function(...) { cat(...,"\n", file=htmlOutput,append = TRUE,sep="") }
+
+
+# ----- ARGUMENTS -----
+
+listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
+
+
+# ----- ARGUMENTS PROCESSING -----
+
+#image is an .RData file necessary to use xset variable given by previous tools
+load(listArguments[["image"]]);
+
+htmlOutput = "report.html"
+if (!is.null(listArguments[["htmlOutput"]])){
+ htmlOutput = listArguments[["htmlOutput"]];
+}
+
+user_email = NULL
+if (!is.null(listArguments[["user_email"]])){
+ user_email = listArguments[["user_email"]];
+}
+
+
+# ----- MAIN PROCESSING INFO -----
+writehtml("")
+writehtml("")
+
+writehtml("
")
+ writehtml("")
+
+ writehtml("[W4M] XCMS analysis report")
+
+ writehtml("")
+writehtml("")
+
+writehtml("")
+ writehtml("___ XCMS analysis report using Workflow4Metabolomics ___
")
+ # to pass the planemo shed_test
+ if (user_email != "test@bx.psu.edu") {
+ if (!is.null(user_email)) writehtml("By: ",user_email," - ")
+ writehtml("Date: ",format(Sys.time(), "%y%m%d-%H:%M:%S"))
+ }
+
+
+ writehtml("Samples used:
")
+ writehtml("sample | filename | ")
+ writehtml(paste("",sampnames(xset)," | ",xset@filepaths," |
"))
+ writehtml("
")
+
+ writehtml("Function launched:
")
+ writehtml("")
+ writehtml("timestamp (ymd-h:m:s) | function | argument | value |
")
+ for(tool in names(listOFlistArguments)) {
+ listOFlistArgumentsDisplay=listOFlistArguments[[tool]][!(names(listOFlistArguments[[tool]]) %in% argBlacklist)]
+
+ timestamp = strsplit(tool,"_")[[1]][1]
+ xcmsFunction = strsplit(tool,"_")[[1]][2]
+ writehtml("",timestamp," | ",xcmsFunction," | ")
+ line_begin=""
+ for (arg in names(listOFlistArgumentsDisplay)) {
+ writehtml(line_begin,"",arg," | ",unlist(listOFlistArgumentsDisplay[arg][1])," |
")
+ line_begin=""
+ }
+ }
+ writehtml("
")
+
+ writehtml("Information about the xcmsSet object:
")
+
+ log_file=file(htmlOutput, open = "at")
+ writehtml("")
+ sink(log_file)
+ sink(log_file, type = "output")
+ xset
+ sink()
+ writehtml("
")
+
+ writehtml("Citations:
")
+ writehtml("")
+ writehtml("- To cite the XCMS package in publications use:")
+ writehtml("
")
+ writehtml("- ","Smith, C.A. and Want, E.J. and O'Maille, G. and Abagyan,R. and Siuzdak, G.XCMS: Processing mass spectrometry data for metabolite profiling using nonlinear peak alignment, matching and identification, Analytical Chemistry, 78:779-787 (2006)","
")
+ writehtml("- ","Ralf Tautenhahn, Christoph Boettcher, Steffen Neumann: Highly sensitive feature detection for high resolution LC/MS BMC Bioinformatics, 9:504 (2008)","
")
+ writehtml("- ","H. Paul Benton, Elizabeth J. Want and Timothy M. D. Ebbels Correction of mass calibration gaps in liquid chromatography-mass spectrometry metabolomics data Bioinformatics, 26:2488 (2010)","
")
+ writehtml("
")
+ writehtml(" ")
+
+ writehtml("- To cite the CAMERA package in publications use:")
+ writehtml("
")
+ writehtml("- ","Kuhl, C., Tautenhahn, R., Boettcher, C., Larson, T. R. and Neumann,S. CAMERA: an integrated strategy for compound spectra extraction and annotation of liquid chromatography/mass spectrometry data sets. Analytical Chemistry, 84:283-289 (2012)","
")
+ writehtml("
")
+ writehtml(" ")
+
+ writehtml("- To cite the Workflow4Metabolimics (W4M) project in publications use:")
+ writehtml("
")
+ writehtml("- ","Franck Giacomoni, Gildas Le Corguillé, Misharl Monsoor, Marion Landi, Pierre Pericard, Mélanie Pétéra, Christophe Duperier, Marie Tremblay-Franco, Jean-François Martin, Daniel Jacob, Sophie Goulitquer, Etienne A. Thévenot and Christophe Caron (2014). Workflow4Metabolomics: A collaborative research infrastructure for computational metabolomics. Bioinformatics doi:10.1093/bioinformatics/btu813","
")
+ writehtml("
")
+ writehtml(" ")
+ writehtml("
")
+
+writehtml("")
+
+writehtml("")
+