annotate get_expression_profiles.R @ 0:1c9562e9ea67 draft default tip

planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
author proteore
date Thu, 13 Dec 2018 04:06:48 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
1 # Read file and return file content as data.frame
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
2 read_file <- function(path,header){
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
3 file <- try(read.csv(path,header=header, sep="\t",stringsAsFactors = FALSE, quote="\"", check.names = F),silent=TRUE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
4 if (inherits(file,"try-error")){
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
5 stop("File not found !")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
6 }else{
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
7 return(file)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
8 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
9 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
10
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
11 str2bool <- function(x){
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
12 if (any(is.element(c("t","true"),tolower(x)))){
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
13 return (TRUE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
14 }else if (any(is.element(c("f","false"),tolower(x)))){
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
15 return (FALSE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
16 }else{
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
17 return(NULL)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
18 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
19 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
20
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
21 # input has to be a list of IDs in ENSG format
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
22 # tissue is one of unique(HPA.normal.tissue$Tissue)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
23 # level is one, or several, or 0 (=ALL) of "Not detected", "Medium", "High", "Low"
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
24 # reliability is one, or several, or 0 (=ALL) of "Approved", "Supported", "Uncertain"
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
25 annot.HPAnorm<-function(input, HPA_normal_tissue, tissue, level, reliability, not_mapped_option) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
26 dat <- subset(HPA_normal_tissue, Gene %in% input)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
27 res.Tissue<-subset(dat, Tissue %in% tissue)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
28 res.Level<-subset(res.Tissue, Level %in% level)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
29 res.Rel<-subset(res.Level, Reliability %in% reliability)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
30
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
31 if (not_mapped_option) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
32 if (length(setdiff(intersect(input, unique(dat$Gene)), unique(res.Rel$Gene)))>0) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
33 not_match_IDs <- matrix(setdiff(intersect(input, unique(dat$Gene)), unique(res.Rel$Gene)), ncol = 1, nrow = length(setdiff(intersect(input, unique(dat$Gene)), unique(res.Rel$Gene))))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
34 not.match <- matrix("not match", ncol = ncol(HPA_normal_tissue) - 1, nrow = length(not_match_IDs))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
35 not.match <- cbind(not_match_IDs, unname(not.match))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
36 colnames(not.match) <- colnames(HPA_normal_tissue)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
37 res <- rbind(res.Rel, not.match)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
38 } else {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
39 res <- res.Rel
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
40 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
41
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
42 if (length(setdiff(input, unique(dat$Gene)))>0) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
43 not.mapped <- matrix(ncol = ncol(HPA_normal_tissue) - 1, nrow = length(setdiff(input, unique(dat$Gene))))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
44 not.mapped <- cbind(matrix(setdiff(input, unique(dat$Gene)), ncol = 1, nrow = length(setdiff(input, unique(dat$Gene)))), unname(not.mapped))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
45 colnames(not.mapped) <- colnames(HPA_normal_tissue)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
46 res <- rbind(res, not.mapped)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
47 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
48
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
49 } else {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
50 res <- res.Rel
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
51 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
52
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
53 return(res)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
54
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
55 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
56
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
57 annot.HPAcancer<-function(input, HPA_cancer_tissue, cancer, not_mapped_option) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
58 dat <- subset(HPA_cancer_tissue, Gene %in% input)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
59 res.Cancer<-subset(dat, Cancer %in% cancer)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
60
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
61 if (not_mapped_option) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
62 not.mapped <- matrix(ncol=ncol(HPA_cancer_tissue)-1, nrow=length(setdiff(input, unique(dat$Gene))))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
63 not.mapped <- cbind(matrix(setdiff(input, unique(dat$Gene)), ncol = 1, nrow = length(setdiff(input, unique(dat$Gene)))), unname(not.mapped))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
64 colnames(not.mapped) <- colnames(HPA_cancer_tissue)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
65 res <- rbind(res.Cancer, not.mapped)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
66 } else {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
67 res <- res.Cancer
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
68 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
69 return(res)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
70 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
71
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
72
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
73 main <- function() {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
74 args <- commandArgs(TRUE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
75 if(length(args)<1) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
76 args <- c("--help")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
77 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
78
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
79 # Help section
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
80 if("--help" %in% args) {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
81 cat("Selection and Annotation HPA
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
82 Arguments:
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
83 --ref_file: HPA normal/cancer tissue file path
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
84 --input_type: type of input (list of id or filename)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
85 --input: list of IDs in ENSG format
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
86 --column_number: the column number which you would like to apply...
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
87 --header: true/false if your file contains a header
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
88 --atlas: normal/cancer
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
89 if normal:
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
90 --tissue: list of tissues
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
91 --level: Not detected, Low, Medium, High
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
92 --reliability: Supportive, Uncertain
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
93 if cancer:
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
94 --cancer: Cancer tissues
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
95 --not_mapped: true/false if your output file should contain not-mapped and not-match IDs
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
96 --output: output filename \n")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
97 q(save="no")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
98 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
99
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
100 # Parse arguments
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
101 parseArgs <- function(x) strsplit(sub("^--", "", x), "=")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
102 argsDF <- as.data.frame(do.call("rbind", parseArgs(args)))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
103 args <- as.list(as.character(argsDF$V2))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
104 names(args) <- argsDF$V1
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
105
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
106 #save(args,file = "/home/dchristiany/proteore_project/ProteoRE/tools/select_annotate_tissue/args.rda")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
107 #load("/home/dchristiany/proteore_project/ProteoRE/tools/select_annotate_tissue/args.rda")
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
108
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
109 # Extract input
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
110 input_type = args$input_type
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
111 if (input_type == "list") {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
112 list_id = strsplit(args$input, "[ \t\n]+")[[1]]
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
113 } else if (input_type == "file") {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
114 filename = args$input
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
115 column_number = as.numeric(gsub("c", "" ,args$column_number))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
116 header = str2bool(args$header)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
117 file = read_file(filename, header)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
118 list_id = sapply(strsplit(file[,column_number], ";"), "[", 1)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
119 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
120 input = list_id
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
121
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
122 # Read reference file
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
123 reference_file = read_file(args$ref_file, TRUE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
124
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
125 # Extract other options
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
126 atlas = args$atlas
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
127 not_mapped_option = str2bool(args$not_mapped)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
128 if (atlas=="normal") {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
129 tissue = strsplit(args$tissue, ",")[[1]]
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
130 level = strsplit(args$level, ",")[[1]]
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
131 reliability = strsplit(args$reliability, ",")[[1]]
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
132 # Calculation
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
133 res = annot.HPAnorm(input, reference_file, tissue, level, reliability, not_mapped_option)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
134 } else if (atlas=="cancer") {
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
135 cancer = strsplit(args$cancer, ",")[[1]]
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
136 # Calculation
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
137 res = annot.HPAcancer(input, reference_file, cancer, not_mapped_option)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
138 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
139
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
140 # Write output
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
141 output = args$output
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
142 res <- apply(res, c(1,2), function(x) gsub("^$|^ $", NA, x))
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
143 write.table(res, output, sep = "\t", quote = FALSE, row.names = FALSE)
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
144 }
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
145
1c9562e9ea67 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9
proteore
parents:
diff changeset
146 main()