annotate metams.r @ 2:8e1b99a7d733 draft

Bug fix on RI file format
author yguitton
date Wed, 24 May 2017 07:39:18 -0400
parents 142fbe102a9d
children c75532b75ba1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
2 # metams.r version="2.0"
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
3 #created by Yann GUITTON
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
4 #use RI options
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
5
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
6 #Redirect all stdout to the log file
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
7 log_file=file("metams.log", open = "wt")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
8 sink(log_file)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
9 sink(log_file, type = "out")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
10
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
11 library(metaMS)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
12 library(batch) #necessary for parseCommandArgs function
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
13
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
14 source_local <- function(fname) {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
15 argv <- commandArgs(trailingOnly = FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
16 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
17 source(paste(base_dir, fname, sep="/"))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
18 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
19 print("step1")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
20
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
21
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
22 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
23 print("new version 2.0")
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
24
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
25
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
26 print(listArguments)
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
27
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
28
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
29 if (listArguments[["ri"]]!="NULL"){
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
30 RIarg=read.table(listArguments[["ri"]])
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
31 if (ncol(RIarg) < 2) RIarg=read.table(listArguments[["ri"]], h=T, sep=";")
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
32 if (ncol(RIarg) < 2) RIarg=read.table(listArguments[["ri"]], h=T, sep="\t")
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
33 if (ncol(RIarg) < 2) RIarg=read.table(listArguments[["ri"]], h=T, sep=",")
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
34 if (ncol(RIarg) < 2) {
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
35 error_message="Your RI file seems not well formatted. The column separators accepted are ; , and tabulation"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
36 print(error_message)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
37 stop(error_message)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
38 }
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
39 #to do check real column names
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
40 colnames(RIarg)<-c("rt","RI")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
41 # print(RIarg)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
42 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
43 RIarg = NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
44 # cat("Ri= ",RIarg)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
45 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
46
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
47 if (listArguments[["rishift"]]!="none"){
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
48 RIshift=listArguments[["rishift"]]
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
49 cat("Rishift used= ",RIshift, "\n")
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
50 } else {
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
51 RIshift = "none"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
52 cat("Rishift NONE= ",RIshift, "\n")
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
53 }
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
54
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
55 DBarg=listArguments[["db"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
56 # if (listArguments[["use_db"]]!="NULL"){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
57 if (DBarg!="NULL"){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
58 DBarg=listArguments[["db"]]
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
59 cat("Db= ",DBarg, "\n")
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
60 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
61 DBarg = NULL
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
62 cat("NO Db : ",DBarg, "\n")
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
63 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
64
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
65
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
66
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
67 #for unknown EIC printing
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
68
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
69 if (listArguments[["unkn"]][1]!="NULL") {
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
70 unknarg<-listArguments[["unkn"]]
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
71 } else {
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
72 unknarg<-""
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
73 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
74
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
75 print(paste("Unkn:",unknarg))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
76
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
77 #remove unused arguments
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
78 listArguments[["unkn"]]<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
79 listArguments[["db"]] <- NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
80 listArguments[["ri"]] <- NULL
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
81 listArguments[["rishift"]] <- NULL
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
82
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
83 print(" step2")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
84
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
85 #runGC accept either a list of files a zip folder or an xset object from xcms.xcmsSet tool
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
86
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
87 #CASE 2 from zip file
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
88 #necessary to unzip .zip file uploaded to Galaxy
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
89 #thanks to .zip file it's possible to upload many file as the same time conserving the tree hierarchy of directories
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
90
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
91 if (!is.null(listArguments[["zipfile"]])){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
92 print("CASE 2 from zip file")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
93 directory=unzip(listArguments[["zipfile"]])
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
94 listArguments=append(list(directory), listArguments)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
95
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
96 metams_zip_file= listArguments[["zipfile"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
97 listArguments[["zipfile"]]=NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
98
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
99 filepattern <- c("[Cc][Dd][Ff]", "[Nn][Cc]", "([Mm][Zz])?[Xx][Mm][Ll]","[Mm][Zz][Dd][Aa][Tt][Aa]", "[Mm][Zz][Mm][Ll]")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
100 filepattern <- paste(paste("\\.", filepattern, "$", sep = ""),collapse = "|")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
101 #samples<-list.files(path=directory, pattern=filepattern, all.files=FALSE,recursive=TRUE,full.names=TRUE,ignore.case=FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
102 samples<-directory[grep(filepattern, directory)]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
103 # cat(samples) #debugg
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
104 #create sampleMetadata, get sampleMetadata and class
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
105 sampleMetadata<-xcms:::phenoDataFromPaths(samples)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
106 sampleMetadata<-cbind(sampleMetadata=rownames(sampleMetadata),sampleMetadata)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
107 row.names(sampleMetadata)<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
108 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
109 metams_zip_file=""
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
110 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
111
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
112 #CASE 3 from xset is an .RData file necessary to use the xcmsSet object generated by xcms.xcmsSet given by previous tools
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
113 if (!is.null(listArguments[["xset"]])){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
114 print("CASE 3 from xset")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
115 require(CAMERA, quietly = TRUE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
116 load(listArguments[["xset"]])
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
117 cat(class(xset))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
118 xsetparam=listArguments[["xset"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
119 listArguments[["xset"]]=NULL #remove xset from arguments
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
120
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
121 #xset from xcms.xcmsSet is not well formatted for metaMS this function do the formatting
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
122 if (class(xset)=="xcmsSet"){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
123
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
124 #treat case where Rdata came from xcmsSet with zip file entry
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
125 if(exists("zip_file")){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
126 if (zip_file!=""){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
127 directory=unzip(zip_file)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
128 print("CASE 3 from xset and with ZIP input")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
129
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
130 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
131 print("CASE 3 from xset and with LIBRARY input")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
132 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
133 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
134 #end zip file case
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
135 if (length(xset@rt$raw)>1){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
136 #create an exceptable list of xset for metaMS
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
137 xset.l<-vector("list",length(xset@rt$raw))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
138 for (i in 1:length(xset@rt$raw)){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
139 xset.l[[i]]<-new("xcmsSet")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
140 xset.l[[i]]@peaks<-xset@peaks[which(xset@peaks[,"sample"]==i),]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
141 df<-data.frame(class=xset@phenoData[i,])
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
142 rownames(df)<-rownames(xset@phenoData)[i]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
143 xset.l[[i]]@phenoData<-df
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
144 xset.l[[i]]@rt$raw<-xset@rt$raw[[i]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
145 xset.l[[i]]@rt$corrected<-xset@rt$corrected[[i]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
146 xset.l[[i]]@filepaths<-xset@filepaths[i]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
147 xset.l[[i]]@profinfo<-xset@profinfo
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
148 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
149 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
150 xset.l<-xset
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
151 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
152
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
153 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
154 #create sampleMetadata, get sampleMetadata and class
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
155 sampleMetadata<-xset@phenoData
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
156 sampleMetadata<-cbind(sampleMetadata=rownames(sampleMetadata),sampleMetadata)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
157 row.names(sampleMetadata)<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
158 samples<-xset@filepaths
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
159 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
160 xsetparam<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
161 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
162
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
163
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
164
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
165 #Import the different functions
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
166 source_local("lib_metams.r")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
167
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
168 #load function for ploting EICs and pspectra
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
169 # source_local("plotUnknown.r")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
170
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
171 #settings process
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
172 if (listArguments[["settings"]]=="default") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
173 data(FEMsettings)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
174 if (listArguments[["rtrange"]][1]!="NULL") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
175 rtrange=listArguments[["rtrange"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
176 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
177 rtrange=NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
178 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
179
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
180 if (!is.null(DBarg)){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
181 manual <- read.msp(DBarg)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
182 DBarg <- createSTDdbGC(stdInfo = NULL, settings = TSQXLS.GC, manualDB = manual)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
183 }
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
184
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
185 #use RI instead of rt for time comparison vs DB
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
186 if (RIshift!="none"){
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
187 TSQXLS.GC@match2DB.timeComparison<-"RI"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
188 TSQXLS.GC@match2DB.RIdiff<-as.numeric(RIshift)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
189 TSQXLS.GC@betweenSamples.timeComparison<-"RI"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
190 TSQXLS.GC@betweenSamples.RIdiff<-as.numeric(RIshift)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
191 }
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
192
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
193 nSlaves=listArguments[["nSlaves"]]
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
194
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
195
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
196 if(!metams_zip_file=="") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
197 resGC<-runGC(files=samples,settings=TSQXLS.GC, rtrange=rtrange, DB= DBarg, removeArtefacts = TRUE, findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) #default settings for GC from Wehrens et al
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
198 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
199 if(!is.null(xsetparam)){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
200 settingslist=TSQXLS.GC
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
201 if (class(xset.l[[1]])!="xsAnnotate"){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
202 cat("Process xsAnnotate")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
203 xset<-lapply(xset.l,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
204 function(x) {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
205 y <- xsAnnotate(x, sample = 1)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
206 capture.output(z <- groupFWHM(y, perfwhm = settingslist@CAMERA$perfwhm),
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
207 file = NULL)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
208 z})
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
209
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
210 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
211
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
212 resGC<-runGC(xset=xset,settings=TSQXLS.GC, rtrange=rtrange, DB= DBarg, removeArtefacts = TRUE, findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) #default settings for GC from Wehrens et al
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
213 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
214 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
215
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
216 if (listArguments[["settings"]]=="User_defined") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
217 listArguments[["settings"]]=NULL #delete from the list of arguments
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
218 fwhmparam=listArguments[["fwhm"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
219 rtdiffparam=listArguments[["rtdiff"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
220 minfeatparam=listArguments[["minfeat"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
221 simthreshparam=listArguments[["simthreshold"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
222 minclassfractionparam=listArguments[["minclassfraction"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
223 minclasssizeparam=listArguments[["minclasssize"]]
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
224
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
225 if (listArguments[["rtrange"]]!="NULL") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
226 rtrange=listArguments[["rtrange"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
227 cat("rtrange= ",rtrange)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
228 } else {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
229 rtrange=NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
230 cat("rtrange= ",rtrange)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
231 }
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
232
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
233
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
234 nSlaves=listArguments[["nSlaves"]]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
235
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
236 GALAXY.GC <- metaMSsettings("protocolName" = "GALAXY.GC",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
237 "chrom" = "GC",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
238 PeakPicking = list(
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
239 method = "matchedFilter",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
240 step = 0.5,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
241 steps = 2,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
242 mzdiff = .5,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
243 fwhm = fwhmparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
244 snthresh = 2,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
245 max = 500),
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
246 CAMERA = list(perfwhm = 1))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
247
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
248 metaSetting(GALAXY.GC, "DBconstruction") <- list(
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
249 minintens = 0.0,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
250 rttol = rtdiffparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
251 intensityMeasure = "maxo",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
252 DBthreshold = .80,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
253 minfeat = minfeatparam)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
254 metaSetting(GALAXY.GC, "match2DB") <- list(
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
255 simthresh = simthreshparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
256 timeComparison = "rt",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
257 rtdiff = rtdiffparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
258 RIdiff = 5,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
259 minfeat = minfeatparam)
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
260
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
261 #to used if contaminant filter
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
262
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
263 # metaSetting(GALAXY.GC, "matchIrrelevants") <- list(
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
264 # irrelevantClasses = c("Bleeding", "Plasticizers"),
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
265 # timeComparison = "RI",
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
266 # RIdiff = RIdiffparam,
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
267 # rtdiff = rtdiffparam,
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
268 # simthresh = simthreshparam)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
269
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
270 metaSetting(GALAXY.GC, "betweenSamples") <- list(
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
271 min.class.fraction = minclassfractionparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
272 min.class.size = minclasssizeparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
273 timeComparison = "rt",
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
274 rtdiff = rtdiffparam,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
275 RIdiff = 2,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
276 simthresh = simthreshparam)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
277
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
278 #ONLY use RI instead of rt for time comparison vs DB or samples
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
279 if (RIshift!="none"){
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
280 GALAXY.GC@match2DB.timeComparison<-"RI"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
281 GALAXY.GC@match2DB.RIdiff<-as.numeric(RIshift)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
282 GALAXY.GC@betweenSamples.timeComparison<-"RI"
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
283 GALAXY.GC@betweenSamples.RIdiff<-as.numeric(RIshift)
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
284 }
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
285 # files, xset, settings, rtrange = NULL, DB = NULL,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
286 # removeArtefacts = TRUE, findUnknowns = nexp > 1,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
287 # returnXset = FALSE, RIstandards = NULL, nSlaves = 0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
288 if (!is.null(DBarg)){
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
289 manual <- read.msp(DBarg)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
290 DBarg <- createSTDdbGC(stdInfo = NULL, settings = GALAXY.GC, manualDB = manual)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
291 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
292 if (!metams_zip_file=="") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
293 resGC<-runGC(files=samples,settings=GALAXY.GC,rtrange = rtrange, DB= DBarg , removeArtefacts = TRUE, findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
294 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
295 if(!is.null(xsetparam)) {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
296 settingslist=GALAXY.GC
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
297 if (class(xset.l[[1]])!="xsAnnotate") {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
298 print("Process xsAnnotate")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
299 xset<-lapply(xset.l,
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
300 function(x) {
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
301 y <- xsAnnotate(x, sample = 1)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
302 capture.output(z <- groupFWHM(y, perfwhm = settingslist@CAMERA$perfwhm),
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
303 file = NULL)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
304 z})
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
305
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
306 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
307 resGC<-runGC(xset=xset,settings=GALAXY.GC,rtrange = rtrange, DB= DBarg, removeArtefacts = TRUE, findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
308 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
309 }
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
310
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
311 #peakTable ordered by rt
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
312 peaktable<-resGC$PeakTable<-resGC$PeakTable[order(resGC$PeakTable[,"rt"]),]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
313 write.table(peaktable, file="peaktable.tsv", sep="\t", row.names=FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
314
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
315 #peakTable for PCA
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
316 #dataMatrix
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
317 dataMatrix<-cbind(Name=resGC$PeakTable[,"Name"],resGC$PeakTable[,(colnames(resGC$PeakTable) %in% sampleMetadata[,1])])
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
318 rownames(dataMatrix)<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
319 write.table(dataMatrix, file="dataMatrix.tsv", sep="\t", row.names=FALSE, quote=FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
320
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
321 #variableMetadata
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
322 variableMetadata<-resGC$PeakTable[,!(colnames(resGC$PeakTable) %in% sampleMetadata[,1])]
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
323 rownames(variableMetadata)<-NULL
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
324 write.table(variableMetadata, file="variableMetadata.tsv", sep="\t", row.names=FALSE, quote=FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
325
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
326 #sampleMetadata
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
327 write.table(sampleMetadata, file="sampleMetadata.tsv", sep="\t", row.names=FALSE, quote=FALSE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
328
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
329 #peak spectrum as MSP for DB search
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
330 write.msp(resGC$PseudoSpectra, file="peakspectra.msp", newFile = TRUE)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
331
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
332 #TIC/BPC picture generation
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
333 # use files as entry not xset that do not exist
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
334
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
335 print("TICs")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
336 #Use getTIC2s and getBPC2s because getTICs and getBPCs can exists due to transfert of function in Rdata
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
337 b<-getTIC2s(files = samples, pdfname="TICs_raw.pdf", rt="raw")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
338
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
339 print("BPCs")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
340 c<-getBPC2s(files=samples, rt="raw", pdfname="BPCs_raw.pdf")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
341
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
342 print("Step QC plot")
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
343
1
142fbe102a9d Uploaded version 2.0
yguitton
parents: 0
diff changeset
344 #to do check if no peaks found
0
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
345 #Quality controls plots but only working in R (don't know why)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
346 a<-plotUnknowns(resGC=resGC, unkn=unknarg) #use unknparam value
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
347
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
348 # create a mergpdf
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
349
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
350 #test
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
351 system(paste('gs -o TICsBPCs_merged.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress *Cs_raw.pdf'))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
352 system(paste('gs -o GCMS_EIC.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress Unknown_*'))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
353
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
354
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
355 ############################################TEST FUNCTION START#################################################################
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
356
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
357 ############################################TEST FUNCTION END#################################################################
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
358
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
359
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
360
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
361
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
362 #zip files of all runGC outputs
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
363
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
364 system(paste('ls . | grep -e "tsv$" -e "msp$" -e "GCMS_" | zip -r -@ "rungc.zip"'))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
365
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
366
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
367 #delete the parameters to avoid the passage to the next tool in .RData image
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
368 rm(listArguments)
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
369
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
370 #saving R data in .Rdata file to save the variables used in the present tool
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
371 save.image(paste("runGC","RData",sep="."))
2066efbafd7c planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit 6384fcf4496a64affe0b8a173c3f7ea09a275ffb
yguitton
parents:
diff changeset
372