R/tscores_plots.R

Defines functions tscores_plots

Documented in tscores_plots

#' Plots matchSCore trends for a specific tool
#'
#' This function identifies true label groups between reference groups and clusters
#'
#' @param scores_df A character vector of reference group labels. TODOELI: df or vector?
#'
#' @return A plot object, TODO
#'
#' @export
#'
#' @examples
#' # TODO
tscores_plots <- function(scores_df) {
  names(scores_df)[c(2, 3)] <- c("top_genes", "matchSCore")

  p1 <- ggplot(
    scores_df,
    aes_string(x = "specificity", y = "matchSCore", colour = "top_genes", group = "top_genes")
  ) +
    geom_line() +
    scale_colour_gradientn(colours = rainbow(15)) +
    theme_bw()

  p2 <- ggplot(
    scores_df,
    aes_string(x = "top_genes", y = "matchSCore", colour = "specificity")
  ) +
    geom_point(alpha = 0.7, size = 2.5) +
    scale_colour_gradientn(colours = c("gold", "gray", "blue")) +
    geom_smooth(span = 1.3, se = FALSE) +
    theme_bw()

  p3 <- ggplot(
    scores_df,
    aes_string(x = "specificity", y = "matchSCore", fill = "top_genes")
  ) +
    geom_bar(stat = "identity", position = "dodge", width = 0.03, col = "white") +
    scale_fill_gradientn(colours = rainbow(15)) +
    theme_bw()

  plot_grid(p1, p2, p3, align = "v", ncol = 1)
}
elimereu/matchSCore2 documentation built on April 9, 2020, 5:41 p.m.