diff --git a/R/emapplot_utilities.R b/R/emapplot_utilities.R index ea88101..163b346 100644 --- a/R/emapplot_utilities.R +++ b/R/emapplot_utilities.R @@ -216,71 +216,6 @@ node_add_alpha <- function(p, hilight_category, hilight_gene, alpha_nohilight, a -# build_ggraph <- function(x, enrichDf, mergedEnrichDf, cex_category, pie, -# layout, coords, cex_line, min_edge, pair_sim, -# method, with_edge, hilight_category, alpha_hilight, -# alpha_nohilight){ - -# segment.size <- get_ggrepel_segsize() -# geneSets <- setNames(strsplit(as.character(mergedEnrichDf$geneID), "/", -# fixed = TRUE), mergedEnrichDf$ID) - -# g <- build_emap_graph(enrichDf=mergedEnrichDf,geneSets=geneSets,color="p.adjust", -# cex_line=cex_line, min_edge=min_edge, pair_sim = x@termsim, -# method = x@method) -# g <- edge_add_alpha(g, hilight_category, alpha_nohilight, alpha_hilight) -# # if (!is.null(hilight_category) && length(hilight_category) > 0) { -# # edges <- attr(E(g), "vnames") -# # E(g)$alpha <- rep(alpha_nohilight, length(E(g))) -# # hilight_edge <- grep(paste(hilight_category, collapse = "|"), edges) -# # E(g)$alpha[hilight_edge] <- min(0.8, alpha_hilight) -# # # E(g)$alpha[hilight_edge] <- alpha_hilight -# # } else { -# # E(g)$alpha <- rep(min(0.8, alpha_hilight), length(E(g))) -# # } -# ## when enrichDf just have one line -# if(is.null(dim(enrichDf)) | nrow(enrichDf) == 1) { -# title <- enrichDf$Cluster -# p <- ggraph(g, "tree") + geom_node_point(color="red", size=5 * cex_category) + -# geom_node_text(aes_(label=~name)) + theme_void() + -# labs(title=title) -# return(p) -# } - -# if(is.null(dim(mergedEnrichDf)) | nrow(mergedEnrichDf) == 1) { -# p <- ggraph(g, "tree") -# ID_Cluster_mat <- prepare_pie_category(enrichDf = enrichDf, pie=pie) - -# ID_Cluster_mat <- cbind(ID_Cluster_mat,1,1,0.1*cex_category) -# colnames(ID_Cluster_mat) <- c(colnames(ID_Cluster_mat)[1:(ncol(ID_Cluster_mat)-3)], -# "x", "y", "radius") - - -# p <- p + geom_scatterpie(aes_(x=~x,y=~y,r=~radius), data=ID_Cluster_mat, -# cols=names(ID_Cluster_mat)[1:(ncol(ID_Cluster_mat)-3)], -# color=NA)+ -# xlim(-3,3) + ylim(-3,3) + coord_equal()+ -# geom_node_text(aes_(label=~name), repel=TRUE, segment.size = segment.size) + -# theme_void()+labs(fill = "Cluster") -# return(p) - -# } - -# p <- adj_layout(g = g, layout = layout, coords = coords) -# p$data$alpha <- rep(1, nrow(p$data)) -# if (!is.null(hilight_category) && length(hilight_category) > 0) { -# p$data$alpha <- rep(alpha_nohilight, nrow(p$data)) -# ii <- match(hilight_category, p$data$name) -# p$data$alpha[ii] <- alpha_hilight -# } -# ## add edges -# if (with_edge & length(E(g)$width) > 0) { -# p <- p + geom_edge_link(aes_(width=~I(width), alpha=~I(alpha)), -# colour='darkgrey', show.legend = FALSE) -# } -# return(p) -# } - # ' Adjust the layout # '