Mercurial > repos > yguitton > metams_rungc
annotate metaMS_runGC.r @ 7:89af36e05548 draft
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
author | workflow4metabolomics |
---|---|
date | Thu, 07 May 2020 06:24:39 -0400 |
parents | 286ebb9f6e84 |
children | d1ce2634135f |
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 } |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
23 source_local("lib_metams.r") |
4
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 |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
33 |
4
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 rtdiffparam=args$rtdiff |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
103 minfeatparam=args$minfeat |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
104 simthreshparam=args$simthreshold |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
105 minclassfractionparam=args$minclassfraction |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
106 minclasssizeparam=args$minclasssize |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
107 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
108 if (args$rtrange!="NULL") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
109 rtrange=args$rtrange |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
110 cat("rtrange= ",rtrange) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
111 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
112 rtrange=NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
113 cat("rtrange= ",rtrange) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
114 } |
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 nSlaves=args$nSlaves |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
117 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
118 GALAXY.GC <- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
119 metaMSsettings("protocolName" = "GALAXY.GC", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
120 "chrom" = "GC", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
121 PeakPicking = list( |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
122 method = "matchedFilter", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
123 step = 0.5, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
124 steps = 2, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
125 mzdiff = .5, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
126 fwhm = fwhmparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
127 snthresh = 2, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
128 max = 500), |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
129 CAMERA = list(perfwhm = 1)) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
130 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
131 metaSetting(GALAXY.GC, "DBconstruction") <- list( |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
132 minintens = 0.0, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
133 rttol = rtdiffparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
134 intensityMeasure = "maxo", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
135 DBthreshold = .80, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
136 minfeat = minfeatparam) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
137 metaSetting(GALAXY.GC, "match2DB") <- list( |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
138 simthresh = simthreshparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
139 timeComparison = "rt", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
140 rtdiff = rtdiffparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
141 RIdiff = 5, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
142 minfeat = minfeatparam) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
143 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
144 #to used if contaminant filter |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
145 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
146 # metaSetting(GALAXY.GC, "matchIrrelevants") <- list( |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
147 # irrelevantClasses = c("Bleeding", "Plasticizers"), |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
148 # timeComparison = "RI", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
149 # RIdiff = RIdiffparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
150 # rtdiff = rtdiffparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
151 # simthresh = simthreshparam) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
152 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
153 metaSetting(GALAXY.GC, "betweenSamples") <- list( |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
154 min.class.fraction = minclassfractionparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
155 min.class.size = minclasssizeparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
156 timeComparison = "rt", |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
157 rtdiff = rtdiffparam, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
158 RIdiff = 2, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
159 simthresh = simthreshparam) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
160 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
161 #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
|
162 if (RIshift!="none"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
163 GALAXY.GC@match2DB.timeComparison<-"RI" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
164 GALAXY.GC@match2DB.RIdiff<-as.numeric(RIshift) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
165 GALAXY.GC@betweenSamples.timeComparison<-"RI" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
166 GALAXY.GC@betweenSamples.RIdiff<-as.numeric(RIshift) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
167 } |
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 if (!is.null(DBgc)){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
170 manual <- read.msp(DBgc) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
171 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
|
172 } |
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 # ----- INFILE PROCESSING ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
177 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
|
178 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
179 # Handle infiles |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
180 if (!exists("singlefile")) singlefile <- NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
181 if (!exists("zipfile")) zipfile <- NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
182 rawFilePath <- getRawfilePathFromArguments(singlefile, zipfile, args) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
183 zipfile <- rawFilePath$zipfile |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
184 singlefile <- rawFilePath$singlefile |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
185 directory <- retrieveRawfileInTheWorkingDirectory(singlefile, zipfile) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
186 |
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 # ----- MAIN PROCESSING INFO ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
189 cat("\n\tMAIN PROCESSING INFO\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
190 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
191 cat("\t\tCOMPUTE\n\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
192 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
193 #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
|
194 #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
|
195 if (!is.null(args$singlefile_galaxyPath)){ |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
196 cat("Loading datas from XCMS files...\n") |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
197 load(args$singlefile_galaxyPath) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
198 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
199 #Transform XCMS object if needed |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
200 if(!exists("xset")) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
201 if(exists("xdata")) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
202 xset<-getxcmsSetObject(xdata) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
203 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
204 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
|
205 print(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
206 stop(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
207 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
208 } |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
209 #Verify that there are more than 1 file (can't run metaMS on only 1 file) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
210 if(length(rownames(xdata@phenoData)) < 2){ |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
211 error_message="You need more than 1 file to be able to run metaMS" |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
212 print(error_message) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
213 stop(error_message) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
214 } |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
215 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
216 #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
|
217 if (class(xset)=="xcmsSet"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
218 if (length(xset@rt$raw)>1){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
219 #create an exceptable list of xset for metaMS |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
220 xset.l<-vector("list",length(xset@rt$raw)) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
221 for (i in 1:length(xset@rt$raw)){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
222 xset.l[[i]]<-new("xcmsSet") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
223 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
|
224 df<-data.frame(class=xset@phenoData[i,]) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
225 rownames(df)<-rownames(xset@phenoData)[i] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
226 xset.l[[i]]@phenoData<-df |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
227 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
|
228 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
|
229 xset.l[[i]]@filepaths<-xset@filepaths[i] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
230 xset.l[[i]]@profinfo<-xset@profinfo |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
231 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
232 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
233 xset.l<-xset |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
234 } |
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 #create sampleMetadata, get sampleMetadata and class |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
237 sampleMetadata<-xset@phenoData |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
238 colnames(sampleMetadata) <- c("sampleMetadata","sample_group","class") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
239 sampleMetadata<-sampleMetadata[,-2] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
240 row.names(sampleMetadata)<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
241 samples<-xset@filepaths |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
242 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
243 xset<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
244 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
245 if(args$settings == "default") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
246 settingslist=TSQXLS.GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
247 if (class(xset.l[[1]])!="xsAnnotate"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
248 cat("Process xsAnnotate with CAMERA package...\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
249 xsetCAM<-lapply(xset.l, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
250 function(x) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
251 y <- xsAnnotate(x, sample = 1) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
252 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
|
253 file = NULL) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
254 z}) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
255 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
256 xsetCAM <- xset.l |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
257 } |
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 #default settings for GC from Wehrens et al |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
260 cat("Process runGC with metaMS package...\n\n") |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
261 print(str(TSQXLS.GC)) |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
262 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
|
263 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
264 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
265 if(args$settings == "User_defined") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
266 settingslist=GALAXY.GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
267 if (class(xset.l[[1]])!="xsAnnotate") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
268 cat("Process xsAnnotate with CAMERA package...\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
269 xsetCAM<-lapply(xset.l, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
270 function(x) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
271 y <- xsAnnotate(x, sample = 1) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
272 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
|
273 file = NULL) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
274 z}) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
275 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
276 xsetCAM <- xset.l |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
277 } |
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 #user settings for GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
280 cat("Process runGC with metaMS package...\n\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
281 print(str(GALAXY.GC)) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
282 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
|
283 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
284 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
285 error_message <- "There is no xset" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
286 print(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
287 stop(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
288 } |
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 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
291 error_message <- "No galaxy path entered" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
292 print(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
293 stop(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
294 } |
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 # ----- EXPORT ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
298 #peakTable ordered by rt |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
299 cat("\nGenerating peakTable file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
300 peaktable<-getCorrectFileName(resGC$PeakTable,sampleMetadata) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
301 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
302 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
|
303 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
304 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
305 #peakTable for PCA |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
306 #dataMatrix |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
307 cat("\nGenerating dataMatrix file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
308 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
|
309 rownames(dataMatrix)<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
310 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
311 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
|
312 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
313 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
314 #variableMetadata |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
315 cat("\nGenerating variableMetadata file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
316 variableMetadata<-peaktable[,!(colnames(peaktable) %in% sampleMetadata[,1])] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
317 rownames(variableMetadata)<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
318 cat("\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
319 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
|
320 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
321 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
322 #sampleMetadata |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
323 cat("\nGenerating sampleMetadata file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
324 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
325 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
|
326 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
327 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
328 #peak spectrum as MSP for DB search |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
329 cat("\nGenerating",length(resGC$PseudoSpectra),"peakspectra in peakspectra.msp file\n") |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
330 write.msp(resGC$PseudoSpectra, file="peakspectra.msp", newFile = TRUE) |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
331 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
332 #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
|
333 objects2save <- c("resGC", "xset", "singlefile", "zipfile", "DBgc") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
334 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
|
335 |
7
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
336 cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "") |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
337 |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
338 #WARNING if user has CDF files (not yet good for plotting) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
339 files <- paste("./",names(singlefile),sep="") |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
340 if(MSnbase:::isCdfFile(files)){ |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
341 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" |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
342 warning(warning_message) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
343 cat(paste("\n","/!\\Warning/!\\",warning_message,sep="\n")) |
89af36e05548
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7
workflow4metabolomics
parents:
6
diff
changeset
|
344 } |