comparison PathView.R @ 8:33c9bd75882a draft

planemo upload commit 1953798eb28b6e45c78342ed4c6a6a978d096fca
author proteore
date Thu, 30 Aug 2018 06:12:51 -0400
parents b617d4bbebf8
children 560541195c3f
comparison
equal deleted inserted replaced
7:b617d4bbebf8 8:33c9bd75882a
54 --expression_values1 Column containing expression values (first condition) 54 --expression_values1 Column containing expression values (first condition)
55 --expression_values2 Column containing expression values (second condition) 55 --expression_values2 Column containing expression values (second condition)
56 --expression_values3 Column containing expression values (third condition) 56 --expression_values3 Column containing expression values (third condition)
57 --native_kegg TRUE : native KEGG graph, FALSE : Graphviz graph 57 --native_kegg TRUE : native KEGG graph, FALSE : Graphviz graph
58 --species KEGG species (hsa, mmu, ...) 58 --species KEGG species (hsa, mmu, ...)
59 --pathways_input Tab with pathways in a column, output format of find_pathways
60 --pathway_col Column of pathways to use
61 --header2 Boolean, TRUE if header FALSE if not
59 62
60 Example: 63 Example:
61 ./PathView.R --input 'input.csv' --pathway_id '05412' --id_type 'uniprotID' --id_column 'c1' --header TRUE \n\n") 64 ./PathView.R --input 'input.csv' --pathway_id '05412' --id_type 'uniprotID' --id_column 'c1' --header TRUE \n\n")
62 65
63 q(save="no") 66 q(save="no")
106 ###save and load args in rda file for testing 109 ###save and load args in rda file for testing
107 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/pathview/args.Rda") 110 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/pathview/args.Rda")
108 #load("/home/dchristiany/proteore_project/ProteoRE/tools/pathview/args.Rda") 111 #load("/home/dchristiany/proteore_project/ProteoRE/tools/pathview/args.Rda")
109 112
110 ###setting variables 113 ###setting variables
111 if (!is.null(args$pathways_id)) { ids <- sapply(rapply(strsplit(clean_bad_character(args$pathways_id),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)} 114 if (!is.null(args$pathways_id)) {
115 ids <- sapply(rapply(strsplit(clean_bad_character(args$pathways_id),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)
116 }else if (!is.null(args$pathways_input)){
117 header2 <- str2bool(args$header2)
118 pathway_col <- as.numeric(gsub("c", "" ,args$pathway_col))
119 pathways_file = read_file(args$pathways_input,header2)
120 ids <- sapply(rapply(strsplit(clean_bad_character(pathways_file[,pathway_col]),","),c), function(x) remove_kegg_prefix(x),USE.NAMES = FALSE)
121 }
112 #if (!is.null(args$pathways_name)) {names <- as.vector(sapply(strsplit(args$pathways_name,","), function(x) concat_string(x),USE.NAMES = FALSE))} 122 #if (!is.null(args$pathways_name)) {names <- as.vector(sapply(strsplit(args$pathways_name,","), function(x) concat_string(x),USE.NAMES = FALSE))}
113 if (!is.null(args$id_list)) {id_list <- as.vector(strsplit(clean_bad_character(args$id_list),","))} 123 if (!is.null(args$id_list)) {id_list <- as.vector(strsplit(clean_bad_character(args$id_list),","))}
114 id_type <- tolower(args$id_type) 124 id_type <- tolower(args$id_type)
115 ncol <- as.numeric(gsub("c", "" ,args$id_column)) 125 ncol <- as.numeric(gsub("c", "" ,args$id_column))
116 header <- str2bool(args$header) 126 header <- str2bool(args$header)
117 #output <- args$output 127 #output <- args$output
118 native_kegg <- str2bool(args$native_kegg) 128 native_kegg <- str2bool(args$native_kegg)
119 species=args$species 129 species=args$species
130 #org list used in mapped2geneID
131 org <- c('Hs','Mm')
132 names(org) <- c('hsa','mmu')
133
120 134
121 135
122 #read input file or list 136 #read input file or list
123 if (!is.null(args$input)){ 137 if (!is.null(args$input)){
124 tab <- read_file(args$input,header) 138 tab <- read_file(args$input,header)
138 152
139 ##### map uniprotID to entrez geneID 153 ##### map uniprotID to entrez geneID
140 if (id_type == "uniprotid") { 154 if (id_type == "uniprotid") {
141 155
142 uniprotID = tab[,ncol] 156 uniprotID = tab[,ncol]
143 mapped2geneID = id2eg(ids = uniprotID, category = "uniprot", org = "Hs", pkg.name = NULL) 157 mapped2geneID = id2eg(ids = uniprotID, category = "uniprot", org = org[[species]], pkg.name = NULL)
144 geneID = mapped2geneID[,2] 158 geneID = mapped2geneID[,2]
145 tab = cbind(tab,geneID) 159 tab = cbind(tab,geneID)
146 160
147 }else if (id_type == "geneid"){ 161 }else if (id_type == "geneid"){
148 162
186 #mat <- exp1[1:nrow(tab)] 200 #mat <- exp1[1:nrow(tab)]
187 #names(mat) <- geneID 201 #names(mat) <- geneID
188 202
189 203
190 #####mapping geneID (with or without expression values) on KEGG pathway 204 #####mapping geneID (with or without expression values) on KEGG pathway
205 plot.col.key=!is.null(tab$e1) #if there's no exrepession data, we don't show the color key
206
191 for (id in ids) { 207 for (id in ids) {
192 pathview(gene.data = mat, 208 pathview(gene.data = mat,
193 #gene.idtype = "geneID", 209 #gene.idtype = "geneID",
194 #cpd.data = uniprotID, 210 #cpd.data = uniprotID,
195 #cpd.idtype = "uniprot", 211 #cpd.idtype = "uniprot",
215 #low = list(gene = "green", cpd = "blue"), 231 #low = list(gene = "green", cpd = "blue"),
216 #mid = list(gene = "gray", cpd = "gray"), 232 #mid = list(gene = "gray", cpd = "gray"),
217 #high = list(gene = "red", cpd = "yellow"), 233 #high = list(gene = "red", cpd = "yellow"),
218 #na.col = "transparent", 234 #na.col = "transparent",
219 #sign.pos="bottomleft", 235 #sign.pos="bottomleft",
236 plot.col.key = plot.col.key,
237 #high = "lightgreen",
220 #key.pos="topright", 238 #key.pos="topright",
221 #new.signature=TRUE, 239 #new.signature=TRUE,
222 #rankdir="LB", 240 #rankdir="LB",
223 #cex=0.3, 241 #cex=0.3,
224 #text.width=15, 242 #text.width=15,