Skip to content

Commit

Permalink
ggp
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemoran committed May 25, 2021
1 parent a8ae70d commit 2c0dc50
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions R/ssgsea.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ssgsea_rotationPCA <- function(ssgsea, metadata, hallmark_tb = NULL, contrast, r
if("Process_Category" %in% colnames(d)){
colsh_p <- colnames(p)[2]

ggpp <- ggplot2::ggplot() + ggplot2::geom_segment(data = d,
ggp <- ggplot2::ggplot() + ggplot2::geom_segment(data = d,
ggplot2::aes(x = 0, y = 0, xend = (PC1*2),
yend = (PC2*2),
group = Process_Category,
Expand All @@ -104,6 +104,12 @@ ssgsea_rotationPCA <- function(ssgsea, metadata, hallmark_tb = NULL, contrast, r
size = 1.2,
linetype = 1,
inherit.aes = FALSE) +
ggplot2::geom_point(data = p,
ggplot2::aes_string(x = "PC1", y = "PC2",
shape = colsh_p),
size = 2.5,
show.legend = TRUE,
inherit.aes = FALSE) +
ggrepel::geom_label_repel(data = d,
ggplot2::aes(x = (PC1*2), y = (PC2*2),
label = gsub("HALLMARK_", "", Hallmark_Name),
Expand All @@ -117,14 +123,6 @@ ssgsea_rotationPCA <- function(ssgsea, metadata, hallmark_tb = NULL, contrast, r
subtitle = "PCA plot using MsigDB Hallmark with Process_Category",
x = paste0("PC1: ", round(percentVar[1] * 100), "% variance"),y = paste0("PC2: ", round(percentVar[2] * 100), "% variance"))

ggp <- ggpp +
ggplot2::geom_point(data = p,
ggplot2::aes_string(x = "PC1", y = "PC2",
shape = colsh_p),
size = 2.5,
show.legend = TRUE,
inherit.aes = FALSE)

} else {
stop("Unfinished, suggest using Hallmarks...")
ggp <- ggplot2::ggplot(data = p,
Expand Down

0 comments on commit 2c0dc50

Please sign in to comment.