annotate xcms_summary.r @ 27:bed23aa27b4b draft

"planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
author workflow4metabolomics
date Thu, 24 Sep 2020 08:09:02 +0000
parents db6549f27ad1
children 018a9771de28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
ca7c9a6da2c6 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 83b80dcd96b379518c2e4ace992affc889d32ca6
lecorguille
parents: 4
diff changeset
1 #!/usr/bin/env Rscript
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
2
930478b22633 planemo upload
lecorguille
parents:
diff changeset
3
930478b22633 planemo upload
lecorguille
parents:
diff changeset
4
930478b22633 planemo upload
lecorguille
parents:
diff changeset
5 # ----- ARGUMENTS BLACKLIST -----
930478b22633 planemo upload
lecorguille
parents:
diff changeset
6 #xcms.r
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
7 argBlacklist <- c("zipfile", "singlefile_galaxyPath", "singlefile_sampleName", "xfunction", "xsetRdataOutput", "sampleMetadataOutput", "ticspdf", "bicspdf", "rplotspdf")
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
8 #CAMERA.r
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
9 argBlacklist <- c(argBlacklist, "dataMatrixOutput", "variableMetadataOutput", "new_file_path")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
10
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
11
930478b22633 planemo upload
lecorguille
parents:
diff changeset
12 # ----- PACKAGE -----
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
13 cat("\tSESSION INFO\n")
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
14
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
15 #Import the different functions
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
16 source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
17 source_local("lib.r")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
18
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
19 pkgs <- c("CAMERA","batch")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
20 loadAndDisplayPackages(pkgs)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
21 cat("\n\n");
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
22
930478b22633 planemo upload
lecorguille
parents:
diff changeset
23
930478b22633 planemo upload
lecorguille
parents:
diff changeset
24 # ----- FUNCTION -----
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
25 writehtml <- function(...) { cat(...,"\n", file=htmlOutput,append = TRUE,sep="") }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
26 writeraw <- function(htmlOutput, object, open="at") {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
27 log_file <- file(htmlOutput, open = open)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
28 sink(log_file)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
29 sink(log_file, type = "output")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
30 print(object)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
31 sink()
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
32 close(log_file)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
33 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
34 getSampleNames <- function(xobject) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
35 if (class(xobject) == "xcmsSet")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
36 return (sampnames(xobject))
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
37 if (class(xobject) == "XCMSnExp")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
38 return (xobject@phenoData@data$sample_name)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
39 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
40 getFilePaths <- function(xobject) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
41 if (class(xobject) == "xcmsSet")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
42 return (xobject@filepaths)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
43 if (class(xobject) == "XCMSnExp")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
44 return (fileNames(xobject))
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
45 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
46 equalParams <- function(param1, param2) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
47 writeraw("param1.txt", param1, open="wt")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
48 writeraw("param2.txt", param2, open="wt")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
49 return(tools::md5sum("param1.txt") == tools::md5sum("param2.txt"))
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
50 }
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
51
930478b22633 planemo upload
lecorguille
parents:
diff changeset
52
930478b22633 planemo upload
lecorguille
parents:
diff changeset
53 # ----- ARGUMENTS -----
930478b22633 planemo upload
lecorguille
parents:
diff changeset
54
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
55 args <- parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
56
930478b22633 planemo upload
lecorguille
parents:
diff changeset
57
930478b22633 planemo upload
lecorguille
parents:
diff changeset
58 # ----- ARGUMENTS PROCESSING -----
930478b22633 planemo upload
lecorguille
parents:
diff changeset
59
930478b22633 planemo upload
lecorguille
parents:
diff changeset
60 #image is an .RData file necessary to use xset variable given by previous tools
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
61 load(args$image);
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
62
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
63 htmlOutput <- "summary.html"
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
64 if (!is.null(args$htmlOutput)) htmlOutput = args$htmlOutput;
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
65
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
66 user_email <- NULL
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
67 if (!is.null(args$user_email)) user_email = args$user_email;
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
68
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
69 # if the RData come from XCMS 1.x
26
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
70 if (exists("xset")) {
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
71 xobject <- xset
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
72 # retrocompatability
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
73 if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(sampnames(xobject)))
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
74 }
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
75 # if the RData come from CAMERA
27
bed23aa27b4b "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
workflow4metabolomics
parents: 26
diff changeset
76 if (exists("xa")) {
bed23aa27b4b "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
workflow4metabolomics
parents: 26
diff changeset
77 xobject <- xa@xcmsSet
bed23aa27b4b "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
workflow4metabolomics
parents: 26
diff changeset
78 if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(xa@xcmsSet@phenoData$sample_name))
bed23aa27b4b "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 50478425b4773ebcb393c0e31f1e622b7406dcbb"
workflow4metabolomics
parents: 26
diff changeset
79 }
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
80 # if the RData come from XCMS 3.x
26
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
81 if (exists("xdata")) {
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
82 xobject <- xdata
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
83 if (!exists("sampleNamesList")) sampleNamesList <- list("sampleNamesMakeNames"=make.names(xdata@phenoData@data$sample_name))
db6549f27ad1 "planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 7234c5fb8350990733e882693248c0433eee5ff8"
workflow4metabolomics
parents: 20
diff changeset
84 }
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
85
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
86 if (!exists("xobject")) stop("You need at least a xdata, a xset or a xa object.")
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
87
930478b22633 planemo upload
lecorguille
parents:
diff changeset
88
930478b22633 planemo upload
lecorguille
parents:
diff changeset
89 # ----- MAIN PROCESSING INFO -----
930478b22633 planemo upload
lecorguille
parents:
diff changeset
90 writehtml("<!DOCTYPE html>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
91 writehtml("<HTML lang='en'>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
92
930478b22633 planemo upload
lecorguille
parents:
diff changeset
93 writehtml("<HEAD>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
94 writehtml("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
95
930478b22633 planemo upload
lecorguille
parents:
diff changeset
96 writehtml("<title>[W4M] XCMS analysis summary</title>")
12
27e7da5f6848 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents: 7
diff changeset
97
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
98 writehtml("<style>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
99 writehtml("table, tr, td, th { border: 1px solid #000000; border-collapse:collapse; }")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
100 writehtml("td,th { padding: 5px; padding-right: 12px; }")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
101 writehtml("th { background: #898989; text-align:left;color: white;}")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
102 writehtml("h2 { color: #FFA212; }")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
103 writehtml("ul li { margin-bottom:10px; }")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
104 writehtml("</style>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
105 writehtml("</HEAD>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
106
930478b22633 planemo upload
lecorguille
parents:
diff changeset
107 writehtml("<BODY>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
108 writehtml("<div><h1>___ XCMS analysis summary using Workflow4Metabolomics ___</h1>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
109 # to pass the planemo shed_test
930478b22633 planemo upload
lecorguille
parents:
diff changeset
110 if (user_email != "test@bx.psu.edu") {
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
111 if (!is.null(user_email)) writehtml("By: ", user_email," - ")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
112 writehtml("Date: ", format(Sys.time(), "%y%m%d-%H:%M:%S"))
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
113 }
930478b22633 planemo upload
lecorguille
parents:
diff changeset
114 writehtml("</div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
115
930478b22633 planemo upload
lecorguille
parents:
diff changeset
116 writehtml("<h2>Samples used:</h2>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
117 writehtml("<div><table>")
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
118 if (all(getSampleNames(xobject) == sampleNamesList$sampleNamesMakeNames)) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
119 sampleNameHeaderHtml <- paste0("<th>sample</th>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
120 sampleNameHtml <- paste0("<td>",getSampleNames(xobject),"</td>")
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
121 } else {
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
122 sampleNameHeaderHtml <- paste0("<th>sample</th><th>sample renamed</th>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
123 sampleNameHtml <- paste0("<td>",getSampleNames(xobject),"</td><td>",sampleNamesList$sampleNamesMakeNames,"</td>")
12
27e7da5f6848 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents: 7
diff changeset
124 }
27e7da5f6848 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents: 7
diff changeset
125
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
126 if (!exists("md5sumList")) {
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
127 md5sumHeaderHtml <- ""
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
128 md5sumHtml <- ""
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
129 md5sumLegend <- ""
2
234df22cd722 planemo upload
lecorguille
parents: 1
diff changeset
130 } else if (is.null(md5sumList$removalBadCharacters)) {
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
131 md5sumHeaderHtml <- paste0("<th>md5sum<sup>*</sup></th>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
132 md5sumHtml <- paste0("<td>",md5sumList$origin,"</td>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
133 md5sumLegend <- "<br/><sup>*</sup>The program md5sum is designed to verify data integrity. So you can check if the data were uploaded correctly or if the data were changed during the process."
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
134 } else {
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
135 md5sumHeaderHtml <- paste0("<th>md5sum<sup>*</sup></th><th>md5sum<sup>**</sup> after bad characters removal</th>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
136 md5sumHtml <- paste0("<td>",md5sumList$origin,"</td><td>",md5sumList$removalBadCharacters,"</td>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
137 md5sumLegend <- "<br/><sup>*</sup>The program md5sum is designed to verify data integrity. So you can check if the data were uploaded correctly or if the data were changed during the process.<br/><sup>**</sup>Because some bad characters (eg: accent) were removed from your original file, the checksum have changed too.<br/>"
13
a5347d57899f planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4897a06ef248e2e74e57a496dd68adbda3c828f1
lecorguille
parents: 12
diff changeset
138 }
a5347d57899f planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 4897a06ef248e2e74e57a496dd68adbda3c828f1
lecorguille
parents: 12
diff changeset
139
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
140 writehtml("<tr>",sampleNameHeaderHtml,"<th>filename</th>",md5sumHeaderHtml,"</tr>")
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
141 writehtml(paste0("<tr>",sampleNameHtml,"<td>",getFilePaths(xobject),"</td>",md5sumHtml,"</tr>"))
12
27e7da5f6848 planemo upload for repository https://github.com/workflow4metabolomics/xcms commit a6f5f18b3d6130f7d7fbb9f2df856838c6217797
lecorguille
parents: 7
diff changeset
142
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
143 writehtml("</table>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
144 writehtml(md5sumLegend)
930478b22633 planemo upload
lecorguille
parents:
diff changeset
145 writehtml("</div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
146
930478b22633 planemo upload
lecorguille
parents:
diff changeset
147 writehtml("<h2>Function launched:</h2>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
148 writehtml("<div><table>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
149 writehtml("<tr><th>timestamp<sup>***</sup></th><th>function</th><th>argument</th><th>value</th></tr>")
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
150 # XCMS 3.x
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
151 if (class(xobject) == "XCMSnExp") {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
152 xcmsFunction <- NULL
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
153 params <- NULL
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
154 for (processHistoryItem in processHistory(xobject)) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
155 if ((xcmsFunction == processType(processHistoryItem)) && equalParams(params, processParam(processHistoryItem)))
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
156 next
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
157 timestamp <- processDate(processHistoryItem)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
158 xcmsFunction <- processType(processHistoryItem)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
159 params <- processParam(processHistoryItem)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
160 writehtml("<tr><td>",timestamp,"</td><td>",xcmsFunction,"</td><td colspan='2'><pre>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
161 writeraw(htmlOutput, params)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
162 writehtml("</pre></td></tr>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
163 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
164 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
165 # CAMERA and retrocompatability XCMS 1.x
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
166 if (exists("listOFlistArguments")) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
167 for(tool in names(listOFlistArguments)) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
168 listOFlistArgumentsDisplay <- listOFlistArguments[[tool]][!(names(listOFlistArguments[[tool]]) %in% argBlacklist)]
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
169
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
170 timestamp <- strsplit(tool,"_")[[1]][1]
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
171 xcmsFunction <- strsplit(tool,"_")[[1]][2]
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
172 writehtml("<tr><td rowspan='",length(listOFlistArgumentsDisplay),"'>",timestamp,"</td><td rowspan='",length(listOFlistArgumentsDisplay),"'>",xcmsFunction,"</td>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
173 line_begin <- ""
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
174 for (arg in names(listOFlistArgumentsDisplay)) {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
175 writehtml(line_begin,"<td>",arg,"</td><td>",unlist(listOFlistArgumentsDisplay[arg][1]),"</td></tr>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
176 line_begin <- "<tr>"
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
177 }
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
178 }
930478b22633 planemo upload
lecorguille
parents:
diff changeset
179 }
930478b22633 planemo upload
lecorguille
parents:
diff changeset
180 writehtml("</table>")
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
181 writehtml("<br/><sup>***</sup>timestamp format: DD MM dd hh:mm:ss YYYY or yymmdd-hh:mm:ss")
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
182 writehtml("</div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
183
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
184 if (class(xobject) == "XCMSnExp") {
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
185 writehtml("<h2>Informations about the XCMSnExp object:</h2>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
186
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
187 writehtml("<div><pre>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
188 writeraw(htmlOutput, xobject)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
189 writehtml("</pre></div>")
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
190 }
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
191
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
192 writehtml("<h2>Informations about the xcmsSet object:</h2>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
193
930478b22633 planemo upload
lecorguille
parents:
diff changeset
194 writehtml("<div><pre>")
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
195 # Get the legacy xcmsSet object
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
196 xset <- getxcmsSetObject(xobject)
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
197 writeraw(htmlOutput, xset)
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
198 writehtml("</pre></div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
199
15
97ca0321931b planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 9f72e947d9c241d11221cad561f3525d27231857
lecorguille
parents: 13
diff changeset
200 # CAMERA
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
201 if (exists("xa")) {
930478b22633 planemo upload
lecorguille
parents:
diff changeset
202 writehtml("<h2>Informations about the CAMERA object:</h2>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
203
930478b22633 planemo upload
lecorguille
parents:
diff changeset
204 writehtml("<div>")
3
f5d7654148bd planemo upload
lecorguille
parents: 2
diff changeset
205 writehtml("Number of pcgroup: ",length(xa@pspectra))
0
930478b22633 planemo upload
lecorguille
parents:
diff changeset
206 writehtml("</div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
207 }
930478b22633 planemo upload
lecorguille
parents:
diff changeset
208
930478b22633 planemo upload
lecorguille
parents:
diff changeset
209 writehtml("<h2>Citations:</h2>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
210 writehtml("<div><ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
211 writehtml("<li>To cite the <b>XCMS</b> package in publications use:")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
212 writehtml("<ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
213 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>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
214 writehtml("<li>","Ralf Tautenhahn, Christoph Boettcher, Steffen Neumann: Highly sensitive feature detection for high resolution LC/MS BMC Bioinformatics, 9:504 (2008)","</li>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
215 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>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
216 writehtml("</ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
217 writehtml("</li>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
218
930478b22633 planemo upload
lecorguille
parents:
diff changeset
219 writehtml("<li>To cite the <b>CAMERA</b> package in publications use:")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
220 writehtml("<ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
221 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>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
222 writehtml("</ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
223 writehtml("</li>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
224
930478b22633 planemo upload
lecorguille
parents:
diff changeset
225 writehtml("<li>To cite the <b>Workflow4Metabolimics (W4M)</b> project in publications use:")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
226 writehtml("<ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
227 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>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
228 writehtml("</ul>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
229 writehtml("</li>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
230 writehtml("</ul></div>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
231
930478b22633 planemo upload
lecorguille
parents:
diff changeset
232 writehtml("</BODY>")
930478b22633 planemo upload
lecorguille
parents:
diff changeset
233
930478b22633 planemo upload
lecorguille
parents:
diff changeset
234 writehtml("</HTML>")