comparison purityA.R @ 1:600a866a510c draft

"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
author computational-metabolomics
date Thu, 05 Dec 2019 07:45:02 -0500
parents f52287a06c02
children 2f71b3495221
comparison
equal deleted inserted replaced
0:f52287a06c02 1:600a866a510c
4 4
5 option_list <- list( 5 option_list <- list(
6 make_option(c("-o", "--out_dir"), type="character"), 6 make_option(c("-o", "--out_dir"), type="character"),
7 make_option("--mzML_files", type="character"), 7 make_option("--mzML_files", type="character"),
8 make_option("--galaxy_names", type="character"), 8 make_option("--galaxy_names", type="character"),
9 make_option("--minOffset", default=0.5), 9 make_option("--minOffset", type="numeric"),
10 make_option("--maxOffset", default=0.5), 10 make_option("--maxOffset", type="numeric"),
11 make_option("--ilim", default=0.05), 11 make_option("--ilim", type="numeric"),
12 make_option("--iwNorm", default="none", type="character"), 12 make_option("--iwNorm", default="none", type="character"),
13 make_option("--exclude_isotopes", action="store_true"), 13 make_option("--exclude_isotopes", action="store_true"),
14 make_option("--isotope_matrix", type="character"), 14 make_option("--isotope_matrix", type="character"),
15 make_option("--mostIntense", action="store_true"), 15 make_option("--mostIntense", action="store_true"),
16 make_option("--plotP", action="store_true"), 16 make_option("--plotP", action="store_true"),
20 ) 20 )
21 21
22 opt <- parse_args(OptionParser(option_list=option_list)) 22 opt <- parse_args(OptionParser(option_list=option_list))
23 print(opt) 23 print(opt)
24 24
25 minOffset = as.numeric(opt$minOffset)
26 maxOffset = as.numeric(opt$maxOffset)
27 25
28 if (opt$iwNorm=='none'){ 26 if (opt$iwNorm=='none'){
29 iwNorm = FALSE 27 iwNorm = FALSE
30 iwNormFun = NULL 28 iwNormFun = NULL
31 }else if (opt$iwNorm=='gauss'){ 29 }else if (opt$iwNorm=='gauss'){
32 iwNorm = TRUE 30 iwNorm = TRUE
33 iwNormFun = msPurity::iwNormGauss(minOff=-minOffset, maxOff=maxOffset) 31 if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
32 print('User has to define offsets if using Gaussian normalisation')
33 }else{
34 iwNormFun = msPurity::iwNormGauss(minOff=-as.numeric(opt$minOffset),
35 maxOff=as.numeric(opt$maxOffset))
36 }
34 }else if (opt$iwNorm=='rcosine'){ 37 }else if (opt$iwNorm=='rcosine'){
35 iwNorm = TRUE 38 iwNorm = TRUE
36 iwNormFun = msPurity::iwNormRcosine(minOff=-minOffset, maxOff=maxOffset) 39 if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
40 print('User has to define offsets if using R-cosine normalisation')
41 }else{
42 iwNormFun = msPurity::iwNormRcosine(minOff=-as.numeric(opt$minOffset),
43 maxOff=as.numeric(opt$maxOffset))
44 }
37 }else if (opt$iwNorm=='QE5'){ 45 }else if (opt$iwNorm=='QE5'){
38 iwNorm = TRUE 46 iwNorm = TRUE
39 iwNormFun = msPurity::iwNormQE.5() 47 iwNormFun = msPurity::iwNormQE.5()
40 } 48 }
41 49