# HG changeset patch # User proteore # Date 1557840983 14400 # Node ID 4b29214f2d4c5b1086d06fe2104c704929495e01 # Parent f2c0a2b448410be0eed655fb11938ef80d1a67fa planemo upload commit c6b2e31fccac66c2caa687b375cbf9947f7ba88e-dirty diff -r f2c0a2b44841 -r 4b29214f2d4c GO-enrich.R --- a/GO-enrich.R Mon Feb 18 11:25:59 2019 -0500 +++ b/GO-enrich.R Tue May 14 09:36:23 2019 -0400 @@ -107,6 +107,15 @@ } } +clean_ids <- function(ids){ + ids = gsub(" ","",ids) + ids = ids[which(ids!="")] + ids = ids[which(ids!="NA")] + ids = ids[!is.na(ids)] + + return(ids) +} + check_ids <- function(vector,type) { uniprot_pattern = "^([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})$" entrez_id = "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$" @@ -179,7 +188,7 @@ id_type = args$id_type if (input_type == "text") { - input = strsplit(args$input, "[ \t\n]+")[[1]] + input = unlist(strsplit(strsplit(args$input, "[ \t\n]+")[[1]],";")) } else if (input_type == "file") { filename = args$input ncol = args$ncol @@ -193,7 +202,7 @@ file = read_file(filename, header) # Extract Protein IDs list input = unlist(sapply(as.character(file[,ncol]),function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE)) } - + input = clean_ids(input) ## Get input gene list from input IDs #ID format Conversion @@ -222,7 +231,7 @@ if (!is.null(args$universe_type)) { universe_type = args$universe_type if (universe_type == "text") { - universe = strsplit(args$universe, "[ \t\n]+")[[1]] + universe = unlist(strsplit(strsplit(args$input, "[ \t\n]+")[[1]],";")) } else if (universe_type == "file") { universe_filename = args$universe universe_ncol = args$uncol @@ -238,6 +247,7 @@ # Extract Protein IDs list universe <- unlist(sapply(universe_file[,universe_ncol], function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE)) } + universe = clean_ids(input) universe_id_type = args$universe_id_type ##to initialize if (universe_id_type=="Uniprot" & any(check_ids(universe,"uniprot"))) { diff -r f2c0a2b44841 -r 4b29214f2d4c cluster_profiler.xml --- a/cluster_profiler.xml Mon Feb 18 11:25:59 2019 -0500 +++ b/cluster_profiler.xml Tue May 14 09:36:23 2019 -0400 @@ -1,4 +1,4 @@ - + (Human, Mouse, Rat)[clusterProfiler] R