comparison kegg_maps_visualization.R @ 1:6f389729a30b draft

planemo upload commit 93c44875036dbc9b3b9c1416566cf91004b97429-dirty
author proteore
date Thu, 31 Jan 2019 05:24:33 -0500
parents 9845dc9c7323
children dfceadc0b703
comparison
equal deleted inserted replaced
0:9845dc9c7323 1:6f389729a30b
6 options(warn=-1) #TURN OFF WARNINGS !!!!!! 6 options(warn=-1) #TURN OFF WARNINGS !!!!!!
7 suppressMessages(library("pathview")) 7 suppressMessages(library("pathview"))
8 suppressMessages(library(KEGGREST)) 8 suppressMessages(library(KEGGREST))
9 9
10 read_file <- function(path,header){ 10 read_file <- function(path,header){
11 file <- try(read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F, comment.char = "#"),silent=TRUE) 11 file <- try(read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F, comment.char = ""),silent=TRUE)
12 if (inherits(file,"try-error")){ 12 if (inherits(file,"try-error")){
13 stop("File not found !") 13 stop("Read file error ! Please check your file (header, # character, etc) ")
14 }else{ 14 }else{
15 return(file) 15 return(file)
16 } 16 }
17 } 17 }
18 18
73 string <- gsub("X","",string) 73 string <- gsub("X","",string)
74 return(string) 74 return(string)
75 } 75 }
76 76
77 get_list_from_cp <-function(list){ 77 get_list_from_cp <-function(list){
78 list = gsub(",","\t",list)
78 list = strsplit(list, "[ \t\n]+")[[1]] 79 list = strsplit(list, "[ \t\n]+")[[1]]
79 list = list[list != ""] #remove empty entry 80 list = list[list != ""] #remove empty entry
80 list = gsub("-.+", "", list) #Remove isoform accession number (e.g. "-2") 81 list = gsub("-.+", "", list) #Remove isoform accession number (e.g. "-2")
81 return(list) 82 return(list)
82 } 83 }