changeset 12:f8d3a8a2f2e5 draft

"planemo upload commit 58e072579a4be282c00b54ebb88fbc59e189a7ed-dirty"
author proteore
date Thu, 23 Jan 2020 10:44:39 +0000
parents 4c27466a4e15
children 8ee4cfdc1a92
files add_expression_HPA.R add_expression_data.xml
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 @@
-<tool id="rna_abbased_data" name="Add expression data" version="2020.01.22.4">
+<tool id="rna_abbased_data" name="Add expression data" version="2020.01.23">
 <description> (RNAseq or Immuno-assays)[Human Protein Atlas]
 </description>
 <requirements>
@@ -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
 
 ]]></command>
@@ -67,12 +67,12 @@
           <option value="Gene description" selected="false">Gene description</option>
           <option value="Evidence">Evidence (at protein level, at transcript level or no evidence)</option>
           <option value="Antibody">Antibody reference</option>
-          <option value="RNA tissue category">RNA tissue category</option>
- 		      <option value="Reliability (IH)">IH detection level</option>
+          <option value="RNA tissue specificity">RNA tissue category</option>
+ 		  <option value="Reliability (IH)">IH detection level</option>
           <option value="Reliability (IF)">IF detection level</option>
           <option value="Subcellular location">Subcellular location</option>
-          <option value="RNA TS TPM">RNA tissue specificity abundance in 'Transcript Per Million'</option>
-          <option value="TPM max in non-specific">RNA non-specific tissue abundance in 'Transcript Per Million'</option>
+          <option value="RNA tissue specific NX">RNA tissue specificity abundance in 'Transcript Per Million'</option>
+          <option value="TPM max in non-specific">RNA non-specific tissue abundance in 'Transcript Per Million' (only for 23/10/2018 release)</option>
     </param>
   </section>