11
|
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
|
|
2 # version="0.1.0"
|
|
3 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr ABIMS TEAM
|
|
4
|
|
5
|
|
6
|
|
7 # ----- ARGUMENTS BLACKLIST -----
|
|
8 #xcms.r
|
|
9 argBlacklist=c("zipfile","xfunction","xsetRdataOutput","sampleMetadataOutput","ticspdf","bicspdf","rplotspdf")
|
|
10 #CAMERA.r
|
|
11 argBlacklist=c(argBlacklist,"dataMatrixOutput","variableMetadataOutput","new_file_path")
|
|
12
|
|
13 # ----- PACKAGE -----
|
|
14
|
|
15 pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "xcms","snow","batch")
|
|
16 for(pkg in pkgs) {
|
|
17 suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
|
|
18 }
|
|
19
|
|
20
|
|
21 # ----- FUNCTION -----
|
|
22 writehtml = function(...) { cat(...,"\n", file=htmlOutput,append = TRUE,sep="") }
|
|
23
|
|
24
|
|
25 # ----- ARGUMENTS -----
|
|
26
|
|
27 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
|
|
28
|
|
29
|
|
30 # ----- ARGUMENTS PROCESSING -----
|
|
31
|
|
32 #image is an .RData file necessary to use xset variable given by previous tools
|
|
33 load(listArguments[["image"]]);
|
|
34
|
|
35 htmlOutput = "report.html"
|
|
36 if (!is.null(listArguments[["htmlOutput"]])){
|
|
37 htmlOutput = listArguments[["htmlOutput"]];
|
|
38 }
|
|
39
|
|
40 user_email = NULL
|
|
41 if (!is.null(listArguments[["user_email"]])){
|
|
42 user_email = listArguments[["user_email"]];
|
|
43 }
|
|
44
|
|
45
|
|
46 # ----- MAIN PROCESSING INFO -----
|
|
47 writehtml("<!DOCTYPE html>")
|
|
48 writehtml("<HTML lang='en'>")
|
|
49
|
|
50 writehtml("<HEAD>")
|
|
51 writehtml("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />")
|
|
52
|
|
53 writehtml("<title>[W4M] XCMS analysis report</title>")
|
|
54
|
|
55 writehtml("<style>")
|
|
56 writehtml("table { min-width: 500px; border:1px solid #D6B161; border-collapse:collapse;}")
|
|
57 writehtml("th { background: #898989; text-align:left;}")
|
|
58 writehtml("tr { border: 1px solid #000000 }")
|
|
59 writehtml("h2 { color: #FFA212; }")
|
|
60 writehtml("ul li { margin-bottom:10px; }")
|
|
61 writehtml("</style>")
|
|
62 writehtml("</HEAD>")
|
|
63
|
|
64 writehtml("<BODY>")
|
|
65 writehtml("<h1>___ XCMS analysis report using Workflow4Metabolomics ___</h1>")
|
|
66 # to pass the planemo shed_test
|
|
67 if (user_email != "test@bx.psu.edu") {
|
|
68 if (!is.null(user_email)) writehtml("By: ",user_email," - ")
|
|
69 writehtml("Date: ",format(Sys.time(), "%y%m%d-%H:%M:%S"))
|
|
70 }
|
|
71
|
|
72
|
|
73 writehtml("<h2>Samples used:</h2>")
|
|
74 writehtml("<table")
|
|
75 writehtml("<tr><th>sample</th><th>filename</th></tr>")
|
|
76 writehtml(paste("<tr><td>",sampnames(xset),"</td><td>",xset@filepaths,"</td></tr>"))
|
|
77 writehtml("</table>")
|
|
78
|
|
79 writehtml("<h2>Function launched:</h2>")
|
|
80 writehtml("<table>")
|
|
81 writehtml("<tr><th>timestamp<br />(ymd-h:m:s)</th><th>function</th><th>argument</th><th>value</th></tr>")
|
|
82 for(tool in names(listOFlistArguments)) {
|
|
83 listOFlistArgumentsDisplay=listOFlistArguments[[tool]][!(names(listOFlistArguments[[tool]]) %in% argBlacklist)]
|
|
84
|
|
85 timestamp = strsplit(tool,"_")[[1]][1]
|
|
86 xcmsFunction = strsplit(tool,"_")[[1]][2]
|
|
87 writehtml("<tr><td rowspan='",length(listOFlistArgumentsDisplay),"'>",timestamp,"</td><td rowspan='",length(listOFlistArgumentsDisplay),"'>",xcmsFunction,"</td>")
|
|
88 line_begin=""
|
|
89 for (arg in names(listOFlistArgumentsDisplay)) {
|
|
90 writehtml(line_begin,"<td>",arg,"</td><td>",unlist(listOFlistArgumentsDisplay[arg][1]),"</td></tr>")
|
|
91 line_begin="<tr>"
|
|
92 }
|
|
93 }
|
|
94 writehtml("</table>")
|
|
95
|
|
96 writehtml("<h2>Information about the xcmsSet object:</h2>")
|
|
97
|
|
98 log_file=file(htmlOutput, open = "at")
|
|
99 writehtml("<pre>")
|
|
100 sink(log_file)
|
|
101 sink(log_file, type = "output")
|
|
102 xset
|
|
103 sink()
|
|
104 writehtml("</pre>")
|
|
105
|
|
106 writehtml("<h2>Citations:</h2>")
|
|
107 writehtml("<ul>")
|
|
108 writehtml("<li>To cite the <b>XCMS</b> package in publications use:")
|
|
109 writehtml("<ul>")
|
|
110 writehtml("<li>","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)","</li>")
|
|
111 writehtml("<li>","Ralf Tautenhahn, Christoph Boettcher, Steffen Neumann: Highly sensitive feature detection for high resolution LC/MS BMC Bioinformatics, 9:504 (2008)","</li>")
|
|
112 writehtml("<li>","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)","</li>")
|
|
113 writehtml("</ul>")
|
|
114 writehtml("</li>")
|
|
115
|
|
116 writehtml("<li>To cite the <b>CAMERA</b> package in publications use:")
|
|
117 writehtml("<ul>")
|
|
118 writehtml("<li>","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)","</li>")
|
|
119 writehtml("</ul>")
|
|
120 writehtml("</li>")
|
|
121
|
|
122 writehtml("<li>To cite the <b>Workflow4Metabolimics (W4M)</b> project in publications use:")
|
|
123 writehtml("<ul>")
|
|
124 writehtml("<li>","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","</li>")
|
|
125 writehtml("</ul>")
|
|
126 writehtml("</li>")
|
|
127 writehtml("</ul>")
|
|
128
|
|
129 writehtml("</BODY>")
|
|
130
|
|
131 writehtml("</HTML>")
|
|
132
|