diff purityA.R @ 1:0f646a3e0a3f draft

"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
author computational-metabolomics
date Thu, 05 Dec 2019 07:36:31 -0500
parents a141be614e76
children 6b9a83e08467
line wrap: on
line diff
--- a/purityA.R	Wed Nov 27 12:41:53 2019 -0500
+++ b/purityA.R	Thu Dec 05 07:36:31 2019 -0500
@@ -6,9 +6,9 @@
   make_option(c("-o", "--out_dir"), type="character"),
   make_option("--mzML_files", type="character"),
   make_option("--galaxy_names", type="character"),
-  make_option("--minOffset", default=0.5),
-  make_option("--maxOffset", default=0.5),
-  make_option("--ilim", default=0.05),
+  make_option("--minOffset", type="numeric"),
+  make_option("--maxOffset", type="numeric"),
+  make_option("--ilim", type="numeric"),
   make_option("--iwNorm", default="none", type="character"),
   make_option("--exclude_isotopes", action="store_true"),
   make_option("--isotope_matrix", type="character"),
@@ -22,18 +22,26 @@
 opt <- parse_args(OptionParser(option_list=option_list))
 print(opt)
 
-minOffset = as.numeric(opt$minOffset)
-maxOffset = as.numeric(opt$maxOffset)
 
 if (opt$iwNorm=='none'){
     iwNorm = FALSE
     iwNormFun = NULL
 }else if (opt$iwNorm=='gauss'){
     iwNorm = TRUE
-    iwNormFun = msPurity::iwNormGauss(minOff=-minOffset, maxOff=maxOffset)
+    if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
+      print('User has to define offsets if using Gaussian normalisation')
+    }else{
+      iwNormFun = msPurity::iwNormGauss(minOff=-as.numeric(opt$minOffset), 
+                                      maxOff=as.numeric(opt$maxOffset))
+    }
 }else if (opt$iwNorm=='rcosine'){
     iwNorm = TRUE
-    iwNormFun = msPurity::iwNormRcosine(minOff=-minOffset, maxOff=maxOffset)
+    if (is.null(opt$minOffset) || is.null(opt$maxOffset)){
+      print('User has to define offsets if using R-cosine normalisation')
+    }else{
+      iwNormFun = msPurity::iwNormRcosine(minOff=-as.numeric(opt$minOffset), 
+                                          maxOff=as.numeric(opt$maxOffset))
+    }
 }else if (opt$iwNorm=='QE5'){
     iwNorm = TRUE
     iwNormFun = msPurity::iwNormQE.5()