diff Get_ms-ms_observations.R @ 7:3e9ea4797b00 draft

planemo upload commit 4ba1ebe7b3f5e3fabf78b5fed7ed0b92e2cbf9e5-dirty
author proteore
date Fri, 28 Jun 2019 05:10:43 -0400
parents e77c0f3e9bab
children 14c890ff105a
line wrap: on
line diff
--- a/Get_ms-ms_observations.R	Thu May 02 05:08:06 2019 -0400
+++ b/Get_ms-ms_observations.R	Fri Jun 28 05:10:43 2019 -0400
@@ -76,6 +76,16 @@
   return (c(date,tissue,file_name,path))
 }
 
+clean_ids <- function(ids){
+  
+  ids = gsub(" ","",ids)
+  ids = ids[which(ids!="")]
+  ids = ids[which(ids!="NA")]
+  ids = ids[!is.na(ids)]
+ 
+  return(ids) 
+}
+
 main = function() {
   args <- commandArgs(TRUE)
   if(length(args)<1) {
@@ -105,7 +115,7 @@
   # Extract input
   input_type = args$input_type
   if (input_type == "list") {
-    input = strsplit(args$input, "[ \t\n]+")[[1]]
+    input = unlist(strsplit(strsplit(args$input, "[ \t\n]+")[[1]],";"))
   } else if (input_type == "file") {
     filename = args$input
     ncol = args$column
@@ -120,7 +130,7 @@
     file = one_id_one_line(file,ncol) #only one id per line
     input = sapply(file[,ncol],function(x) strsplit(as.character(x),";")[[1]][1],USE.NAMES = F)
   }
-  
+  input = clean_ids(input)
   output = args$output
   
   #data_frame building