Mercurial > repos > proteore > proteore_expression_rnaseq_abbased
comparison add_expression_HPA.R @ 10:07858c6dbbff draft
"planemo upload commit 330a2527c7e20c4d189a0f1b7a184a8c4610b4b6-dirty"
| author | proteore |
|---|---|
| date | Wed, 22 Jan 2020 15:26:11 +0000 |
| parents | 28d51adf8292 |
| children | f8d3a8a2f2e5 |
comparison
equal
deleted
inserted
replaced
| 9:28d51adf8292 | 10:07858c6dbbff |
|---|---|
| 1 # Read file and return file content as data.frame | 1 # Read file and return file content as data.frame |
| 2 read_file <- function(path,header){ | 2 read_file <- function(path,header){ |
| 3 file <- try(read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F),silent=TRUE) | 3 file <- read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F) |
| 4 if (inherits(file,"try-error")){ | 4 return(file) |
| 5 stop("File not found !") | |
| 6 }else{ | |
| 7 return(file) | |
| 8 } | |
| 9 } | 5 } |
| 10 | 6 |
| 11 #convert a string to boolean | 7 #convert a string to boolean |
| 12 str2bool <- function(x){ | 8 str2bool <- function(x){ |
| 13 if (any(is.element(c("t","true"),tolower(x)))){ | 9 if (any(is.element(c("t","true"),tolower(x)))){ |
| 173 ids = ids[which(!is.na(ids))] | 169 ids = ids[which(!is.na(ids))] |
| 174 } | 170 } |
| 175 check_ensembl_geneids(ids) | 171 check_ensembl_geneids(ids) |
| 176 | 172 |
| 177 # Read protein atlas | 173 # Read protein atlas |
| 178 protein_atlas = args$atlas | 174 protein_atlas = read_file(args$atlas, T) |
| 179 protein_atlas = read_file(protein_atlas, T) | |
| 180 | 175 |
| 181 # Add expression | 176 # Add expression |
| 182 output = args$output | 177 output = args$output |
| 183 options = strsplit(args$select, ",")[[1]] | 178 options = strsplit(args$select, ",")[[1]] |
| 184 res = add_expression(ids, protein_atlas, options) | 179 res = add_expression(ids, protein_atlas, options) |
