Mercurial > repos > computational-metabolomics > mspurity_combineannotations
annotate purityX.R @ 11:85e83614f891 draft default tip
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 94f746247c464fb270358421399810d8a9fb9e8a
author | computational-metabolomics |
---|---|
date | Fri, 13 Sep 2024 13:40:51 +0000 |
parents | 6400af18199a |
children |
rev | line source |
---|---|
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
1 library(msPurity) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
2 library(optparse) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
3 print(sessionInfo()) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
4 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
5 option_list <- list( |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
6 make_option(c("--xset_path"), type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
7 make_option(c("-o", "--out_dir"), type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
8 make_option(c("--mzML_path"), type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
9 make_option("--minOffset", default = 0.5), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
10 make_option("--maxOffset", default = 0.5), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
11 make_option("--ilim", default = 0.05), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
12 make_option("--iwNorm", default = "none", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
13 make_option("--exclude_isotopes", action = "store_true"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
14 make_option("--isotope_matrix", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
15 make_option("--purityType", default = "purityFWHMmedian"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
16 make_option("--singleFile", default = 0), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
17 make_option("--cores", default = 4), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
18 make_option("--xgroups", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
19 make_option("--camera_xcms", default = "xset"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
20 make_option("--files", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
21 make_option("--galaxy_files", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
22 make_option("--choose_class", type = "character"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
23 make_option("--ignore_files", type = "character"), |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
24 make_option("--rtraw_columns", action = "store_true") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
25 ) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
26 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
27 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
28 opt <- parse_args(OptionParser(option_list = option_list)) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
29 print(opt) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
30 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
31 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
32 if (!is.null(opt$xgroups)) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
33 xgroups <- as.numeric(strsplit(opt$xgroups, ",")[[1]]) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
34 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
35 xgroups <- NULL |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
36 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
37 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
38 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
39 print(xgroups) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
40 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
41 if (!is.null(opt$remove_nas)) { |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
42 df <- df[!is.na(df$mz), ] |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
43 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
44 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
45 if (is.null(opt$isotope_matrix)) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
46 im <- NULL |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
47 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
48 im <- read.table(opt$isotope_matrix, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
49 header = TRUE, sep = "\t", stringsAsFactors = FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
50 ) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
51 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
52 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
53 if (is.null(opt$exclude_isotopes)) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
54 isotopes <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
55 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
56 isotopes <- TRUE |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
57 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
58 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
59 if (is.null(opt$rtraw_columns)) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
60 rtraw_columns <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
61 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
62 rtraw_columns <- TRUE |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
63 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
64 |
10
6400af18199a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f10386dee95f3b1fbc8d1eeec52d450381ba89c5
computational-metabolomics
parents:
9
diff
changeset
|
65 loadRData <- function(rdata_path, xnames) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
66 # loads an RData file, and returns the named xset object if it is there |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
67 load(rdata_path) |
10
6400af18199a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f10386dee95f3b1fbc8d1eeec52d450381ba89c5
computational-metabolomics
parents:
9
diff
changeset
|
68 return(get(ls()[ls() %in% xnames])) |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
69 } |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
70 |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
71 |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
72 |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
73 |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
74 getxcmsSetObject <- function(xobject) { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
75 # XCMS 1.x |
9
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
76 if (class(xobject) == "xcmsSet"){ |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
77 return(xobject) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
78 } |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
79 # XCMS 3.x |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
80 if (class(xobject) == "XCMSnExp") { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
81 # Get the legacy xcmsSet object |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
82 suppressWarnings(xset <- as(xobject, "xcmsSet")) |
9
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
83 if (!is.null(xset@phenoData$sample_group)){ |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
84 xcms::sampclass(xset) <- xset@phenoData$sample_group |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
85 }else{ |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
86 xcms::sampclass(xset) <- "." |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
87 } |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
88 return(xset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
89 } |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
90 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
91 |
10
6400af18199a
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit f10386dee95f3b1fbc8d1eeec52d450381ba89c5
computational-metabolomics
parents:
9
diff
changeset
|
92 target_obj <- loadRData(opt$xset_path, c('xset', 'xa', 'xdata')) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
93 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
94 if (opt$camera_xcms == "camera") { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
95 xset <- target_obj@xcmsSet |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
96 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
97 xset <- target_obj |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
98 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
99 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
100 xset <- getxcmsSetObject(xset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
101 |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
102 print(xset) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
103 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
104 minOffset <- as.numeric(opt$minOffset) |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
105 maxOffset <- as.numeric(opt$maxOffset) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
106 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
107 if (opt$iwNorm == "none") { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
108 iwNorm <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
109 iwNormFun <- NULL |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
110 } else if (opt$iwNorm == "gauss") { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
111 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
112 iwNormFun <- msPurity::iwNormGauss(minOff = -minOffset, maxOff = maxOffset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
113 } else if (opt$iwNorm == "rcosine") { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
114 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
115 iwNormFun <- msPurity::iwNormRcosine(minOff = -minOffset, maxOff = maxOffset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
116 } else if (opt$iwNorm == "QE5") { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
117 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
118 iwNormFun <- msPurity::iwNormQE.5() |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
119 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
120 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
121 print(xset@filepaths) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
122 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
123 if (!is.null(opt$files)) { |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
124 updated_filepaths <- trimws(strsplit(opt$files, ",")[[1]]) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
125 updated_filepaths <- updated_filepaths[updated_filepaths != ""] |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
126 print(updated_filepaths) |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
127 updated_filenames <- basename(updated_filepaths) |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
128 original_filenames <- basename(xset@filepaths) |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
129 update_idx <- match(updated_filenames, original_filenames) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
130 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
131 if (!is.null(opt$galaxy_files)) { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
132 galaxy_files <- trimws(strsplit(opt$galaxy_files, ",")[[1]]) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
133 galaxy_files <- galaxy_files[galaxy_files != ""] |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
134 xset@filepaths <- galaxy_files[update_idx] |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
135 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
136 xset@filepaths <- updated_filepaths[update_idx] |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
137 } |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
138 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
139 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
140 if (!is.null(opt$choose_class)) { |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
141 classes <- trimws(strsplit(opt$choose_class, ",")[[1]]) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
142 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
143 ignore_files_class <- which(!as.character(xset@phenoData$class) %in% classes) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
144 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
145 print("choose class") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
146 print(ignore_files_class) |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
147 } else { |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
148 ignore_files_class <- NA |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
149 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
150 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
151 if (!is.null(opt$ignore_files)) { |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
152 ignore_files_string <- trimws(strsplit(opt$ignore_files, ",")[[1]]) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
153 filenames <- rownames(xset@phenoData) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
154 ignore_files <- which(filenames %in% ignore_files_string) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
155 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
156 ignore_files <- unique(c(ignore_files, ignore_files_class)) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
157 ignore_files <- ignore_files[ignore_files != ""] |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
158 } else { |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
159 if (anyNA(ignore_files_class)) { |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
160 ignore_files <- NULL |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
161 } else { |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
162 ignore_files <- ignore_files_class |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
163 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
164 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
165 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
166 print("ignore_files") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
167 print(ignore_files) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
168 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
169 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
170 ppLCMS <- msPurity::purityX( |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
171 xset = xset, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
172 offsets = c(minOffset, maxOffset), |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
173 cores = opt$cores, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
174 xgroups = xgroups, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
175 purityType = opt$purityType, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
176 ilim = opt$ilim, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
177 isotopes = isotopes, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
178 im = im, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
179 iwNorm = iwNorm, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
180 iwNormFun = iwNormFun, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
181 singleFile = opt$singleFile, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
182 fileignore = ignore_files, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
183 rtrawColumns = rtraw_columns |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
184 ) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
185 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
186 dfp <- ppLCMS@predictions |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
187 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
188 # to make compatable with deconrank |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
189 # (keep grpid for other compatibility) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
190 dfp <- data.frame("peakID"=dfp$grpid, dfp) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
191 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
192 colnames(dfp)[colnames(dfp) == "median"] <- "medianPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
193 colnames(dfp)[colnames(dfp) == "mean"] <- "meanPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
194 colnames(dfp)[colnames(dfp) == "sd"] <- "sdPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
195 colnames(dfp)[colnames(dfp) == "stde"] <- "sdePurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
196 colnames(dfp)[colnames(dfp) == "RSD"] <- "cvPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
197 colnames(dfp)[colnames(dfp) == "pknm"] <- "pknmPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
198 |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
199 if (sum(is.na(dfp$medianPurity)) > 0) { |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
200 dfp[is.na(dfp$medianPurity), ]$medianPurity <- 0 |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
201 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
202 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
203 print(head(dfp)) |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
204 write.table(dfp, file.path(opt$out_dir, "purityX_output.tsv"), row.names = FALSE, sep = "\t") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
205 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
206 save.image(file.path(opt$out_dir, "purityX_output.RData")) |