Mercurial > repos > yguitton > metams_rungc
annotate metaMS_runGC.r @ 6:286ebb9f6e84 draft
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
author | workflow4metabolomics |
---|---|
date | Thu, 07 May 2020 03:10:33 -0400 |
parents | b8d4129dd2a6 |
children | 89af36e05548 |
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 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
24 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
|
25 loadAndDisplayPackages(pkgs) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
26 |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
27 |
4
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 # ----- PROCESSING INFILE ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
34 cat("\n\n\tARGUMENTS PROCESSING INFO\n\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
35 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
|
36 #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
|
37 print(cbind(value = unlist(args))) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
38 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
39 # ----- PROCESSING INFILE ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
40 cat("\n\n\tARGUMENTS PROCESSING INFO\n\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
41 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
42 # Saving the specific parameters |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
43 #RI parameter |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
44 if (args$ri!="NULL"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
45 RIarg=read.table(args$ri) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 if (ncol(RIarg) < 2) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
50 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
|
51 print(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
52 stop(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
53 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
54 #to do check real column names |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
55 colnames(RIarg)<-c("rt","RI") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
56 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
57 RIarg = NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
58 } |
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 #RIshift parameter |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
61 if (args$rishift!="none"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
62 RIshift=args$rishift |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
63 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
64 RIshift = "none" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
65 } |
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 #Personal database parameter |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
68 if (args$db!="NULL"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
69 DBgc=args$db |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
70 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
71 DBgc = NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
72 } |
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 #settings process |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
75 if (args$settings=="default") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
76 cat("Using default parameters") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
77 data(FEMsettings) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
78 if (args$rtrange[1]!="NULL") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
79 rtrange=args$rtrange |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
80 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
81 rtrange=NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
82 } |
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 if (!is.null(DBgc)){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
85 manual <- read.msp(DBgc) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
86 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
|
87 } |
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 #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
|
90 if (RIshift!="none"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
91 TSQXLS.GC@match2DB.timeComparison<-"RI" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
92 TSQXLS.GC@match2DB.RIdiff<-as.numeric(RIshift) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
93 TSQXLS.GC@betweenSamples.timeComparison<-"RI" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
94 TSQXLS.GC@betweenSamples.RIdiff<-as.numeric(RIshift) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
95 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
96 nSlaves=args$nSlaves |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
97 } |
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 if (args$settings=="User_defined") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
100 cat("Using user's parameters\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
101 fwhmparam=args$fwhm |
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)){ |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
196 cat("Loading datas from XCMS file(s)...\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 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
209 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
210 #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
|
211 if (class(xset)=="xcmsSet"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
212 if (length(xset@rt$raw)>1){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
213 #create an exceptable list of xset for metaMS |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
214 xset.l<-vector("list",length(xset@rt$raw)) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
215 for (i in 1:length(xset@rt$raw)){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
216 xset.l[[i]]<-new("xcmsSet") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
217 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
|
218 df<-data.frame(class=xset@phenoData[i,]) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
219 rownames(df)<-rownames(xset@phenoData)[i] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
220 xset.l[[i]]@phenoData<-df |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
221 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
|
222 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
|
223 xset.l[[i]]@filepaths<-xset@filepaths[i] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
224 xset.l[[i]]@profinfo<-xset@profinfo |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
225 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
226 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
227 xset.l<-xset |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
228 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
229 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
230 #create sampleMetadata, get sampleMetadata and class |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
231 sampleMetadata<-xset@phenoData |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
232 colnames(sampleMetadata) <- c("sampleMetadata","sample_group","class") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
233 sampleMetadata<-sampleMetadata[,-2] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
234 row.names(sampleMetadata)<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
235 samples<-xset@filepaths |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
236 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
237 xset<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
238 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
239 if(args$settings == "default") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
240 settingslist=TSQXLS.GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
241 if (class(xset.l[[1]])!="xsAnnotate"){ |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
242 cat("Process xsAnnotate with CAMERA package...\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
243 xsetCAM<-lapply(xset.l, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
244 function(x) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
245 y <- xsAnnotate(x, sample = 1) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
246 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
|
247 file = NULL) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
248 z}) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
249 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
250 xsetCAM <- xset.l |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
251 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
252 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
253 #default settings for GC from Wehrens et al |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
254 cat("Process runGC with metaMS package...\n\n") |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
255 print(str(TSQXLS.GC)) |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
256 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
|
257 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
258 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
259 if(args$settings == "User_defined") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
260 settingslist=GALAXY.GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
261 if (class(xset.l[[1]])!="xsAnnotate") { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
262 cat("Process xsAnnotate with CAMERA package...\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
263 xsetCAM<-lapply(xset.l, |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
264 function(x) { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
265 y <- xsAnnotate(x, sample = 1) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
266 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
|
267 file = NULL) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
268 z}) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
269 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
270 xsetCAM <- xset.l |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
271 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
272 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
273 #user settings for GC |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
274 cat("Process runGC with metaMS package...\n\n") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
275 print(str(GALAXY.GC)) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
276 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
|
277 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
278 } else { |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
279 error_message <- "There is no xset" |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
280 print(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
281 stop(error_message) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
282 } |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
283 } |
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 <- "No galaxy path entered" |
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 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
291 # ----- EXPORT ----- |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
292 #peakTable ordered by rt |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
293 cat("\nGenerating peakTable file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
294 peaktable<-getCorrectFileName(resGC$PeakTable,sampleMetadata) |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
295 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
296 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
|
297 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
298 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
299 #peakTable for PCA |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
300 #dataMatrix |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
301 cat("\nGenerating dataMatrix file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
302 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
|
303 rownames(dataMatrix)<-NULL |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
304 print(dataMatrix) |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
305 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
306 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
|
307 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
308 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
309 #variableMetadata |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
310 cat("\nGenerating variableMetadata file") |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
311 print(colnames(peaktable)) |
4
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
312 variableMetadata<-peaktable[,!(colnames(peaktable) %in% sampleMetadata[,1])] |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
313 rownames(variableMetadata)<-NULL |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
314 cat("\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
315 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
|
316 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
317 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
318 #sampleMetadata |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
319 cat("\nGenerating sampleMetadata file") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
320 cat("\t.\t.") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
321 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
|
322 cat("\t.\tOK") |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
323 |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
324 #peak spectrum as MSP for DB search |
c10824185547
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 174a1713024f246c1485cbd75218577e89353522
workflow4metabolomics
parents:
diff
changeset
|
325 cat("\nGenerating",length(resGC$PseudoSpectra),"peakspectra in peakspectra.msp file\n") |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
326 if(is.null(resGC$PseudoSpectra)){ |
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
327 write("No results", file="peakspectra.msp") |
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
328 }else{ |
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
329 write.msp(resGC$PseudoSpectra, file="peakspectra.msp", newFile = TRUE) |
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
330 } |
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 |
6
286ebb9f6e84
planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit eb45457830f9d220bcb845acf71bffb50038a4c7-dirty
workflow4metabolomics
parents:
5
diff
changeset
|
336 cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "") |