# HG changeset patch # User proteore # Date 1579776279 0 # Node ID f8d3a8a2f2e51b671a5296f94f8c89ab7f656474 # Parent 4c27466a4e15e17cef5ff2d5f77020d638ae2f28 "planemo upload commit 58e072579a4be282c00b54ebb88fbc59e189a7ed-dirty" diff -r 4c27466a4e15 -r f8d3a8a2f2e5 add_expression_HPA.R --- a/add_expression_HPA.R Wed Jan 22 15:33:21 2020 +0000 +++ b/add_expression_HPA.R Thu Jan 23 10:44:39 2020 +0000 @@ -1,7 +1,11 @@ # Read file and return file content as data.frame read_file <- function(path,header){ - file <- read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F) - return(file) + 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{ + return(file) + } } #convert a string to boolean @@ -142,6 +146,13 @@ } } +convert_to_previous_header <- function(options){ + header = c('Gene','description','Evidence','Antibody','RNA tissue specificity','Reliability (IH)','Reliability (IF)','Subcellular location','RNA tissue specific NX') + names(header) = c('Gene','description','Evidence','Antibody','RNA tissue category','Reliability (IH)','Reliability (IF)','Subcellular location','RNA TS TPM') + options = names(header[which(header %in% options)]) + return(options) +} + main = function() { args = get_args() @@ -176,6 +187,7 @@ # Add expression output = args$output options = strsplit(args$select, ",")[[1]] + if (tail(unlist(strsplit(args$atlas,"/")),1) == "HPA_full_atlas_23-10-2018.tsv"){ options = convert_to_previous_header(options)} res = add_expression(ids, protein_atlas, options) # Write output diff -r 4c27466a4e15 -r f8d3a8a2f2e5 add_expression_data.xml --- a/add_expression_data.xml Wed Jan 22 15:33:21 2020 +0000 +++ b/add_expression_data.xml Thu Jan 23 10:44:39 2020 +0000 @@ -1,4 +1,4 @@ - + (RNAseq or Immuno-assays)[Human Protein Atlas] @@ -23,9 +23,9 @@ #end if #if "protein_atlas" in str($ref_file).split("/") - --hpa_ref="$ref_file" + --atlas="$ref_file" #else - --hpa_ref="$__tool_directory__/$ref_file" + --atlasf="$__tool_directory__/$ref_file" #end if ]]> @@ -67,12 +67,12 @@ - - + + - - + +