@@ -217,6 +217,9 @@ ggkegg <- function(pid,
217
217
# ' @param white_background fill background color white
218
218
# ' @param how how to match the node IDs with the queries 'any' or 'all'
219
219
# ' @param infer if TRUE, append the prefix to queried IDs based on pathway ID
220
+ # ' @param name name of column to match for
221
+ # ' @param sep separater for name, default to " "
222
+ # ' @param remove_dot remove "..." in the name
220
223
# ' @export
221
224
# ' @examples
222
225
# ' if (require("clusterProfiler")) {
@@ -227,7 +230,8 @@ ggkegg <- function(pid,
227
230
# ' @return ggraph with overlaid KEGG map
228
231
# '
229
232
rawMap <- function (enrich , pathway_number = 1 , pid = NULL ,
230
- fill_color = " red" , how = " any" , white_background = TRUE , infer = FALSE ) {
233
+ fill_color = " red" , how = " any" , white_background = TRUE , infer = FALSE ,
234
+ name = " name" , sep = " " , remove_dot = TRUE ) {
231
235
232
236
number <- length(enrich )
233
237
if (length(fill_color ) != number ) {
@@ -257,17 +261,17 @@ rawMap <- function(enrich, pathway_number=1, pid=NULL,
257
261
qqcat(" Changing prefix of pathway ID from map to ko\n " )
258
262
pid <- gsub(" map" ," ko" ,pid )
259
263
}
260
-
261
264
if (number == 1 ) {
262
- g <- pathway(pid ) | > mutate(cp = append_cp(enrich , how = how , pid = pid , infer = infer ))
265
+ g <- pathway(pid ) %> % mutate(cp = append_cp(!! enrich , how = !! how , pid = !! pid , infer = !! infer ,
266
+ name = !! name , sep = !! sep , remove_dot = !! remove_dot ))
263
267
gg <- ggraph(g , layout = " manual" , x = .data $ x , y = .data $ y )+
264
268
geom_node_rect(fill = fill_color , aes(filter = .data $ cp ))+
265
269
overlay_raw_map()+ theme_void()
266
270
} else {
267
271
g <- pathway(pid )
268
272
for (i in seq_len(number )) {
269
273
g <- g | > mutate(!! paste0(" cp" ,i ) : = append_cp(enrich [[i ]],
270
- how = how , pid = pid , infer = infer ))
274
+ how = !! how , pid = !! pid , infer = !! infer , name = !! name , sep = !! sep , remove_dot = !! remove_dot ))
271
275
}
272
276
V(g )$ space <- V(g )$ width / number
273
277
gg <- ggraph(g , layout = " manual" , x = .data $ x , y = .data $ y )
@@ -299,12 +303,14 @@ rawMap <- function(enrich, pathway_number=1, pid=NULL,
299
303
# '
300
304
# ' @param values named vector, or list of them
301
305
# ' @param pid pathway id
302
- # ' @param column column name on node table of the graph
303
306
# ' @param white_background fill background color white
304
307
# ' @param how how to match the node IDs with the queries 'any' or 'all'
305
308
# ' @param auto_add automatically add prefix based on pathway prefix
306
309
# ' @param man_graph provide manual tbl_graph
307
310
# ' @param show_type type to be shown
311
+ # ' @param column name of column to match for
312
+ # ' @param sep separater for name, default to " "
313
+ # ' @param remove_dot remove "..." in the name
308
314
# ' typically, "gene", "ortholog", or "compound"
309
315
# ' @export
310
316
# ' @examples
@@ -314,7 +320,8 @@ rawMap <- function(enrich, pathway_number=1, pid=NULL,
314
320
# ' @return ggraph with overlaid KEGG map
315
321
# '
316
322
rawValue <- function (values , pid = NULL , column = " name" , show_type = " gene" ,
317
- how = " any" , white_background = TRUE , auto_add = FALSE , man_graph = NULL ) {
323
+ how = " any" , white_background = TRUE , auto_add = FALSE , man_graph = NULL ,
324
+ sep = " " , remove_dot = TRUE ) {
318
325
if (is.list(values )) {
319
326
number <- length(values )
320
327
if (auto_add ) {
@@ -337,7 +344,7 @@ rawValue <- function(values, pid=NULL, column="name", show_type="gene",
337
344
}
338
345
if (number == 1 ) {
339
346
g <- pgraph | > mutate(value = node_numeric(values ,
340
- name = column , how = how ))
347
+ name = column , how = how , sep = sep , remove_dot = remove_dot ))
341
348
gg <- ggraph(g , layout = " manual" , x = .data $ x , y = .data $ y )+
342
349
geom_node_rect(aes(fill = .data $ value ,
343
350
filter = .data $ type %in% show_type ))+
0 commit comments