diff add_expression_HPA.R @ 14:133309fd6875 draft

"planemo upload commit c4edbc8a0ffd86395f088cb5b6592f77db658ac7"
author proteore
date Fri, 24 Jan 2020 04:22:48 -0500
parents dbeabf9bf091
children 208b87582b4c
line wrap: on
line diff
--- a/add_expression_HPA.R	Fri Jun 28 05:01:37 2019 -0400
+++ b/add_expression_HPA.R	Fri Jan 24 04:22:48 2020 -0500
@@ -146,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','TPM max in non-specific')
+    names(header) = c('Gene','description','Evidence','Antibody','RNA tissue category','Reliability (IH)','Reliability (IF)','Subcellular location','RNA TS TPM','TPM max in non-specific')
+    options = names(header[which(header %in% options)])
+    return(options)
+}
+
 main = function() {
   
   args = get_args()
@@ -175,12 +182,16 @@
   check_ensembl_geneids(ids)
 
   # Read protein atlas
-  protein_atlas = args$atlas
-  protein_atlas = read_file(protein_atlas, T)
+  protein_atlas = read_file(args$atlas, T)
 
   # 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)
+  } else {
+      options = options[which(options != 'TPM max in non-specific')]
+      }
   res = add_expression(ids, protein_atlas, options)
   
   # Write output