Skip to content

Commit

Permalink
Combine broad histology oncoprints into a single multi-panel plot (Al…
Browse files Browse the repository at this point in the history
…exsLemonade#1051)

* add multi panel png for histology specific oncoprints

* label individual oncoprints

- create loop in generate figures script to run `oncoprint-landscape.R` for each set of samples (primary_only and primary-plus)
- remove previous figures

* accommodate for the GOI list revisions made in AlexsLemonade#1053

* redesign `oncoprint-landscape.R`

* remove unnecessary files

- fix spacing in shell script

* actually fix spacing in shell script

* replace `transcriptomic_figure` with more accurate `oncoprint_figure`

Co-authored-by: Jaclyn Taroni <jaclyn.n.taroni@gmail.com>
  • Loading branch information
cbethell and jaclyn-taroni authored May 12, 2021
1 parent ece6c5e commit dcef05a
Show file tree
Hide file tree
Showing 27 changed files with 3,054 additions and 2,965 deletions.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
13 changes: 11 additions & 2 deletions figures/generate-figures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,17 @@ fi
# Run the `oncoprint-landscape` module shell script
bash ${analyses_dir}/oncoprint-landscape/run-oncoprint.sh

# Copy the primary plus samples oncoprint figure to final directory
cp ${analyses_dir}/oncoprint-landscape/plots/all_participants_primary-plus_goi_oncoprint.png pngs/fig3-oncoprint-landscape.png
# Will create two plots - primary only and "primary plus" samples
filenames=(primary_only primary-plus)

for filename in "${filenames[@]}"; do

## Run the `oncoprint-landscape` figure assembly script
Rscript --vanilla scripts/oncoprint-landscape.R \
--lead_filename ${filename} \
--png_name pngs/${filename}_oncoprint_landscape.png

done

## Copy number status heatmap

Expand Down
219 changes: 96 additions & 123 deletions figures/mapping-histology-labels.nb.html

Large diffs are not rendered by default.

5,681 changes: 2,841 additions & 2,840 deletions figures/palettes/histology_label_color_table.tsv

Large diffs are not rendered by default.

Binary file removed figures/pngs/fig3-oncoprint-landscape.png
Binary file not shown.
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.
106 changes: 106 additions & 0 deletions figures/scripts/oncoprint-landscape.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Chante Bethell for ALSF CCDL 2021
#
# Makes a multipanel plot for broad histology specific oncoprints.
#
# Code for this script was adapted from
# `figures/scripts/transcriptomic-overview.R`

#### Set Up --------------------------------------------------------------------

# Load maftools
library(maftools)

# Load multipanelfigure for figure assembly later
library(multipanelfigure)

# Get `magrittr` pipe
`%>%` <- dplyr::`%>%`

#### Directories and Files -----------------------------------------------------

# Detect the ".git" folder -- this will in the project root directory.
# Use this as the root directory to ensure proper execution, no matter where
# it is called from.
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))

# Declare output directory
output_dir <- file.path(root_dir, "figures", "pngs")

# Oncoprint directory
onco_dir <- file.path(root_dir, "analyses", "oncoprint-landscape", "plots")

#### Command line options ------------------------------------------------------

# Declare command line options
option_list <- list(
optparse::make_option(
c("-l", "--lead_filename"),
type = "character",
default = NULL,
help = "the leading filename for the oncoprints -- can be primary_only or primary-plus"
),
optparse::make_option(
c("-p", "--png_name"),
type = "character",
default = NULL,
help = "oncoprint output png file name"
)
)

# Read the arguments passed
opt_parser <- optparse::OptionParser(option_list = option_list)
opt <- optparse::parse_args(opt_parser)

#### PNG names ----------------------------------------------------------------

# Here we'll set up the file names for the broad histology specific oncoprints
# stored in the `oncoprint-landscape` module
lgat_png <- file.path(onco_dir, paste0(opt$lead_filename, "_lgat_goi_oncoprint.png"))
embryonal_png <- file.path(onco_dir, paste0(opt$lead_filename, "_embryonal_goi_oncoprint.png"))
hgat_png <- file.path(onco_dir, paste0(opt$lead_filename, "_hgat_goi_oncoprint.png"))
ependymal_png <- file.path(onco_dir, paste0(opt$lead_filename, "_ependymal_goi_oncoprint.png"))
other_cns_png <- file.path(onco_dir, paste0(opt$lead_filename, "_other_goi_oncoprint.png"))

#### Assemble multipanel figure ------------------------------------------------

oncoprint_figure <- multi_panel_figure(columns = 8,
rows = 2,
width = 1200,
height = 300)

oncoprint_figure <- fill_panel(oncoprint_figure,
lgat_png,
col = 2:3,
row = 1,
scaling = "stretch",
label = "Low-grade astrocytic tumor")

oncoprint_figure <- fill_panel(oncoprint_figure,
embryonal_png,
col = 4:5,
row = 1,
scaling = "stretch",
label = "Embryonal tumor")

oncoprint_figure <- fill_panel(oncoprint_figure,
hgat_png,
col = 6:7,
row = 1,
scaling = "stretch",
label = "Diffuse astrocytic and oligodendroglial tumor")

oncoprint_figure <- fill_panel(oncoprint_figure,
ependymal_png,
col = 2:3,
row = 2,
scaling = "stretch",
label = "Ependymal tumor")

oncoprint_figure <- fill_panel(oncoprint_figure,
other_cns_png,
col = 4:5,
row = 2,
scaling = "stretch",
label = "Other CNS")

save_multi_panel_figure(oncoprint_figure, opt$png_name)

0 comments on commit dcef05a

Please sign in to comment.