changeset 33:4b29214f2d4c draft

planemo upload commit c6b2e31fccac66c2caa687b375cbf9947f7ba88e-dirty
author proteore
date Tue, 14 May 2019 09:36:23 -0400
parents f2c0a2b44841
children f078633d9669
files GO-enrich.R cluster_profiler.xml
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/GO-enrich.R	Mon Feb 18 11:25:59 2019 -0500
+++ b/GO-enrich.R	Tue May 14 09:36:23 2019 -0400
@@ -107,6 +107,15 @@
   }
 }
 
+clean_ids <- function(ids){
+  ids = gsub(" ","",ids)
+  ids = ids[which(ids!="")]
+  ids = ids[which(ids!="NA")]
+  ids = ids[!is.na(ids)]
+ 
+  return(ids) 
+}
+
 check_ids <- function(vector,type) {
   uniprot_pattern = "^([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})$"
   entrez_id = "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$"
@@ -179,7 +188,7 @@
   id_type = args$id_type
   
   if (input_type == "text") {
-    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$ncol
@@ -193,7 +202,7 @@
     file = read_file(filename, header)              # Extract Protein IDs list
     input =  unlist(sapply(as.character(file[,ncol]),function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE))
   }
-  
+  input = clean_ids(input)
   
   ## Get input gene list from input IDs
   #ID format Conversion 
@@ -222,7 +231,7 @@
     if (!is.null(args$universe_type)) {
       universe_type = args$universe_type
       if (universe_type == "text") {
-        universe = strsplit(args$universe, "[ \t\n]+")[[1]]
+        universe = unlist(strsplit(strsplit(args$input, "[ \t\n]+")[[1]],";"))
       } else if (universe_type == "file") {
         universe_filename = args$universe
         universe_ncol = args$uncol
@@ -238,6 +247,7 @@
         # Extract Protein IDs list
         universe <- unlist(sapply(universe_file[,universe_ncol], function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE))
       }
+      universe = clean_ids(input)
       universe_id_type = args$universe_id_type
       ##to initialize
       if (universe_id_type=="Uniprot" & any(check_ids(universe,"uniprot"))) {
--- a/cluster_profiler.xml	Mon Feb 18 11:25:59 2019 -0500
+++ b/cluster_profiler.xml	Tue May 14 09:36:23 2019 -0400
@@ -1,4 +1,4 @@
-<tool id="cluter_profiler" name="GO terms classification and enrichment analysis" version="2019.02.18">
+<tool id="cluter_profiler" name="GO terms classification and enrichment analysis" version="2019.05.14">
     <description>(Human, Mouse, Rat)[clusterProfiler]</description>
     <requirements>
         <requirement type="package" version="3.4.1">R</requirement>