Skip to content

Commit 6b96608

Browse files
committed
fixes #55
1 parent 9301e4d commit 6b96608

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: pathfindR
22
Type: Package
33
Title: Enrichment Analysis Utilizing Active Subnetworks
4-
Version: 1.5.1.9000
4+
Version: 1.5.1.9001
55
Authors@R: c(person("Ege", "Ulgen",
66
role = c("cre", "cph"),
77
email = "[email protected]",

NEWS.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# pathfindR 1.5.1.9000
1+
# pathfindR 1.5.1.9001
22
## to be released as 1.5.1
33

44
## Major Changes
55

66
## Minor changes and bug fixes
77
- Fixed issue in `check_java_version()` where java version 14 could not be parsed (#49)
8+
- Fixed issue in `combined_results_graph()` where gene nodes were not colored correctly (#55)
89

910
***
1011

R/comparison_functions.R

+14-16
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,18 @@ combined_results_graph <- function(combined_df, selected_terms = "common",
184184
missing_B <- !cond_up_B & !cond_down_B
185185

186186
up_cond <- (cond_up_A & cond_up_B) | (missing_A & cond_up_B) | (cond_up_A & missing_B)
187-
down_cond <- cond_down_A & cond_down_B | (missing_A & cond_down_B) | (cond_down_A & missing_B)
187+
down_cond <- (cond_down_A & cond_down_B) | (missing_A & cond_down_B) | (cond_down_A & missing_B)
188188

189-
igraph::V(g)$color <- ifelse(igraph::V(g)$type == "common term", "#FCCA46",
190-
ifelse(igraph::V(g)$type == "A-only term", "#9FB8AD",
191-
ifelse(igraph::V(g)$type == "B-only term", "#619B8A",
192-
ifelse(up_cond, "green",
193-
ifelse(down_cond, "red", "gray")))))
189+
igraph::V(g)$for_coloring <- ifelse(igraph::V(g)$type == "common term", "Common term",
190+
ifelse(igraph::V(g)$type == "A-only term", "A-only term",
191+
ifelse(igraph::V(g)$type == "B-only term", "B-only term",
192+
ifelse(up_cond, "Up gene",
193+
ifelse(down_cond, "Down gene", "Conflicting gene")))))
194194

195195
### Create graph
196196
p <- ggraph::ggraph(g, layout = layout)
197197
p <- p + ggraph::geom_edge_link(alpha = .8, colour = "darkgrey")
198-
p <- p + ggraph::geom_node_point(ggplot2::aes_(color = ~ I(color), size = ~size))
198+
p <- p + ggraph::geom_node_point(ggplot2::aes_(color = ~for_coloring, size = ~size))
199199
p <- p + ggplot2::scale_size(range = c(5, 10),
200200
breaks = round(seq(round(min(igraph::V(g)$size)),
201201
round(max(igraph::V(g)$size)),
@@ -204,15 +204,13 @@ combined_results_graph <- function(combined_df, selected_terms = "common",
204204
p <- p + ggplot2::theme_void()
205205
p <- p + ggraph::geom_node_text(ggplot2::aes_(label = ~name), nudge_y = .2)
206206

207-
cols <- unique(igraph::V(g)$color)
208-
lbls <- ifelse(cols == "#FCCA46", "Common term",
209-
ifelse(cols == "#9FB8AD", "A-only term",
210-
ifelse(cols == "#619B8A", "B-only term",
211-
ifelse(cols == "green", "Up gene",
212-
ifelse(cols == "red", "Down gene", "Conflicting gene")))))
213-
p <- p + ggplot2::scale_colour_manual(values = cols,
214-
name = NULL,
215-
labels = lbls)
207+
vertex_cols <- c("Common term" = "#FCCA46",
208+
"A-only term" = "#9FB8AD",
209+
"B-only term" = "#619B8A",
210+
"Up gene" = "green",
211+
"Down gene" = "red",
212+
"Conflicting gene" = "gray")
213+
p <- p + ggplot2::scale_colour_manual(values = vertex_cols)
216214
p <- p + ggplot2::ggtitle("Combined Terms Graph")
217215
p <- p + ggplot2::theme(plot.title = ggplot2::element_text(hjust = 0.5))
218216
return(p)

0 commit comments

Comments
 (0)