diff protein_features.R @ 6:fc0118aa432a draft

planemo upload commit 5221e042cb207f593b144ed857106235b8f5fbde-dirty
author proteore
date Tue, 20 Mar 2018 11:13:49 -0400
parents 867d47ff782c
children af7089d1c7c0
line wrap: on
line diff
--- a/protein_features.R	Wed Mar 14 12:04:32 2018 -0400
+++ b/protein_features.R	Tue Mar 20 11:13:49 2018 -0400
@@ -2,16 +2,16 @@
 readfile = function(filename, header) {
   if (header == "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)
+    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)
+    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 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]
   }
@@ -49,7 +49,7 @@
 
   inputtype = args$inputtype
   if (inputtype == "copypaste") {
-    input = strsplit(args$input, " ")[[1]]
+    input = strsplit(args$input, "[ \t\n]+")[[1]]
   }
   else if (inputtype == "tabfile") {
     filename = args$input
@@ -90,7 +90,7 @@
 
   # Select user input protein ids in nextprot
   if ((length(input[input %in% nextprot[,1]]))==0){
-    write.table("None of the input ids are can be found in Nextprot",file=filename,sep="\t",quote=FALSE,col.names=TRUE,row.names=FALSE)
+    write.table("None of the input ids are can be found in Nextprot",file=output,sep="\t",quote=FALSE,col.names=TRUE,row.names=FALSE)
   } else {
     names = c()
     res = matrix(nrow=length(input), ncol=0)
@@ -117,6 +117,7 @@
         res = cbind(res, info)
       }
     }
+    --inputtype="tabfile" --input="Galaxy50-[ID_Converter_on_data_47].tabular" --header='true' --natlas="proteinatlas.csv" --column='c7' --select='Gene,Gene.description,Evidence,RNA.tissue.category,Reliability.IH,TPM.max.in.non.specific' --output="test.txt"
 
     # Write output
     if (inputtype == "copypaste") {