annotate purityA.R @ 1:61ebae7e09f5 draft

"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
author computational-metabolomics
date Thu, 05 Dec 2019 07:41:05 -0500
parents ab65999a5430
children d4a17be5429a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
1 library(msPurity)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
2 library(optparse)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
3 print(sessionInfo())
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
4
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
5 option_list <- list(
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
6 make_option(c("-o", "--out_dir"), type="character"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
7 make_option("--mzML_files", type="character"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
8 make_option("--galaxy_names", type="character"),
1
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
9 make_option("--minOffset", type="numeric"),
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
10 make_option("--maxOffset", type="numeric"),
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
11 make_option("--ilim", type="numeric"),
0
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
12 make_option("--iwNorm", default="none", type="character"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
13 make_option("--exclude_isotopes", action="store_true"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
14 make_option("--isotope_matrix", type="character"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
15 make_option("--mostIntense", action="store_true"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
16 make_option("--plotP", action="store_true"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
17 make_option("--nearest", action="store_true"),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
18 make_option("--cores", default=4),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
19 make_option("--ppmInterp", default=7)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
20 )
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
21
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
22 opt <- parse_args(OptionParser(option_list=option_list))
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
23 print(opt)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
24
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
25
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
26 if (opt$iwNorm=='none'){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
27 iwNorm = FALSE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
28 iwNormFun = NULL
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
29 }else if (opt$iwNorm=='gauss'){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
30 iwNorm = TRUE
1
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
31 if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
32 print('User has to define offsets if using Gaussian normalisation')
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
33 }else{
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
34 iwNormFun = msPurity::iwNormGauss(minOff=-as.numeric(opt$minOffset),
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
35 maxOff=as.numeric(opt$maxOffset))
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
36 }
0
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
37 }else if (opt$iwNorm=='rcosine'){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
38 iwNorm = TRUE
1
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
39 if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
40 print('User has to define offsets if using R-cosine normalisation')
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
41 }else{
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
42 iwNormFun = msPurity::iwNormRcosine(minOff=-as.numeric(opt$minOffset),
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
43 maxOff=as.numeric(opt$maxOffset))
61ebae7e09f5 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
computational-metabolomics
parents: 0
diff changeset
44 }
0
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
45 }else if (opt$iwNorm=='QE5'){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
46 iwNorm = TRUE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
47 iwNormFun = msPurity::iwNormQE.5()
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
48 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
49
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
50 filepaths <- trimws(strsplit(opt$mzML_files, ',')[[1]])
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
51 filepaths <- filepaths[filepaths != ""]
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
52
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
53
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
54
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
55 if(is.null(opt$minOffset) || is.null(opt$maxOffset)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
56 offsets = NA
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
57 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
58 offsets = as.numeric(c(opt$minOffset, opt$maxOffset))
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
59 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
60
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
61
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
62 if(is.null(opt$mostIntense)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
63 mostIntense = FALSE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
64 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
65 mostIntense = TRUE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
66 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
67
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
68 if(is.null(opt$nearest)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
69 nearest = FALSE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
70 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
71 nearest = TRUE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
72 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
73
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
74 if(is.null(opt$plotP)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
75 plotP = FALSE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
76 plotdir = NULL
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
77 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
78 plotP = TRUE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
79 plotdir = opt$out_dir
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
80 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
81
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
82
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
83 if (is.null(opt$isotope_matrix)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
84 im <- NULL
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
85 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
86 im <- read.table(opt$isotope_matrix,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
87 header = TRUE, sep='\t', stringsAsFactors = FALSE)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
88 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
89
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
90 if (is.null(opt$exclude_isotopes)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
91 isotopes <- FALSE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
92 }else{
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
93 isotopes <- TRUE
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
94 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
95
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
96 pa <- msPurity::purityA(filepaths,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
97 cores = opt$cores,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
98 mostIntense = mostIntense,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
99 nearest = nearest,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
100 offsets = offsets,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
101 plotP = plotP,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
102 plotdir = plotdir,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
103 interpol = "linear",
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
104 iwNorm = iwNorm,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
105 iwNormFun = iwNormFun,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
106 ilim = opt$ilim,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
107 mzRback = "pwiz",
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
108 isotopes = isotopes,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
109 im = im,
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
110 ppmInterp = opt$ppmInterp)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
111
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
112
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
113 if (!is.null(opt$galaxy_names)){
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
114 galaxy_names <- trimws(strsplit(opt$galaxy_names, ',')[[1]])
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
115 galaxy_names <- galaxy_names[galaxy_names != ""]
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
116 names(pa@fileList) <- galaxy_names
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
117 }
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
118
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
119 print(pa)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
120 save(pa, file=file.path(opt$out_dir, 'purityA_output.RData'))
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
121
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
122 pa@puritydf$filename <- sapply(pa@puritydf$fileid, function(x) names(pa@fileList)[as.integer(x)])
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
123
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
124 print(head(pa@puritydf))
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
125 write.table(pa@puritydf, file.path(opt$out_dir, 'purityA_output.tsv'), row.names=FALSE, sep='\t')
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
126
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
127 # removed_peaks <- data.frame(removed_peaks)
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
128 # write.table(data.frame('ID'=rownames(removed_peaks),removed_peaks),
ab65999a5430 "planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
computational-metabolomics
parents:
diff changeset
129 # file.path(opt$out_dir, 'removed_peaks.txt'), row.names=FALSE, sep='\t')