annotate purityX.R @ 8:75b761fbacc0 draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
author computational-metabolomics
date Wed, 12 Jun 2024 16:05:52 +0000
parents 090775983be7
children 548fed2ef792
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
1 library(msPurity)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
2 library(optparse)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
3 print(sessionInfo())
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
4
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
5 option_list <- list(
6
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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),
090775983be7 "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),
090775983be7 "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),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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),
090775983be7 "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),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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"),
090775983be7 "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
75b761fbacc0 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
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
26 )
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
27
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
28
6
090775983be7 "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
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
30 print(opt)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
31
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
32
6
090775983be7 "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
75b761fbacc0 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]])
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
35 } else {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
36 xgroups <- NULL
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
37 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
38
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
39
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
40 print(xgroups)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
41
6
090775983be7 "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)) {
090775983be7 "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
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
44 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
45
6
090775983be7 "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
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
47 im <- NULL
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
48 } else {
75b761fbacc0 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,
75b761fbacc0 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
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
51 )
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
52 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
53
6
090775983be7 "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
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
55 isotopes <- FALSE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
56 } else {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
57 isotopes <- TRUE
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
58 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
59
6
090775983be7 "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
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
61 rtraw_columns <- FALSE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
62 } else {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
63 rtraw_columns <- TRUE
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
64 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
65
6
090775983be7 "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
75b761fbacc0 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
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
68 load(rdata_path)
75b761fbacc0 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]))
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
70 }
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
71
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
72
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
73
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
74
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
75 getxcmsSetObject <- function(xobject) {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
76 # XCMS 1.x
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
77 if (class(xobject) == "xcmsSet") {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
78 return(xobject)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
79 }
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
80 # XCMS 3.x
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
81 if (class(xobject) == "XCMSnExp") {
75b761fbacc0 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
75b761fbacc0 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"))
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
84 sampclass(xset) <- xset@phenoData$sample_group
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
85 return(xset)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
86 }
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
87 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
88
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
89 target_obj <- loadRData(opt$xset_path, opt$rdata_name)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
90
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
91 if (opt$camera_xcms == "camera") {
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
92 xset <- target_obj@xcmsSet
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
93 } else {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
94 xset <- target_obj
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
95 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
96
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
97 xset <- getxcmsSetObject(xset)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
98
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
99 print(xset)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
100
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
101 minOffset <- as.numeric(opt$minOffset)
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
102 maxOffset <- as.numeric(opt$maxOffset)
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
103
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
104 if (opt$iwNorm == "none") {
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
105 iwNorm <- FALSE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
106 iwNormFun <- NULL
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
107 } else if (opt$iwNorm == "gauss") {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
108 iwNorm <- TRUE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
109 iwNormFun <- msPurity::iwNormGauss(minOff = -minOffset, maxOff = maxOffset)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
110 } else if (opt$iwNorm == "rcosine") {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
111 iwNorm <- TRUE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
112 iwNormFun <- msPurity::iwNormRcosine(minOff = -minOffset, maxOff = maxOffset)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
113 } else if (opt$iwNorm == "QE5") {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
114 iwNorm <- TRUE
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
115 iwNormFun <- msPurity::iwNormQE.5()
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
116 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
117
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
118 print(xset@filepaths)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
119
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
120 if (!is.null(opt$files)) {
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
121 updated_filepaths <- trimws(strsplit(opt$files, ",")[[1]])
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
122 updated_filepaths <- updated_filepaths[updated_filepaths != ""]
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
123 print(updated_filepaths)
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
124 updated_filenames <- basename(updated_filepaths)
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
125 original_filenames <- basename(xset@filepaths)
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
126 update_idx <- match(updated_filenames, original_filenames)
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
127
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
128 if (!is.null(opt$galaxy_files)) {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
129 galaxy_files <- trimws(strsplit(opt$galaxy_files, ",")[[1]])
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
130 galaxy_files <- galaxy_files[galaxy_files != ""]
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
131 xset@filepaths <- galaxy_files[update_idx]
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
132 } else {
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
133 xset@filepaths <- updated_filepaths[update_idx]
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
134 }
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
135 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
136
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
137 if (!is.null(opt$choose_class)) {
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
138 classes <- trimws(strsplit(opt$choose_class, ",")[[1]])
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
139
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
140 ignore_files_class <- which(!as.character(xset@phenoData$class) %in% classes)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
141
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
142 print("choose class")
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
143 print(ignore_files_class)
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
144 } else {
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
145 ignore_files_class <- NA
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
146 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
147
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
148 if (!is.null(opt$ignore_files)) {
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
149 ignore_files_string <- trimws(strsplit(opt$ignore_files, ",")[[1]])
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
150 filenames <- rownames(xset@phenoData)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
151 ignore_files <- which(filenames %in% ignore_files_string)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
152
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
153 ignore_files <- unique(c(ignore_files, ignore_files_class))
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
154 ignore_files <- ignore_files[ignore_files != ""]
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
155 } else {
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
156 if (anyNA(ignore_files_class)) {
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
157 ignore_files <- NULL
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
158 } else {
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
159 ignore_files <- ignore_files_class
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
160 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
161 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
162
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
163 print("ignore_files")
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
164 print(ignore_files)
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
165
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
166
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
167 ppLCMS <- msPurity::purityX(
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
168 xset = xset,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
169 offsets = c(minOffset, maxOffset),
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
170 cores = opt$cores,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
171 xgroups = xgroups,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
172 purityType = opt$purityType,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
173 ilim = opt$ilim,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
174 isotopes = isotopes,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
175 im = im,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
176 iwNorm = iwNorm,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
177 iwNormFun = iwNormFun,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
178 singleFile = opt$singleFile,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
179 fileignore = ignore_files,
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
180 rtrawColumns = rtraw_columns
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
181 )
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
182
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
183 dfp <- ppLCMS@predictions
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
184
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
185 # to make compatable with deconrank
8
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
186 # (keep grpid for other compatibility)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
187 dfp <- data.frame("peakID"=dfp$grpid, dfp)
75b761fbacc0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7e1748612a9f9dce11a9e54ff36752b600e7aea3
computational-metabolomics
parents: 6
diff changeset
188
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
189 colnames(dfp)[colnames(dfp) == "median"] <- "medianPurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
190 colnames(dfp)[colnames(dfp) == "mean"] <- "meanPurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
191 colnames(dfp)[colnames(dfp) == "sd"] <- "sdPurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
192 colnames(dfp)[colnames(dfp) == "stde"] <- "sdePurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
193 colnames(dfp)[colnames(dfp) == "RSD"] <- "cvPurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
194 colnames(dfp)[colnames(dfp) == "pknm"] <- "pknmPurity"
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
195
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
196 if (sum(is.na(dfp$medianPurity)) > 0) {
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
197 dfp[is.na(dfp$medianPurity), ]$medianPurity <- 0
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
198 }
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
199
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
200 print(head(dfp))
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
201 write.table(dfp, file.path(opt$out_dir, "purityX_output.tsv"), row.names = FALSE, sep = "\t")
0
e96082a25ff0 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
202
6
090775983be7 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
computational-metabolomics
parents: 0
diff changeset
203 save.image(file.path(opt$out_dir, "purityX_output.RData"))