comparison kegg_maps_visualization.R @ 6:eb140217a9f1 draft default tip

"planemo upload commit 1f9a98db2496834cc38a281cbe3d4b11de2bc3d2-dirty"
author proteore
date Thu, 05 Mar 2020 10:10:20 -0500
parents 8e611bdc96ec
children
comparison
equal deleted inserted replaced
5:4a3056be0774 6:eb140217a9f1
170 } 170 }
171 return(res) 171 return(res)
172 } 172 }
173 173
174 get_limit <- function(mat) { 174 get_limit <- function(mat) {
175 min = min(apply(mat,2,min)) 175 min = min(apply(mat,2,min,na.rm=TRUE))
176 max = max(apply(mat,2,max)) 176 max = max(apply(mat,2,max,na.rm=TRUE))
177 return(c(min,max)) 177 return(c(min,max))
178 }
179
180 check_pathway_ids<- function(pathways_ids) {
181 problematic_pathways <- c("04215","04723")
182 to_remove <- intersect(pathways_ids,problematic_pathways)
183 if (length(to_remove) > 0){ print(paste("Pathway(s)",to_remove,"have been remove from input")) }
184 pathways_ids <- pathways_ids[which(!pathways_ids %in% problematic_pathways)]
185 if (length(pathways_ids) == 0){stop("No pathways ids to process")}
186 return (pathways_ids)
178 } 187 }
179 188
180 get_args <- function(){ 189 get_args <- function(){
181 190
182 ## Collect arguments 191 ## Collect arguments
236 header2 <- str2bool(args$header2) 245 header2 <- str2bool(args$header2)
237 pathway_col <- as.numeric(gsub("c", "" ,args$pathway_col)) 246 pathway_col <- as.numeric(gsub("c", "" ,args$pathway_col))
238 pathways_file = read_file(args$pathways_input,header2) 247 pathways_file = read_file(args$pathways_input,header2)
239 ids <- sapply(rapply(strsplit(clean_bad_character(pathways_file[,pathway_col]),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE) 248 ids <- sapply(rapply(strsplit(clean_bad_character(pathways_file[,pathway_col]),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)
240 } 249 }
241 if (args$native_kegg) { ids <- ids[ids != "04215"] } 250 if (args$native_kegg) {ids = check_pathway_ids(ids)} #remove problematic pathways
242 pathways_list <- read_file(args$pathways_list,F) 251 pathways_list <- read_file(args$pathways_list,F)
243 if (!is.null(args$id_list)) { 252 if (!is.null(args$id_list)) {
244 id_list <- get_list_from_cp(args$id_list) 253 id_list <- get_list_from_cp(args$id_list)
245 } 254 }
246 id_type <- tolower(args$id_type) 255 id_type <- tolower(args$id_type)