Mercurial > repos > computational-metabolomics > mspurity_combineannotations
annotate purityX.R @ 9:f11c129a4227 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
author | computational-metabolomics |
---|---|
date | Thu, 13 Jun 2024 11:40:53 +0000 |
parents | 94a2b6571758 |
children | 6400af18199a |
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("--rdata_name", 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("--camera_xcms", default = "xset"), |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 ) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
27 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
28 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
29 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
|
30 print(opt) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
31 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
32 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
33 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
|
34 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
|
35 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
36 xgroups <- NULL |
0
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 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
40 print(xgroups) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
41 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
42 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
|
43 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
|
44 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
45 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
46 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
|
47 im <- NULL |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
48 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
49 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
|
50 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
|
51 ) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
52 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
53 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
54 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
|
55 isotopes <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
56 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
57 isotopes <- TRUE |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
58 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
59 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
60 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
|
61 rtraw_columns <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
62 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
63 rtraw_columns <- TRUE |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
64 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
65 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
66 loadRData <- function(rdata_path, xset_name) { |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
67 # 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
|
68 load(rdata_path) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
69 return(get(ls()[ls() == xset_name])) |
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 |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
75 getxcmsSetObject <- function(xobject) { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
76 # XCMS 1.x |
9
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
77 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
|
78 return(xobject) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
79 } |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
80 # XCMS 3.x |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
81 if (class(xobject) == "XCMSnExp") { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
82 # 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
|
83 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
|
84 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
|
85 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
|
86 }else{ |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
87 xcms::sampclass(xset) <- "." |
f11c129a4227
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20a48a1862267264f98b7c514287f9a5cba1143f
computational-metabolomics
parents:
8
diff
changeset
|
88 } |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
89 return(xset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
90 } |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
91 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
92 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
93 target_obj <- loadRData(opt$xset_path, opt$rdata_name) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
94 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
95 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
|
96 xset <- target_obj@xcmsSet |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
97 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
98 xset <- target_obj |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
99 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
100 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
101 xset <- getxcmsSetObject(xset) |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
102 |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
103 print(xset) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
104 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
105 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
|
106 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
|
107 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
108 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
|
109 iwNorm <- FALSE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
110 iwNormFun <- NULL |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
111 } 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
|
112 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
113 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
|
114 } 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
|
115 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
116 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
|
117 } 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
|
118 iwNorm <- TRUE |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
119 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
|
120 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
121 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
122 print(xset@filepaths) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
123 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 print(updated_filepaths) |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
128 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
|
129 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
|
130 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
|
131 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 } else { |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
137 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
|
138 } |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
139 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
140 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
141 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
|
142 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
|
143 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
144 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
|
145 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
146 print("choose class") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
147 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
|
148 } else { |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
149 ignore_files_class <- NA |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
150 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
151 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
152 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
|
153 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
|
154 filenames <- rownames(xset@phenoData) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
155 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
|
156 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
157 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
|
158 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
|
159 } else { |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
160 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
|
161 ignore_files <- NULL |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
162 } else { |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
163 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
|
164 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
165 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
166 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
167 print("ignore_files") |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
168 print(ignore_files) |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
169 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
170 |
8
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
171 ppLCMS <- msPurity::purityX( |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
172 xset = xset, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
173 offsets = c(minOffset, maxOffset), |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
174 cores = opt$cores, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
175 xgroups = xgroups, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
176 purityType = opt$purityType, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
177 ilim = opt$ilim, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
178 isotopes = isotopes, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
179 im = im, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
180 iwNorm = iwNorm, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
181 iwNormFun = iwNormFun, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
182 singleFile = opt$singleFile, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
183 fileignore = ignore_files, |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
184 rtrawColumns = rtraw_columns |
94a2b6571758
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents:
6
diff
changeset
|
185 ) |
0
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
186 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
187 dfp <- ppLCMS@predictions |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
188 |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
189 # 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
|
190 # (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
|
191 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
|
192 |
6
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) == "median"] <- "medianPurity" |
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) == "mean"] <- "meanPurity" |
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) == "sd"] <- "sdPurity" |
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) == "stde"] <- "sdePurity" |
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) == "RSD"] <- "cvPurity" |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
198 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
|
199 |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
200 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
|
201 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
|
202 } |
7f3183988100
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff
changeset
|
203 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
204 print(head(dfp)) |
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
205 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
|
206 |
6
18c0038dde9c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents:
0
diff
changeset
|
207 save.image(file.path(opt$out_dir, "purityX_output.RData")) |