comparison 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
comparison
equal deleted inserted replaced
13:0b279190f90d 14:133309fd6875
144 cat(paste(sep = "", collapse = " ", c("Column",ncol,"not found in file") )) 144 cat(paste(sep = "", collapse = " ", c("Column",ncol,"not found in file") ))
145 stopQuietly() 145 stopQuietly()
146 } 146 }
147 } 147 }
148 148
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','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','TPM max in non-specific')
152 options = names(header[which(header %in% options)])
153 return(options)
154 }
155
149 main = function() { 156 main = function() {
150 157
151 args = get_args() 158 args = get_args()
152 159
153 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/add_expression_data_HPA/args.rda") 160 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/add_expression_data_HPA/args.rda")
173 ids = ids[which(!is.na(ids))] 180 ids = ids[which(!is.na(ids))]
174 } 181 }
175 check_ensembl_geneids(ids) 182 check_ensembl_geneids(ids)
176 183
177 # Read protein atlas 184 # Read protein atlas
178 protein_atlas = args$atlas 185 protein_atlas = read_file(args$atlas, T)
179 protein_atlas = read_file(protein_atlas, T)
180 186
181 # Add expression 187 # Add expression
182 output = args$output 188 output = args$output
183 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"){
191 options = convert_to_previous_header(options)
192 } else {
193 options = options[which(options != 'TPM max in non-specific')]
194 }
184 res = add_expression(ids, protein_atlas, options) 195 res = add_expression(ids, protein_atlas, options)
185 196
186 # Write output 197 # Write output
187 if (is.null(res)) { 198 if (is.null(res)) {
188 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)