changeset 4:710414ebb6db draft

planemo upload commit 0a42c3d46be24406936ca0036bb436e6e2524fd2-dirty
author proteore
date Tue, 20 Mar 2018 08:59:51 -0400
parents ad1244024bd8
children 8a91f58782df
files GO-enrich.R cluster_profiler.xml
diffstat 2 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/GO-enrich.R	Wed Mar 14 12:40:35 2018 -0400
+++ b/GO-enrich.R	Tue Mar 20 08:59:51 2018 -0400
@@ -4,20 +4,21 @@
 library(org.Hs.eg.db)
 library(org.Mm.eg.db)
 
-# Read file and return file content as data.frame?
+# Read file and return file content as data.frame
 readfile = function(filename, header) {
   if (header == "true") {
-    # Read only the first line of the files as data (without headers):
-    headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
-    #Read the data of the files (skipping the first row):
-    file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
+    # Read only first line of the file as header:
+    headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
+    #Read the data of the files (skipping the first row)
+    file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
     # Remove empty rows
     file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
-    #And assign the headers of step two to the data:
+    #And assign the header to the data
     names(file) <- headers
   }
   else {
-    file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
+    file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
+    # Remove empty rows
     file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
   }
   return(file)
@@ -92,7 +93,7 @@
 
   input_type = args$input_type
   if (input_type == "text") {
-    input = args$input
+    input = strsplit(args$input, "[ \t\n]+")[[1]]
   }
   else if (input_type == "file") {
     filename = args$input
--- a/cluster_profiler.xml	Wed Mar 14 12:40:35 2018 -0400
+++ b/cluster_profiler.xml	Tue Mar 20 08:59:51 2018 -0400
@@ -13,7 +13,7 @@
         Rscript "$__tool_directory__/GO-enrich.R"
         #if $input.ids == "text"
             --input_type="text"
-            --input="$input.text"
+            --input="$input.txt"
         #else
             --input_type="file"
             --input="$input.file"