Skip to content
Snippets Groups Projects
Commit 24ee16ab authored by Jeffrey Pullin's avatar Jeffrey Pullin
Browse files

Add script to create manuscript figures

parent 980fa8f9
No related branches found
No related tags found
No related merge requests found
Pipeline #10193 passed
library(ggplot2)
library(patchwork)
# Conceptual figure (components)
rank_rank <- readRDS(
here::here("figures", "raw", "rank-rank-scanpy-default-seurat-default.rds")
)
prop_intersect <- readRDS(
here::here("figures", "raw", "scanpy-seurat-intersection.rds")
)
conceptual_figure_bottom <- prop_intersect + rank_rank +
plot_layout(nrow = 1, widths = c(1, 1))
conceptual_figure_bottom
ggsave(
filename = here::here("figures", "final", "conceptual-figure-bottom.pdf"),
plot = conceptual_figure_bottom,
width = 12, height = 4, units = "in"
)
raw_tsne <- readRDS(
here::here("figures", "raw", "raw-tsne.rds")
)
ggsave(
filename = here::here("figures", "final", "raw-tsne.pdf"),
plot = raw_tsne,
width = 4, height = 4, units = "in"
)
coloured_tsne <- readRDS(
here::here("figures", "raw", "raw-tsne.rds")
)
ggsave(
filename = here::here("figures", "final", "coloured-tsne.pdf"),
plot = coloured_tsne,
width = 4, height = 4, units = "in"
)
ms4a1_expression <- readRDS(
here::here("figures", "raw", "ms4a1-expression.rds")
)
ggsave(
filename = here::here("figures", "final", "ms4a1-expression.pdf"),
plot = ms4a1_expression,
width = 4, height = 4, units = "in"
)
# Method concordance + characteristics figure
concordance_dendorogram <- readRDS(
here::here("figures", "raw", "dendrogram.rds")
)
raw_info <- readRDS(
here::here("figures", "raw", "raw-info.rds")
) +
theme(plot.margin = margin(-1, -1, 1, -1, "cm"))
strategy_info <- readRDS(
here::here("figures", "raw", "strategy-info.rds")
) +
theme(plot.margin = margin(-1, -1, -1, -1, "cm"))
package_info <- readRDS(
here::here("figures", "raw", "package-info.rds")
) +
theme(plot.margin = margin(-1, -1, -1, -1, "cm"))
overall_prop_up <- readRDS(
here::here("figures", "raw", "overall-prop-up.rds")
) +
ggtitle("Regulation direction across datasets")
all_n_zero_pvalues <- readRDS(
here::here("figures", "raw", "all_n_zero_pvalues.rds")
) +
ggtitle("Number of zero p-values across datasets")
full_dendrogram <- concordance_dendorogram +
package_info +
raw_info +
strategy_info +
plot_layout(
nrow = 1,
widths = c(0.9, 0.02, 0.02, 0.02),
heights = c(4, 1, 1, 1),
guides = "collect"
)
full_dendrogram
concordance_figure <- full_dendrogram / (overall_prop_up + all_n_zero_pvalues) +
plot_layout(heights = c(3, 2), tag_level = "new") +
plot_annotation(tag_levels = list(c("a", " ", " ", " ", "b", "c")))
concordance_figure
ggsave(
filename = here::here("figures", "final", "concordance-figure.pdf"),
plot = concordance_figure,
width = 16,
height = 16,
units = "in"
)
# Computational performance + implementation quality figure
overall_time <- readRDS(here::here("figures", "raw", "overall-time.rds"))
overall_memory <- readRDS(here::here("figures", "raw", "overall-memory.rds"))
num_cells_time <- readRDS(here::here("figures", "raw", "time-num-cells.rds")) +
theme(axis.title.y = element_text(margin = margin(r = -120, unit = "pt")))
implementation_quality <- readRDS(here::here("figures", "raw", "implementation.rds"))
# Warning is spurious
top <- overall_time + overall_memory
bottom <- num_cells_time + implementation_quality +
plot_layout(widths = c(2, 1))
computational_performance_figure <- top / bottom +
plot_annotation(tag_levels = "a")
computational_performance_figure
ggsave(
filename = here::here("figures", "final", "computational-performance-figure.pdf"),
plot = computational_performance_figure,
width = 16,
height = 16,
units = "in"
)
# Simulated performance figure
overall_recall <- readRDS(
here::here("figures", "raw", "overall-recall.rds")
) +
ggtitle("Recall")
overall_precision <- readRDS(
here::here("figures", "raw", "overall-precision.rds")
) +
ggtitle("Precision") +
theme(axis.title.y = element_blank())
overall_f1_score <- readRDS(
here::here("figures", "raw", "overall-f1-score.rds")
) +
ggtitle("F1 score") +
theme(axis.title.y = element_blank())
simulated_perf_figure <- overall_recall + overall_precision + overall_f1_score +
plot_layout(guides = "collect") +
plot_annotation(tag_levels = "a")
simulated_perf_figure
ggsave(
filename = here::here("figures", "final", "simulated-perf-figure.pdf"),
plot = simulated_perf_figure,
width = 12,
height = 8,
units = "in"
)
# Expert performance figure
expert_lawlor_heatmap <- readRDS(
here::here("figures", "raw", "expert-lawlor-heatmap.rds")
)
expert_pbmc3k_heatmap <- readRDS(
here::here("figures", "raw", "expert-pbmc3k-heatmap.rds")
)
expert_perf_figure <- expert_lawlor_heatmap + expert_pbmc3k_heatmap +
plot_layout(ncol = 2) +
plot_annotation(tag_levels = "a")
expert_perf_figure
ggsave(
filename = here::here("figures", "final", "expert-perf-figure.pdf"),
plot = expert_perf_figure,
width = 16,
height = 10,
units = "in"
)
# Predictive performance figure
zhao_pred_perf <- readRDS(
here::here("figures", "raw", "zhao-pred-perf.rds")
)
overall_multiclass_pred_plot <- readRDS(
here::here("figures", "raw", "overall-mc-pred-plot.rds")
)
pbmc3k_seurat_wilcox_confmat <- readRDS(
here::here("figures", "raw", "pbmc3k-seurat-wilcox-confmat.rds")
)
lhs <- (zhao_pred_perf / pbmc3k_seurat_wilcox_confmat) +
plot_layout(ncol = 1, heights = c(2, 1))
pred_perf_figure <- lhs - overall_multiclass_pred_plot +
plot_layout(ncol = 2) +
plot_annotation(tag_levels = "a")
pred_perf_figure
ggsave(
filename = here::here("figures", "final", "pred-perf-figure.pdf"),
plot = pred_perf_figure,
width = 14,
height = 14,
units = "in"
)
# Case studies figure
log_fc_plot <- readRDS(
here::here("figures", "raw", "log-fc-b-cluster-scatter.rds")
)
welch_issue_plot <- readRDS(
here::here("figures", "raw", "rr-scanpy-t-abs-seurat-t.rds")
)
logfc_abs_prop_intersect_plot <- readRDS(
here::here("figures", "raw", "logfc-abs-prop-intersect.rds")
)
scanpy_seurat_zeisel_oligodendrocytes_plot <- readRDS(
here::here("figures", "raw", "scanpy-seurat-zeisel-oligodendrocytes.rds")
)
case_studies_figure <- logfc_abs_prop_intersect_plot +
scanpy_seurat_zeisel_oligodendrocytes_plot +
log_fc_plot +
welch_issue_plot +
plot_layout(ncol = 2) +
plot_annotation(tag_levels = "a") &
theme(plot.tag = element_text(size = 18))
case_studies_figure
ggsave(
filename = here::here("figures", "final", "case-studies-figure.pdf"),
plot = case_studies_figure,
width = 16,
height = 16,
units = "in"
)
# Supplementary figures
# Additional expert heatmaps
expert_ss3_pbmc3_heatmap <- readRDS(
here::here("figures", "raw", "expert-ss3_pbmc-heatmap.rds")
) +
theme(legend.position = "none")
expert_zeisel_heatmap <- readRDS(
here::here("figures", "raw", "expert-zeisel-heatmap.rds")
)
ss3_pbmc_zeisel_expert_heatmaps <- expert_ss3_pbmc3_heatmap + expert_zeisel_heatmap +
plot_annotation(tag_levels = "a")
ggsave(
here::here("figures", "final", "ss3_pbmc-zeisel-expert-heatmaps.pdf"),
ss3_pbmc_zeisel_expert_heatmaps,
width = 8,
height = 8,
units = "in"
)
# Number of clusters simulations
time_num_clusters <- readRDS(here::here("figures", "raw", "time-num-clusters.rds"))
memory_num_clusters <- readRDS(here::here("figures", "raw", "memory-num-clusters.rds"))
num_cluster_sims <- time_num_clusters + memory_num_clusters +
plot_annotation(tag_levels = "a")
ggsave(
here::here("figures", "final", "num-clusters-sims.pdf"),
num_cluster_sims,
width = 20,
height = 12,
units = "in"
)
# Zero expression consequences
all_logfc_scatter <- readRDS(
here::here("figures", "raw", "log-fc-scatter.rds")
) +
ggtitle("pbmc3k data")
volcano_plot <- readRDS(
here::here("figures", "raw", "volcano-plot.rds")
)
zero_expression <- all_logfc_scatter + volcano_plot +
plot_annotation(tag_levels = "a")
zero_expression
ggsave(
here::here("figures", "final", "zero-expression.pdf"),
zero_expression,
width = 12,
height = 8,
units = "in"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment