Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Update color scheme for interaction plots (#650)
Browse files Browse the repository at this point in the history
* Use project "divergent" color scheme

* Update final figure name

Co-authored-by: Jaclyn Taroni <jaclyn.n.taroni@gmail.com>
  • Loading branch information
jashapiro and jaclyn-taroni authored Mar 27, 2020
1 parent 4f05a07 commit df7a3a4
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 3 deletions.
Binary file modified analyses/interaction-plots/plots/combined_top50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.ALL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.DMG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.Ependymoma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.Ganglioglioma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.HGAT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.LGAT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analyses/interaction-plots/plots/cooccur_top50.Medulloblastoma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 25 additions & 3 deletions analyses/interaction-plots/scripts/03-plot_interactions.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ if (!is.na(opts$disease_table)){
cooccur_file <- opts$infile
plot_file <- opts$outfile

# get root directory
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))


cooccur_df <-
readr::read_tsv(cooccur_file, col_types = readr::cols()) %>%
dplyr::mutate(
Expand Down Expand Up @@ -114,6 +118,23 @@ cooccur_df <- cooccur_df %>%
)


# Get color palettes

palette_dir <- file.path(root_dir, "figures", "palettes")
divergent_palette <- readr::read_tsv(file.path(palette_dir, "divergent_color_palette.tsv"),
col_types = readr::cols())
divergent_colors <- divergent_palette %>%
dplyr::filter(color_names != "na_color") %>%
dplyr::pull(hex_codes)
na_color <- divergent_palette %>%
dplyr::filter(color_names == "na_color") %>%
dplyr::pull(hex_codes)
# not currently using "histologies_color_palette.tsv" as the current
# implementation uses `integrated_diagnosis``, which is not covered in that color scheme
# Since we are only showing the most common subset of diseases, we don't need all colors,
# but this should probably be updated in the future


# create scales for consistent sizing
# The scales will need to have opts$plotsize elements,
# so after getting the unique list, we concatenate on extra elements.
Expand Down Expand Up @@ -145,9 +166,9 @@ cooccur_plot <- ggplot(
limits = yscale,
breaks = unique(cooccur_df$label2)
) +
scale_fill_distiller(
type = "div",
palette = 5,
scale_fill_gradientn(
colors = divergent_colors,
na.value = na_color,
limits = c(-10, 10),
oob = scales::squish,
) +
Expand Down Expand Up @@ -213,6 +234,7 @@ disease_plot <- ggplot(
y = "Samples with mutations",
fill = "Diagnosis"
) +
# TODO: update to project color scheme (currently requires translation of disease to short_histology)
colorblindr::scale_fill_OkabeIto() +
scale_x_discrete(
limits = xscale2,
Expand Down

0 comments on commit df7a3a4

Please sign in to comment.