annotate metaMS_runGC.r @ 5:b8d4129dd2a6 draft

planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
author yguitton
date Fri, 06 Sep 2019 06:09:10 -0400
parents c10824185547
children 286ebb9f6e84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
1 #!/usr/bin/env Rscript
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
2 # metaMS_runGC.r version="3.0.0"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
3 #created by Yann GUITTON and updated by Julien SAINT-VANNE
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
4 #use RI options + add try on plotUnknown add session Info
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
5 #use make.names in sampleMetadata to avoid issues with files names
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
6
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
7
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
8 # ----- LOG FILE -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
9 #log_file=file("log.txt", open = "wt")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
10 #sink(log_file)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
11 #sink(log_file, type = "output")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
12
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
13
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
14 # ----- PACKAGE -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
15 cat("\tSESSION INFO\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
16
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
17 #Import the different functions and packages
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
18 source_local <- function(fname) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
19 argv <- commandArgs(trailingOnly = FALSE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
20 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
21 source(paste(base_dir, fname, sep="/"))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
22 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
23 source_local("lib_metams.r")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
24
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
25 pkgs <- c("metaMS","stringr","batch","CAMERA") #"batch" necessary for parseCommandArgs function
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
26 loadAndDisplayPackages(pkgs)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
27
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
28 cat("\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
29
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
30 modNamC <- "metaMS:runGC" ## module name
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
31 cat("\nStart of the '", modNamC, "' Galaxy module call: ", format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
32
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
33
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
34 # ----- PROCESSING INFILE -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
35 cat("\n\n\tARGUMENTS PROCESSING INFO\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
36 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
37 #write.table(as.matrix(args), col.names=F, quote=F, sep='\t\t')
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
38 print(cbind(value = unlist(args)))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
39
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
40 # ----- PROCESSING INFILE -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
41 cat("\n\n\tARGUMENTS PROCESSING INFO\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
42
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
43 # Saving the specific parameters
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
44 #RI parameter
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
45 if (args$ri!="NULL"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
46 RIarg=read.table(args$ri)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
47 if (ncol(RIarg) < 2) RIarg=read.table(args$ri, h=T, sep=";")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
48 if (ncol(RIarg) < 2) RIarg=read.table(args$ri, h=T, sep="\t")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
49 if (ncol(RIarg) < 2) RIarg=read.table(args$ri, h=T, sep=",")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
50 if (ncol(RIarg) < 2) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
51 error_message="Your RI file seems not well formatted. The column separators accepted are ; , and tabulation"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
52 print(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
53 stop(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
54 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
55 #to do check real column names
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
56 colnames(RIarg)<-c("rt","RI")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
57 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
58 RIarg = NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
59 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
60
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
61 #RIshift parameter
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
62 if (args$rishift!="none"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
63 RIshift=args$rishift
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
64 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
65 RIshift = "none"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
66 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
67
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
68 #Personal database parameter
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
69 if (args$db!="NULL"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
70 DBgc=args$db
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
71 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
72 DBgc = NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
73 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
74
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
75 #settings process
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
76 if (args$settings=="default") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
77 cat("Using default parameters")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
78 data(FEMsettings)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
79 if (args$rtrange[1]!="NULL") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
80 rtrange=args$rtrange
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
81 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
82 rtrange=NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
83 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
84
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
85 if (!is.null(DBgc)){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
86 manual <- read.msp(DBgc)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
87 DBgc <- createSTDdbGC(stdInfo = NULL, settings = TSQXLS.GC, manualDB = manual)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
88 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
89
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
90 #use RI instead of rt for time comparison vs DB
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
91 if (RIshift!="none"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
92 TSQXLS.GC@match2DB.timeComparison<-"RI"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
93 TSQXLS.GC@match2DB.RIdiff<-as.numeric(RIshift)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
94 TSQXLS.GC@betweenSamples.timeComparison<-"RI"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
95 TSQXLS.GC@betweenSamples.RIdiff<-as.numeric(RIshift)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
96 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
97 nSlaves=args$nSlaves
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
98 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
99
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
100 if (args$settings=="User_defined") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
101 cat("Using user's parameters\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
102 fwhmparam=args$fwhm
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
103 rtdiffparam=args$rtdiff
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
104 minfeatparam=args$minfeat
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
105 simthreshparam=args$simthreshold
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
106 minclassfractionparam=args$minclassfraction
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
107 minclasssizeparam=args$minclasssize
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
108
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
109 if (args$rtrange!="NULL") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
110 rtrange=args$rtrange
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
111 cat("rtrange= ",rtrange)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
112 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
113 rtrange=NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
114 cat("rtrange= ",rtrange)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
115 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
116
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
117 nSlaves=args$nSlaves
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
118
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
119 GALAXY.GC <-
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
120 metaMSsettings("protocolName" = "GALAXY.GC",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
121 "chrom" = "GC",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
122 PeakPicking = list(
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
123 method = "matchedFilter",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
124 step = 0.5,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
125 steps = 2,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
126 mzdiff = .5,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
127 fwhm = fwhmparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
128 snthresh = 2,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
129 max = 500),
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
130 CAMERA = list(perfwhm = 1))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
131
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
132 metaSetting(GALAXY.GC, "DBconstruction") <- list(
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
133 minintens = 0.0,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
134 rttol = rtdiffparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
135 intensityMeasure = "maxo",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
136 DBthreshold = .80,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
137 minfeat = minfeatparam)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
138 metaSetting(GALAXY.GC, "match2DB") <- list(
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
139 simthresh = simthreshparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
140 timeComparison = "rt",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
141 rtdiff = rtdiffparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
142 RIdiff = 5,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
143 minfeat = minfeatparam)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
144
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
145 #to used if contaminant filter
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
146
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
147 # metaSetting(GALAXY.GC, "matchIrrelevants") <- list(
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
148 # irrelevantClasses = c("Bleeding", "Plasticizers"),
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
149 # timeComparison = "RI",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
150 # RIdiff = RIdiffparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
151 # rtdiff = rtdiffparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
152 # simthresh = simthreshparam)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
153
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
154 metaSetting(GALAXY.GC, "betweenSamples") <- list(
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
155 min.class.fraction = minclassfractionparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
156 min.class.size = minclasssizeparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
157 timeComparison = "rt",
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
158 rtdiff = rtdiffparam,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
159 RIdiff = 2,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
160 simthresh = simthreshparam)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
161
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
162 #ONLY use RI instead of rt for time comparison vs DB or samples
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
163 if (RIshift!="none"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
164 GALAXY.GC@match2DB.timeComparison<-"RI"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
165 GALAXY.GC@match2DB.RIdiff<-as.numeric(RIshift)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
166 GALAXY.GC@betweenSamples.timeComparison<-"RI"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
167 GALAXY.GC@betweenSamples.RIdiff<-as.numeric(RIshift)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
168 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
169
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
170 if (!is.null(DBgc)){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
171 manual <- read.msp(DBgc)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
172 DBgc <- createSTDdbGC(stdInfo = NULL, settings = GALAXY.GC, manualDB = manual)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
173 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
174 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
175
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
176
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
177 # ----- INFILE PROCESSING -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
178 cat("\n\n\n\tINFILE PROCESSING INFO\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
179
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
180 # Handle infiles
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
181 if (!exists("singlefile")) singlefile <- NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
182 if (!exists("zipfile")) zipfile <- NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
183 rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
184 zipfile <- rawFilePath$zipfile
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
185 singlefile <- rawFilePath$singlefile
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
186 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
187
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
188
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
189 # ----- MAIN PROCESSING INFO -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
190 cat("\n\tMAIN PROCESSING INFO\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
191
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
192 cat("\t\tCOMPUTE\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
193
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
194 #runGC accept either a list of files a zip folder or an xset object from xcms.xcmsSet tool
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
195 #From xset is an .RData file necessary to use the xcmsSet object generated by xcms.xcmsSet given by previous tools
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
196 if (!is.null(args$singlefile_galaxyPath)){
5
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
197 cat("Loading datas from XCMS files...\n")
4
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
198 load(args$singlefile_galaxyPath)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
199
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
200 #Transform XCMS object if needed
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
201 if(!exists("xset")) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
202 if(exists("xdata")) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
203 xset<-getxcmsSetObject(xdata)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
204 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
205 error_message="no xset and no xdata... Probably a problem"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
206 print(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
207 stop(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
208 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
209 }
5
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
210 #Verify that there are more than 1 file (can't run metaMS on only 1 file)
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
211 if(length(rownames(xdata@phenoData)) < 2){
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
212 error_message="You need more than 1 file to be able to run metaMS"
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
213 print(error_message)
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
214 stop(error_message)
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
215 }
4
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
216
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
217 #xset from xcms.xcmsSet is not well formatted for metaMS this function do the formatting
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
218 if (class(xset)=="xcmsSet"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
219 if (length(xset@rt$raw)>1){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
220 #create an exceptable list of xset for metaMS
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
221 xset.l<-vector("list",length(xset@rt$raw))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
222 for (i in 1:length(xset@rt$raw)){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
223 xset.l[[i]]<-new("xcmsSet")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
224 xset.l[[i]]@peaks<-xset@peaks[which(xset@peaks[,"sample"]==i),]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
225 df<-data.frame(class=xset@phenoData[i,])
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
226 rownames(df)<-rownames(xset@phenoData)[i]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
227 xset.l[[i]]@phenoData<-df
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
228 xset.l[[i]]@rt$raw<-xset@rt$raw[[i]]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
229 xset.l[[i]]@rt$corrected<-xset@rt$corrected[[i]]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
230 xset.l[[i]]@filepaths<-xset@filepaths[i]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
231 xset.l[[i]]@profinfo<-xset@profinfo
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
232 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
233 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
234 xset.l<-xset
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
235 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
236
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
237 #create sampleMetadata, get sampleMetadata and class
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
238 sampleMetadata<-xset@phenoData
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
239 colnames(sampleMetadata) <- c("sampleMetadata","sample_group","class")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
240 sampleMetadata<-sampleMetadata[,-2]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
241 row.names(sampleMetadata)<-NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
242 samples<-xset@filepaths
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
243 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
244 xset<-NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
245 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
246 if(args$settings == "default") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
247 settingslist=TSQXLS.GC
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
248 if (class(xset.l[[1]])!="xsAnnotate"){
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
249 cat("Process xsAnnotate with CAMERA package...\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
250 xsetCAM<-lapply(xset.l,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
251 function(x) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
252 y <- xsAnnotate(x, sample = 1)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
253 capture.output(z <- groupFWHM(y, perfwhm = settingslist@CAMERA$perfwhm),
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
254 file = NULL)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
255 z})
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
256 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
257 xsetCAM <- xset.l
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
258 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
259
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
260 #default settings for GC from Wehrens et al
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
261 cat("Process runGC with metaMS package...\n\n")
5
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
262 print(str(TSQXLS.GC))
4
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
263 resGC<-runGC(xset=xsetCAM,settings=TSQXLS.GC, rtrange=rtrange, DB= DBgc, removeArtefacts = TRUE,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
264 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
265 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
266 if(args$settings == "User_defined") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
267 settingslist=GALAXY.GC
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
268 if (class(xset.l[[1]])!="xsAnnotate") {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
269 cat("Process xsAnnotate with CAMERA package...\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
270 xsetCAM<-lapply(xset.l,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
271 function(x) {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
272 y <- xsAnnotate(x, sample = 1)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
273 capture.output(z <- groupFWHM(y, perfwhm = settingslist@CAMERA$perfwhm),
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
274 file = NULL)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
275 z})
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
276 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
277 xsetCAM <- xset.l
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
278 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
279
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
280 #user settings for GC
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
281 cat("Process runGC with metaMS package...\n\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
282 print(str(GALAXY.GC))
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
283 resGC<-runGC(xset=xsetCAM,settings=GALAXY.GC,rtrange = rtrange, DB= DBgc, removeArtefacts = TRUE,
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
284 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
285 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
286 error_message <- "There is no xset"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
287 print(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
288 stop(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
289 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
290 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
291 } else {
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
292 error_message <- "No galaxy path entered"
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
293 print(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
294 stop(error_message)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
295 }
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
296
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
297
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
298 # ----- EXPORT -----
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
299 #peakTable ordered by rt
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
300 cat("\nGenerating peakTable file")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
301 peaktable<-getCorrectFileName(resGC$PeakTable,sampleMetadata)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
302 cat("\t.\t.")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
303 write.table(peaktable, file="peaktable.tsv", sep="\t", row.names=FALSE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
304 cat("\t.\tOK")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
305
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
306 #peakTable for PCA
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
307 #dataMatrix
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
308 cat("\nGenerating dataMatrix file")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
309 dataMatrix<-cbind(Name=peaktable[,"Name"],peaktable[,(colnames(peaktable) %in% sampleMetadata[,1])])
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
310 rownames(dataMatrix)<-NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
311 cat("\t.\t.")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
312 write.table(dataMatrix, file="dataMatrix.tsv", sep="\t", row.names=FALSE, quote=FALSE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
313 cat("\t.\tOK")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
314
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
315 #variableMetadata
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
316 cat("\nGenerating variableMetadata file")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
317 variableMetadata<-peaktable[,!(colnames(peaktable) %in% sampleMetadata[,1])]
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
318 rownames(variableMetadata)<-NULL
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
319 cat("\t.")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
320 write.table(variableMetadata, file="variableMetadata.tsv", sep="\t", row.names=FALSE, quote=FALSE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
321 cat("\t.\tOK")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
322
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
323 #sampleMetadata
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
324 cat("\nGenerating sampleMetadata file")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
325 cat("\t.\t.")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
326 write.table(sampleMetadata, file="sampleMetadata.tsv", sep="\t", row.names=FALSE, quote=FALSE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
327 cat("\t.\tOK")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
328
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
329 #peak spectrum as MSP for DB search
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
330 cat("\nGenerating",length(resGC$PseudoSpectra),"peakspectra in peakspectra.msp file\n")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
331 write.msp(resGC$PseudoSpectra, file="peakspectra.msp", newFile = TRUE)
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
332
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
333 #saving R data in .Rdata file to save the variables used in the present tool
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
334 objects2save <- c("resGC", "xset", "singlefile", "zipfile", "DBgc")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
335 save(list = objects2save[objects2save %in% ls()], file = "runGC.RData")
c10824185547 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff changeset
336
5
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
337 cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "")
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
338
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
339 #WARNING if user has CDF files (not yet good for plotting)
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
340 files <- paste("./",names(singlefile),sep="")
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
341 if(MSnbase:::isCdfFile(files)){
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
342 warning_message <- "You have CDF files, for the moment you can't obtain plot after runGC! A new update will follow with the good correction"
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
343 warning(warning_message)
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
344 cat(paste("\n","/!\\Warning/!\\",warning_message,sep="\n"))
b8d4129dd2a6 planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
yguitton
parents: 4
diff changeset
345 }