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