Mercurial > repos > lecorguille > ipo
annotate lib.r @ 2:8e5f667359cb draft default tip
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
author | workflow4metabolomics |
---|---|
date | Mon, 11 Sep 2023 22:37:32 +0000 |
parents | ae8de756dfcf |
children |
rev | line source |
---|---|
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
1 #@author G. Le Corguille |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
2 # solve an issue with batch if arguments are logical TRUE/FALSE |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
3 parseCommandArgs <- function(...) { |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
4 args <- batch::parseCommandArgs(...) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
5 for (key in names(args)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
6 if (args[key] %in% c("TRUE", "FALSE")) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
7 args[key] <- as.logical(args[key]) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
8 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
9 return(args) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
10 } |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
11 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
12 #@author G. Le Corguille |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
13 # This function will |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
14 # - load the packages |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
15 # - display the sessionInfo |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
16 loadAndDisplayPackages <- function(pkgs) { |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
17 for (pkg in pkgs) suppressPackageStartupMessages(stopifnot(library(pkg, quietly = TRUE, logical.return = TRUE, character.only = TRUE))) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
18 sessioninfo <- sessionInfo() |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
19 cat(sessioninfo$R.version$version.string, "\n") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
20 cat("Main packages:\n") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
21 for (pkg in names(sessioninfo$otherPkgs)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
22 cat(paste(pkg, packageVersion(pkg)), "\t") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
23 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
24 cat("\n") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
25 cat("Other loaded packages:\n") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
26 for (pkg in names(sessioninfo$loadedOnly)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
27 cat(paste(pkg, packageVersion(pkg)), "\t") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
28 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
29 cat("\n") |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
30 } |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
31 |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
32 ## |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
33 ## This function launch IPO functions to get the best parameters for xcmsSet |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
34 ## A sample among the whole dataset is used to save time |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
35 ## |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
36 ipo4xcmsSet <- function(directory, parametersOutput, args, samplebyclass = 4) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
37 setwd(directory) |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
38 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
39 files <- list.files(".", recursive = TRUE) # "KO/ko15.CDF" "KO/ko16.CDF" "WT/wt15.CDF" "WT/wt16.CDF" |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
40 files <- files[!files %in% c("conda_activate.log", "log.txt")] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
41 files_classes <- basename(dirname(files)) # "KO", "KO", "WT", "WT" |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
42 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
43 mzmlfile <- files |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
44 if (samplebyclass > 0) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
45 #random selection of N files for IPO in each class |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
46 classes <- unique(basename(dirname(files))) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
47 mzmlfile <- NULL |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
48 for (class_i in classes){ |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
49 files_class_i <- files[files_classes == class_i] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
50 if (samplebyclass > length(files_class_i)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
51 mzmlfile <- c(mzmlfile, files_class_i) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
52 } else { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
53 mzmlfile <- c(mzmlfile, sample(files_class_i, samplebyclass)) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
54 } |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
55 } |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
56 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
57 #@TODO: else, must we keep the RData to been use directly by group? |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
58 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
59 cat("\t\tSamples used:\n") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
60 print(mzmlfile) |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
61 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
62 peakpickingParameters <- getDefaultXcmsSetStartingParams(args$method) #get default parameters of IPO |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
63 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
64 # filter args to only get releavant parameters and complete with those that are not declared |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
65 peakpickingParametersUser <- c(args[names(args) %in% names(peakpickingParameters)], peakpickingParameters[!(names(peakpickingParameters) %in% names(args))]) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
66 peakpickingParametersUser$verbose.columns <- TRUE |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
67 resultPeakpicking <- optimizeXcmsSet(mzmlfile, peakpickingParametersUser, nSlaves = args$nSlaves, subdir = "./IPO_results") #some images generated by IPO |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
68 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
69 # export |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
70 peakpicking_best_params <- resultPeakpicking$best_settings$parameters[!(names(resultPeakpicking$best_settings$parameters) %in% c("nSlaves", "verbose.columns"))] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
71 write.table(t(as.data.frame(peakpicking_best_params)), file = parametersOutput, sep = "\t", row.names = TRUE, col.names = FALSE, quote = FALSE) #can be read by user |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
72 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
73 return(resultPeakpicking$best_settings$xset) |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
74 } |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
75 |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
76 ## |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
77 ## This function launch IPO functions to get the best parameters for group and retcor |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
78 ## |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
79 ipo4retgroup <- function(xset, directory, parametersOutput, args, samplebyclass = 4) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
80 setwd(directory) |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
81 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
82 files <- list.files(".", recursive = TRUE) # "KO/ko15.CDF" "KO/ko16.CDF" "WT/wt15.CDF" "WT/wt16.CDF" |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
83 files <- files[!files %in% c("conda_activate.log", "log.txt")] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
84 files_classes <- basename(dirname(files)) # "KO", "KO", "WT", "WT" |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
85 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
86 retcorGroupParameters <- getDefaultRetGroupStartingParams(args$retcorMethod) #get default parameters of IPO |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
87 print(retcorGroupParameters) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
88 # filter args to only get releavant parameters and complete with those that are not declared |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
89 retcorGroupParametersUser <- c(args[names(args) %in% names(retcorGroupParameters)], retcorGroupParameters[!(names(retcorGroupParameters) %in% names(args))]) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
90 print("retcorGroupParametersUser") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
91 print(retcorGroupParametersUser) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
92 resultRetcorGroup <- optimizeRetGroup(xset, retcorGroupParametersUser, nSlaves = args$nSlaves, subdir = "../IPO_results") #some images generated by IPO |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
93 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
94 # export |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
95 resultRetcorGroup_best_params <- resultRetcorGroup$best_settings |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
96 write.table(t(as.data.frame(resultRetcorGroup_best_params)), file = parametersOutput, sep = "\t", row.names = TRUE, col.names = FALSE, quote = FALSE) #can be read by user |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
97 } |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
98 |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
99 |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
100 |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
101 # This function check if XML contains special caracters. It also checks integrity and completness. |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
102 #@author Misharl Monsoor misharl.monsoor@sb-roscoff.fr ABiMS TEAM |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
103 checkXmlStructure <- function(directory) { |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
104 cat("Checking XML structure...\n") |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
105 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
106 cmd <- paste0("IFS=$'\n'; for xml in $(find '", directory, "' -not -name '\\.*' -not -path '*conda-env*' -type f -iname '*.*ml*'); do if [ $(xmllint --nonet --noout \"$xml\" 2> /dev/null; echo $?) -gt 0 ]; then echo $xml;fi; done;") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
107 capture <- system(cmd, intern = TRUE) |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
108 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
109 if (length(capture) > 0) { |
0
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
110 write("\n\nERROR: The following mzXML or mzML file(s) are incorrect, please check these files first:", stderr()) |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
111 write(capture, stderr()) |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
112 stop("ERROR: xcmsSet cannot continue with incorrect mzXML or mzML files") |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
113 } |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
114 |
ac5f2936575b
planemo upload commit 131562ad89c33a2f87754936ce3c8fe6899484c0
lecorguille
parents:
diff
changeset
|
115 } |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
116 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
117 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
118 # This function get the raw file path from the arguments |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
119 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
120 getRawfilePathFromArguments <- function(singlefile, zipfile, args, prefix = "") { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
121 if (!(prefix %in% c("", "Positive", "Negative", "MS1", "MS2"))) stop("prefix must be either '', 'Positive', 'Negative', 'MS1' or 'MS2'") |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
122 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
123 if (!is.null(args[[paste0("zipfile", prefix)]])) zipfile <- args[[paste0("zipfile", prefix)]] |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
124 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
125 if (!is.null(args[[paste0("singlefile_galaxyPath", prefix)]])) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
126 singlefile_galaxyPaths <- args[[paste0("singlefile_galaxyPath", prefix)]] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
127 singlefile_sampleNames <- args[[paste0("singlefile_sampleName", prefix)]] |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
128 } |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
129 if (exists("singlefile_galaxyPaths")) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
130 singlefile_galaxyPaths <- unlist(strsplit(singlefile_galaxyPaths, "\\|")) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
131 singlefile_sampleNames <- unlist(strsplit(singlefile_sampleNames, "\\|")) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
132 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
133 singlefile <- NULL |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
134 for (singlefile_galaxyPath_i in seq_along(length(singlefile_galaxyPaths))) { |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
135 singlefile_galaxyPath <- singlefile_galaxyPaths[singlefile_galaxyPath_i] |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
136 singlefile_sampleName <- singlefile_sampleNames[singlefile_galaxyPath_i] |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
137 # In case, an url is used to import data within Galaxy |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
138 singlefile_sampleName <- tail(unlist(strsplit(singlefile_sampleName, "/")), n = 1) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
139 singlefile[[singlefile_sampleName]] <- singlefile_galaxyPath |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
140 } |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
141 } |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
142 return(list(zipfile = zipfile, singlefile = singlefile)) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
143 } |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
144 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
145 # This function retrieve the raw file in the working directory |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
146 # - if zipfile: unzip the file with its directory tree |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
147 # - if singlefiles: set symlink with the good filename |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
148 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
149 retrieveRawfileInWD <- function(singlefile, zipfile) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
150 if (!is.null(singlefile) && (length("singlefile") > 0)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
151 for (singlefile_sampleName in names(singlefile)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
152 singlefile_galaxyPath <- singlefile[[singlefile_sampleName]] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
153 if (!file.exists(singlefile_galaxyPath)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
154 error_message <- paste("Cannot access the sample:", singlefile_sampleName, "located:", singlefile_galaxyPath, ". Please, contact your administrator ... if you have one!") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
155 print(error_message) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
156 stop(error_message) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
157 } |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
158 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
159 if (!suppressWarnings(try(file.link(singlefile_galaxyPath, singlefile_sampleName), silent = TRUE))) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
160 file.copy(singlefile_galaxyPath, singlefile_sampleName) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
161 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
162 } |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
163 directory <- "." |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
164 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
165 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
166 if (!is.null(zipfile) && (zipfile != "")) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
167 if (!file.exists(zipfile)) { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
168 error_message <- paste( |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
169 "Cannot access the Zip file:", |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
170 zipfile, |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
171 ". Please, contact your administrator ... if you have one!" |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
172 ) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
173 print(error_message) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
174 stop(error_message) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
175 } |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
176 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
177 #unzip |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
178 suppressWarnings(unzip(zipfile, unzip = "unzip")) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
179 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
180 #get the directory name |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
181 suppressWarnings(filesInZip <- unzip(zipfile, list = TRUE)) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
182 directories <- unique(unlist(lapply(strsplit(filesInZip$Name, "/"), function(x) x[1]))) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
183 directories <- directories[!(directories %in% c("__MACOSX")) & file.info(directories)$isdir] |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
184 directory <- "." |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
185 if (length(directories) == 1) directory <- directories |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
186 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
187 cat("files_root_directory\t", directory, "\n") |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
188 |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
189 } |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
190 return(directory) |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
191 } |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
192 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
193 |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
194 # This function retrieve a xset like object |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
195 #@author Gildas Le Corguille lecorguille@sb-roscoff.fr |
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
196 getxcmsSetObject <- function(xobject) { |
2
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
197 # XCMS 1.x |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
198 if (class(xobject) == "xcmsSet") |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
199 return(xobject) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
200 # XCMS 3.x |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
201 if (class(xobject) == "XCMSnExp") { |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
202 # Get the legacy xcmsSet object |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
203 suppressWarnings(xset <- as(xobject, "xcmsSet")) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
204 if (!is.null(xset@phenoData$sample_group)) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
205 sampclass(xset) <- xset@phenoData$sample_group |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
206 else |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
207 sampclass(xset) <- "." |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
208 return(xset) |
8e5f667359cb
planemo upload for repository https://github.com/rietho/IPO commit d25c744220e416cce158161fa7dc3b0f153a5c11
workflow4metabolomics
parents:
1
diff
changeset
|
209 } |
1
ae8de756dfcf
"planemo upload for repository https://github.com/rietho/IPO commit 5083f3b5800bdd8515519f2f6398046b41e1df97"
workflow4metabolomics
parents:
0
diff
changeset
|
210 } |