comparison add_expression_HPA.R @ 13:8ee4cfdc1a92 draft

"planemo upload commit 58e072579a4be282c00b54ebb88fbc59e189a7ed-dirty"
author proteore
date Thu, 23 Jan 2020 11:02:34 +0000
parents f8d3a8a2f2e5
children 778f7281ccba
comparison
equal deleted inserted replaced
12:f8d3a8a2f2e5 13:8ee4cfdc1a92
145 stopQuietly() 145 stopQuietly()
146 } 146 }
147 } 147 }
148 148
149 convert_to_previous_header <- function(options){ 149 convert_to_previous_header <- function(options){
150 header = c('Gene','description','Evidence','Antibody','RNA tissue specificity','Reliability (IH)','Reliability (IF)','Subcellular location','RNA tissue specific NX') 150 header = c('Gene','description','Evidence','Antibody','RNA tissue specificity','Reliability (IH)','Reliability (IF)','Subcellular location','RNA tissue specific NX','TPM max in non-specific')
151 names(header) = c('Gene','description','Evidence','Antibody','RNA tissue category','Reliability (IH)','Reliability (IF)','Subcellular location','RNA TS TPM') 151 names(header) = c('Gene','description','Evidence','Antibody','RNA tissue category','Reliability (IH)','Reliability (IF)','Subcellular location','RNA TS TPM','TPM max in non-specific')
152 options = names(header[which(header %in% options)]) 152 options = names(header[which(header %in% options)])
153 return(options) 153 return(options)
154 } 154 }
155 155
156 main = function() { 156 main = function() {
185 protein_atlas = read_file(args$atlas, T) 185 protein_atlas = read_file(args$atlas, T)
186 186
187 # Add expression 187 # Add expression
188 output = args$output 188 output = args$output
189 options = strsplit(args$select, ",")[[1]] 189 options = strsplit(args$select, ",")[[1]]
190 if (tail(unlist(strsplit(args$atlas,"/")),1) == "HPA_full_atlas_23-10-2018.tsv"){ options = convert_to_previous_header(options)} 190 if (tail(unlist(strsplit(args$atlas,"/")),1) == "HPA_full_atlas_23-10-2018.tsv"){
191 options = convert_to_previous_header(options)
192 } else {
193 options[which(options != 'TPM max in non-specific')]
194 }
191 res = add_expression(ids, protein_atlas, options) 195 res = add_expression(ids, protein_atlas, options)
192 196
193 # Write output 197 # Write output
194 if (is.null(res)) { 198 if (is.null(res)) {
195 write.table("None of the ENSG ids entered can be found in HPA data file",file=output,sep="\t",quote=FALSE,col.names=TRUE,row.names=FALSE) 199 write.table("None of the ENSG ids entered can be found in HPA data file",file=output,sep="\t",quote=FALSE,col.names=TRUE,row.names=FALSE)