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

Commit

Permalink
Merge branch 'master' into remove_dup_NULLs
Browse files Browse the repository at this point in the history
  • Loading branch information
jashapiro authored Jan 9, 2020
2 parents 2e82c0b + 1e5e98a commit 130c22e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
27 changes: 18 additions & 9 deletions analyses/immune-deconv/02-summary-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ source(file.path(root_dir, "analyses", "immune-deconv",
"util", "pubTheme.R"))

option_list <- list(
make_option(c("-i", "--input"), type = "character",
help = "Immunedeconv output from 01-immune.deconv.R (.RData)"),
make_option(c("-o", "--output"), type = "character",
help = "Output PDF (.pdf)")
make_option(c("-i", "--input"), type = "character", help = "Immunedeconv output from 01-immune.deconv.R (.RData)"),
make_option(c("-o", "--output"), type = "character", help = "Output directory")
)

# Example Run:
# Rscript analyses/immune-deconv/02-summary-plots.R \
# -i 'analyses/immune-deconv/results/deconv-output.RData' \
# -o 'analyses/immune-deconv/results/deconv-summary.pdf'
# -o 'analyses/immune-deconv/plots

# parse parameters
opt <- parse_args(OptionParser(option_list = option_list))
Expand Down Expand Up @@ -111,18 +109,29 @@ total <- total %>%
column_to_rownames('cell_type') %>%
replace(is.na(.), 0)

# create correlation heatmap
pdf(file = output, onefile = TRUE, width = 13, height = 8)
# replace space from method names for output filename
m1 <- gsub(" ","",method1.name)
m2 <- gsub(" ","",method2.name)

# create correlation plot for overlapping cell types between both methods
png(filename = file.path(output, paste0("corrplot_", m1, "_vs_", m2, ".png")),
width = 13, height = 8, units = "in", res = 300)
corrplot(t(total), method = "circle", type = 'full', win.asp = 0.5,
addCoef.col = "black", number.cex = .5,
is.corr = FALSE, tl.cex = 0.8, mar = c(0, 0, 0, 5),
title = paste0("\n\n\n\nCorrelation matrix (",
method1.name, " vs ", method2.name, ")\n",
"Overall Pearson Correlation: ", avg.cor))
dev.off()

# lastly, create heatmaps for both deconvolution methods
# add to the same file as above
# create heatmaps of average immune scores per histology per cell type
# method1
png(filename = file.path(output, paste0("heatmap_", m1, ".png")), width = 13, height = 8, units = "in", res = 300)
create.heatmap(deconv.method = method1, title = method1.name)
dev.off()

# method2
png(filename = file.path(output, paste0("heatmap_", m2, ".png")), width = 10, height = 8, units = "in", res = 300)
create.heatmap(deconv.method = method2, title = method2.name)
dev.off()

8 changes: 3 additions & 5 deletions analyses/immune-deconv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ This script creates summary correlation plots and heatmaps from predicted immune

3. Output

`plots/deconv-summary.pdf`

The pdf contains the following plots:
* a correlation plot of predicted immune scores across 13 common cell types from xCell and CIBERSORT (abs.)
* individual heatmaps of average immune scores per cell type per histology for each method.
* `plots/corrplot_xCell_vs_CIBERSORT(abs.).png`: a correlation plot of predicted immune scores across 13 common cell types from xCell and CIBERSORT (abs.)
* `plots/heatmap_xCell.png`: heatmap of average immune scores per cell type per histology for xCell.
* `plots/heatmap_CIBERSORT(abs.).png`: heatmap of average immune scores per cell type per histology for the second method, CIBERSORT in our case.

### Running the analysis

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed analyses/immune-deconv/plots/deconv-summary.pdf
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.
Binary file added analyses/immune-deconv/plots/heatmap_xCell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion analyses/immune-deconv/run-immune-deconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ echo "Create summary plots"
# Also generates corresponding heatmaps of average normalized immune scores
Rscript --vanilla 02-summary-plots.R \
--input results/deconv-output.RData \
--output plots/deconv-summary.pdf
--output plots

0 comments on commit 130c22e

Please sign in to comment.