diff add_protein_features.R @ 5:bb4a5f1b415f draft

planemo upload commit f7974932f7ca782b9a5a8a092f84a0bb0f965e64-dirty
author proteore
date Mon, 11 Mar 2019 04:39:31 -0400
parents 759850de6ed2
children aca66c3b8fbb
line wrap: on
line diff
--- a/add_protein_features.R	Thu Dec 13 03:57:57 2018 -0500
+++ b/add_protein_features.R	Mon Mar 11 04:39:31 2019 -0400
@@ -1,6 +1,6 @@
 # Read file and return file content as data.frame
 read_file <- function(path,header){
-  file <- try(read.table(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="", check.names = F),silent=TRUE)
+  file <- try(read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="", check.names = F),silent=TRUE)
   if (inherits(file,"try-error")){
     stop("File not found !")
   }else{
@@ -136,8 +136,8 @@
 
   args <- get_args()  
   
-  #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/add_human_protein_features/args.rda")
-  #load("/home/dchristiany/proteore_project/ProteoRE/tools/add_human_protein_features/args.rda")
+  #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/add_protein_features/args.rda")
+  #load("/home/dchristiany/proteore_project/ProteoRE/tools/add_protein_features/args.rda")
   
   #setting variables
   inputtype = args$inputtype
@@ -194,6 +194,7 @@
     res = res[!duplicated(res$NextprotID),]
     output_content = merge(file, res,by.x=ncol,by.y="NextprotID",incomparables = NA,all.x=T)
     output_content = order_columns(output_content,ncol,id_type,file)
+    output_content = output_content[,-which(colnames(output_content)=="NextprotID")]      #remove nextprotID column
     output_content <- as.data.frame(apply(output_content, c(1,2), function(x) gsub("^$|^ $", NA, x)))  #convert "" et " " to NA
     write.table(output_content, output, row.names = FALSE, sep = "\t", quote = FALSE)
   }