Mercurial > repos > proteore > proteore_expression_levels_by_tissue
diff get_expression_profiles.R @ 12:56c93d1fc8fd draft
planemo upload commit 4ba1ebe7b3f5e3fabf78b5fed7ed0b92e2cbf9e5-dirty
author | proteore |
---|---|
date | Fri, 28 Jun 2019 05:10:08 -0400 |
parents | 2c0bab71a436 |
children |
line wrap: on
line diff
--- a/get_expression_profiles.R Wed Mar 13 09:30:12 2019 -0400 +++ b/get_expression_profiles.R Fri Jun 28 05:10:08 2019 -0400 @@ -69,6 +69,15 @@ return(res) } +clean_ids <- function(ids){ + + ids = gsub(" ","",ids) + ids = ids[which(ids!="")] + ids = ids[which(ids!="NA")] + ids = ids[!is.na(ids)] + + return(ids) +} main <- function() { args <- commandArgs(TRUE) @@ -109,16 +118,17 @@ # Extract input input_type = args$input_type if (input_type == "list") { - list_id = strsplit(args$input, "[ \t\n]+")[[1]] + ids = unlist(strsplit(strsplit(args$input, "[ \t\n]+")[[1]],";")) } else if (input_type == "file") { filename = args$input column_number = as.numeric(gsub("c", "" ,args$column_number)) header = str2bool(args$header) file = read_file(filename, header) - list_id = sapply(strsplit(file[,column_number], ";"), "[", 1) + ids = unlist(strsplit(file[,column_number], ";")) } - input = list_id - + #filter ids + ids = clean_ids(ids) + # Read reference file reference_file = read_file(args$ref_file, TRUE) @@ -130,11 +140,11 @@ level = strsplit(args$level, ",")[[1]] reliability = strsplit(args$reliability, ",")[[1]] # Calculation - res = annot.HPAnorm(input, reference_file, tissue, level, reliability, not_mapped_option) + res = annot.HPAnorm(ids, reference_file, tissue, level, reliability, not_mapped_option) } else if (atlas=="cancer") { cancer = strsplit(args$cancer, ",")[[1]] # Calculation - res = annot.HPAcancer(input, reference_file, cancer, not_mapped_option) + res = annot.HPAcancer(ids, reference_file, cancer, not_mapped_option) } # Write output