Last updated: 2021-07-06
Checks: 7 0
Knit directory: liver-disease-atlas/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20201218)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 1dfe908. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/01-mouse-chronic-ccl4_cache/
Ignored: analysis/01.1-mouse-chronic-ccl4-etoh_cache/
Ignored: analysis/01.2-mouse-chronic-ccl4-wtd_cache/
Ignored: analysis/02-mouse-acute-apap_cache/
Ignored: analysis/03-mouse-acute-ccl4_cache/
Ignored: analysis/04-mouse-acute-ph_cache/
Ignored: analysis/05-mouse-acute-bdl_cache/
Ignored: analysis/06-mouse-acute-lps_cache/
Ignored: analysis/07-mouse-acute-tunicamycin_cache/
Ignored: analysis/08-human-diehl-nafld_cache/
Ignored: analysis/09-human-hampe13-nash_cache/
Ignored: analysis/10-human-hampe14-misc_cache/
Ignored: analysis/11-human-hoang-nafld_cache/
Ignored: analysis/12-human-ramnath-fibrosis_cache/
Ignored: analysis/13-meta-chronic-vs-acute_cache/
Ignored: analysis/14-meta-mouse-vs-human_cache/
Ignored: analysis/15-plot-chronic-ccl4_cache/
Ignored: analysis/16-plot-acute-apap_cache/
Ignored: analysis/17-plot-acute-ccl4_cache/
Ignored: analysis/18-plot-acute-ph_cache/
Ignored: analysis/19-plot-acute-bdl_cache/
Ignored: analysis/20-plot-study-overview_cache/
Ignored: analysis/21-plot-chronic-vs-acute_cache/
Ignored: analysis/22-plot-mouse-vs-human_cache/
Ignored: analysis/24-save-tables_cache/
Ignored: code/.DS_Store
Ignored: code/README.html
Ignored: code/meta-mouse-vs-human/.DS_Store
Ignored: data.zip
Ignored: data/.DS_Store
Ignored: data/Icon
Ignored: data/annotation/
Ignored: data/human-diehl-nafld/
Ignored: data/human-hampe13-nash/
Ignored: data/human-hampe14-misc/
Ignored: data/human-hoang-nafld/
Ignored: data/human-ramnath-fibrosis/
Ignored: data/meta-chronic-vs-acute/
Ignored: data/meta-mouse-vs-human/
Ignored: data/mouse-acute-apap/
Ignored: data/mouse-acute-bdl/
Ignored: data/mouse-acute-ccl4/
Ignored: data/mouse-acute-lps/
Ignored: data/mouse-acute-ph/
Ignored: data/mouse-acute-tunicamycin/
Ignored: data/mouse-chronic-ccl4-wtd/
Ignored: data/mouse-chronic-ccl4/
Ignored: external_software/.DS_Store
Ignored: external_software/README.html
Ignored: external_software/stem/.DS_Store
Ignored: figures/.DS_Store
Ignored: figures/Figure 1 (partial).pdf
Ignored: figures/Figure 1.pdf
Ignored: figures/Figure 1.png
Ignored: figures/Figure 2 (partial).pdf
Ignored: figures/Figure 2.pdf
Ignored: figures/Figure 2.png
Ignored: figures/Figure 3.pdf
Ignored: figures/Figure 3.png
Ignored: figures/Figure 4.pdf
Ignored: figures/Figure 4.png
Ignored: figures/Figure 5.pdf
Ignored: figures/Figure 5.png
Ignored: figures/Figure 6.pdf
Ignored: figures/Figure 6.png
Ignored: figures/Icon
Ignored: figures/Supplementary Figure 0.1.pdf
Ignored: figures/Supplementary Figure 0.1.png
Ignored: figures/Supplementary Figure 1.1.pdf
Ignored: figures/Supplementary Figure 1.1.png
Ignored: figures/Supplementary Figure 2.1.pdf
Ignored: figures/Supplementary Figure 2.1.png
Ignored: figures/Supplementary Figure 2.2.pdf
Ignored: figures/Supplementary Figure 2.2.png
Ignored: figures/Supplementary Figure 2.3.pdf
Ignored: figures/Supplementary Figure 2.3.png
Ignored: figures/Supplementary Figure 2.4.pdf
Ignored: figures/Supplementary Figure 2.4.png
Ignored: figures/Supplementary Figure 2.5.pdf
Ignored: figures/Supplementary Figure 2.5.png
Ignored: figures/Supplementary Figure 2.6.pdf
Ignored: figures/Supplementary Figure 2.6.png
Ignored: figures/Supplementary Figure 2.7.pdf
Ignored: figures/Supplementary Figure 2.7.png
Ignored: figures/Supplementary Figure 3.1.pdf
Ignored: figures/Supplementary Figure 3.1.png
Ignored: figures/Supplementary Figure 3.2.pdf
Ignored: figures/Supplementary Figure 3.2.png
Ignored: figures/Supplementary Figure 3.3.pdf
Ignored: figures/Supplementary Figure 3.3.png
Ignored: figures/Supplementary Figure 3.4.pdf
Ignored: figures/Supplementary Figure 3.4.png
Ignored: figures/Supplementary Figure 4.1.pdf
Ignored: figures/Supplementary Figure 4.1.png
Ignored: figures/Supplementary Figure 4.2.pdf
Ignored: figures/Supplementary Figure 4.2.png
Ignored: figures/Supplementary Figure 6.1.pdf
Ignored: figures/Supplementary Figure 6.1.png
Ignored: figures/Supplementary Figure 6.2.pdf
Ignored: figures/Supplementary Figure 6.2.png
Ignored: figures/figures.key
Ignored: figures/histologies.key
Ignored: figures/panels/
Ignored: figures/tmp/.DS_Store
Ignored: figures/tmp/Fig5A1.pdf
Ignored: figures/tmp/Fig5A2.pdf
Ignored: figures/tmp/Icon
Ignored: geo_submission/
Ignored: output/.DS_Store
Ignored: output/Icon
Ignored: output/README.html
Ignored: output/human-diehl-nafld/Icon
Ignored: output/human-diehl-nafld/limma_result.rds
Ignored: output/human-diehl-nafld/meta_data.rds
Ignored: output/human-diehl-nafld/normalized_expression.rds
Ignored: output/human-diehl-nafld/pca_result.rds
Ignored: output/human-diehl-nafld/z_scores.rds
Ignored: output/human-hampe13-nash/Icon
Ignored: output/human-hampe13-nash/limma_result.rds
Ignored: output/human-hampe13-nash/meta_data.rds
Ignored: output/human-hampe13-nash/normalized_expression.rds
Ignored: output/human-hampe13-nash/pca_result.rds
Ignored: output/human-hampe13-nash/z_scores.rds
Ignored: output/human-hampe14-misc/Icon
Ignored: output/human-hampe14-misc/limma_result.rds
Ignored: output/human-hampe14-misc/meta_data.rds
Ignored: output/human-hampe14-misc/normalized_expression.rds
Ignored: output/human-hampe14-misc/pca_result.rds
Ignored: output/human-hampe14-misc/z_scores.rds
Ignored: output/human-hoang-nafld/Icon
Ignored: output/human-hoang-nafld/limma_result.rds
Ignored: output/human-hoang-nafld/normalized_expression.rds
Ignored: output/human-hoang-nafld/pca_result.rds
Ignored: output/human-hoang-nafld/z_scores.rds
Ignored: output/human-ramnath-fibrosis/Icon
Ignored: output/human-ramnath-fibrosis/limma_result.rds
Ignored: output/human-ramnath-fibrosis/normalized_expression.rds
Ignored: output/human-ramnath-fibrosis/pca_result.rds
Ignored: output/human-ramnath-fibrosis/z_scores.rds
Ignored: output/meta-chronic-vs-acute/Icon
Ignored: output/meta-chronic-vs-acute/acute_gene_pool.rds
Ignored: output/meta-chronic-vs-acute/chronic_gene_pool.rds
Ignored: output/meta-chronic-vs-acute/exclusive_genes_characterization.rds
Ignored: output/meta-chronic-vs-acute/gene_membership.rds
Ignored: output/meta-chronic-vs-acute/gene_set_similarity.rds
Ignored: output/meta-chronic-vs-acute/go_cluster_ranking.rds
Ignored: output/meta-chronic-vs-acute/go_wordcounts.rds
Ignored: output/meta-chronic-vs-acute/interstudy_enrichment.rds
Ignored: output/meta-chronic-vs-acute/limma_result.rds
Ignored: output/meta-chronic-vs-acute/meta_data.rds
Ignored: output/meta-chronic-vs-acute/pca_dist.rds
Ignored: output/meta-chronic-vs-acute/ranked_common_genes.rds
Ignored: output/meta-chronic-vs-acute/ranked_exclusive_acute_genes.rds
Ignored: output/meta-chronic-vs-acute/ranked_exclusive_chronic_genes.rds
Ignored: output/meta-chronic-vs-acute/union_acute_geneset.rds
Ignored: output/meta-chronic-vs-acute/union_chronic_geneset.rds
Ignored: output/meta-chronic-vs-acute/z_score_pca.rds
Ignored: output/meta-mouse-vs-human/Icon
Ignored: output/meta-mouse-vs-human/basel_gene_expression_levels.rds
Ignored: output/meta-mouse-vs-human/chronic_mouse_deg_numbers.rds
Ignored: output/meta-mouse-vs-human/consistent_genes.rds
Ignored: output/meta-mouse-vs-human/cross_species_enrichment.rds
Ignored: output/meta-mouse-vs-human/cross_species_similarity.rds
Ignored: output/meta-mouse-vs-human/etiology_gene_sets.rds
Ignored: output/meta-mouse-vs-human/gene_set_similarity.rds
Ignored: output/meta-mouse-vs-human/go_cluster_ranking.rds
Ignored: output/meta-mouse-vs-human/go_wordcounts.rds
Ignored: output/meta-mouse-vs-human/gsea_res.rds
Ignored: output/meta-mouse-vs-human/individual_le.rds
Ignored: output/meta-mouse-vs-human/interstudy_enrichment.rds
Ignored: output/meta-mouse-vs-human/leading_edges.rds
Ignored: output/meta-mouse-vs-human/leading_edges_characterization.rds
Ignored: output/meta-mouse-vs-human/leading_edges_mgi.rds
Ignored: output/meta-mouse-vs-human/limma_result.rds
Ignored: output/meta-mouse-vs-human/meta_data.rds
Ignored: output/meta-mouse-vs-human/precision_recall.rds
Ignored: output/meta-mouse-vs-human/precision_recall_chronicity.rds
Ignored: output/meta-mouse-vs-human/teufel_genes.rds
Ignored: output/meta-mouse-vs-human/teufel_genes_hs.rds
Ignored: output/meta-mouse-vs-human/z_score_pca.rds
Ignored: output/mouse-acute-apap/.DS_Store
Ignored: output/mouse-acute-apap/Icon
Ignored: output/mouse-acute-apap/limma_result.rds
Ignored: output/mouse-acute-apap/meta_data.rds
Ignored: output/mouse-acute-apap/normalized_expression.rds
Ignored: output/mouse-acute-apap/pca_result.rds
Ignored: output/mouse-acute-apap/stem/.DS_Store
Ignored: output/mouse-acute-apap/stem/Icon
Ignored: output/mouse-acute-apap/stem/input/Icon
Ignored: output/mouse-acute-apap/stem/input/apap.txt
Ignored: output/mouse-acute-apap/stem_characterization.rds
Ignored: output/mouse-acute-apap/stem_result.rds
Ignored: output/mouse-acute-apap/z_scores.rds
Ignored: output/mouse-acute-bdl/.DS_Store
Ignored: output/mouse-acute-bdl/Icon
Ignored: output/mouse-acute-bdl/limma_result.rds
Ignored: output/mouse-acute-bdl/meta_data.rds
Ignored: output/mouse-acute-bdl/normalized_expression.rds
Ignored: output/mouse-acute-bdl/pca_result.rds
Ignored: output/mouse-acute-bdl/stem/.DS_Store
Ignored: output/mouse-acute-bdl/stem/Icon
Ignored: output/mouse-acute-bdl/stem/input/Icon
Ignored: output/mouse-acute-bdl/stem/input/bdl.txt
Ignored: output/mouse-acute-bdl/stem_characterization.rds
Ignored: output/mouse-acute-bdl/stem_result.rds
Ignored: output/mouse-acute-bdl/z_scores.rds
Ignored: output/mouse-acute-ccl4/.DS_Store
Ignored: output/mouse-acute-ccl4/Icon
Ignored: output/mouse-acute-ccl4/limma_result.rds
Ignored: output/mouse-acute-ccl4/meta_data.rds
Ignored: output/mouse-acute-ccl4/normalized_expression.rds
Ignored: output/mouse-acute-ccl4/pca_result.rds
Ignored: output/mouse-acute-ccl4/stem/.DS_Store
Ignored: output/mouse-acute-ccl4/stem/Icon
Ignored: output/mouse-acute-ccl4/stem/input/Icon
Ignored: output/mouse-acute-ccl4/stem/input/ccl4.txt
Ignored: output/mouse-acute-ccl4/stem_characterization.rds
Ignored: output/mouse-acute-ccl4/stem_result.rds
Ignored: output/mouse-acute-ccl4/z_scores.rds
Ignored: output/mouse-acute-lps/Icon
Ignored: output/mouse-acute-lps/limma_result.rds
Ignored: output/mouse-acute-lps/meta_data.rds
Ignored: output/mouse-acute-lps/normalized_expression.rds
Ignored: output/mouse-acute-lps/pca_result.rds
Ignored: output/mouse-acute-lps/z_scores.rds
Ignored: output/mouse-acute-ph/.DS_Store
Ignored: output/mouse-acute-ph/Icon
Ignored: output/mouse-acute-ph/limma_result.rds
Ignored: output/mouse-acute-ph/meta_data.rds
Ignored: output/mouse-acute-ph/normalized_expression.rds
Ignored: output/mouse-acute-ph/pca_result.rds
Ignored: output/mouse-acute-ph/stem/.DS_Store
Ignored: output/mouse-acute-ph/stem/Icon
Ignored: output/mouse-acute-ph/stem/input/Icon
Ignored: output/mouse-acute-ph/stem/input/hepatec.txt
Ignored: output/mouse-acute-ph/stem_characterization.rds
Ignored: output/mouse-acute-ph/stem_result.rds
Ignored: output/mouse-acute-ph/z_scores.rds
Ignored: output/mouse-acute-tunicamycin/Icon
Ignored: output/mouse-acute-tunicamycin/limma_result.rds
Ignored: output/mouse-acute-tunicamycin/meta_data.rds
Ignored: output/mouse-acute-tunicamycin/normalized_expression.rds
Ignored: output/mouse-acute-tunicamycin/pca_result.rds
Ignored: output/mouse-acute-tunicamycin/z_scores.rds
Ignored: output/mouse-chronic-ccl4/.DS_Store
Ignored: output/mouse-chronic-ccl4/Icon
Ignored: output/mouse-chronic-ccl4/limma_result.rds
Ignored: output/mouse-chronic-ccl4/limma_result_hs.rds
Ignored: output/mouse-chronic-ccl4/normalized_expression.rds
Ignored: output/mouse-chronic-ccl4/pca_result.rds
Ignored: output/mouse-chronic-ccl4/stem/.DS_Store
Ignored: output/mouse-chronic-ccl4/stem/Icon
Ignored: output/mouse-chronic-ccl4/stem/input/Icon
Ignored: output/mouse-chronic-ccl4/stem/input/pure_ccl4.txt
Ignored: output/mouse-chronic-ccl4/stem_characterization.rds
Ignored: output/mouse-chronic-ccl4/stem_result.rds
Ignored: output/mouse-chronic-ccl4/z_scores.rds
Ignored: renv/library/
Ignored: renv/staging/
Ignored: tables/Supplementary Table 1.xlsx
Ignored: tables/Supplementary Table xy consistent_genes.xlsx
Ignored: tables/Supplementary Table xy exclusive_common_genes.xlsx
Ignored: tables/Supplementary Table xy human_degs.xlsx
Ignored: tables/Supplementary Table xy stem_results.xlsx
Untracked files:
Untracked: code/mouse-chronic-ccl4-etoh/
Untracked: code/mouse-chronic-ccl4-wtd/
Untracked: data/mouse-chronic-ccl4-etoh/
Untracked: output/mouse-chronic-ccl4-etoh/
Untracked: output/mouse-chronic-ccl4-wtd/
Unstaged changes:
Modified: README.Rmd
Modified: README.md
Modified: analysis/_site.yml
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/23-plot-precision-recall.Rmd
) and HTML (docs/23-plot-precision-recall.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 1dfe908 | christianholland | 2021-07-06 | plot pr for combined treated models |
html | a8fc0b0 | christianholland | 2021-03-29 | Build site. |
html | f0ca212 | christianholland | 2021-03-04 | Build site. |
Rmd | 25862ff | christianholland | 2021-03-04 | removed geom_text |
html | 52cba93 | christianholland | 2021-02-28 | Build site. |
Rmd | d36bb1e | christianholland | 2021-02-28 | wflow_publish(“analysis/23-plot-precision-recall.Rmd”, delete_cache = TRUE) |
html | 24c0c74 | christianholland | 2021-02-28 | Build site. |
html | 5e36b25 | christianholland | 2021-02-28 | Build site. |
Rmd | 7f331d0 | christianholland | 2021-02-28 | wflow_publish("analysis/*", delete_cache = TRUE, republish = TRUE) |
Here we generate publication-ready plots for the integration of further chronic mouse models.
These libraries and sources are used for this analysis.
library(tidyverse)
library(tidylog)
library(here)
library(AachenColorPalette)
library(scales)
library(UpSetR)
library(grid)
library(lemon)
library(ggrepel)
library(magick)
library(patchwork)
library(pdftools)
library(gtools)
source(here("code/utils-plots.R"))
Definition of global variables and functions that are used throughout this analysis.
# i/o
data_path <- "data/meta-mouse-vs-human"
output_path <- "output/meta-mouse-vs-human"
# graphical parameters
# fontsize
fz <- 9
# keys to annotate contrasts
key_mm <- readRDS(here("data/meta-chronic-vs-acute/contrast_annotation.rds"))
key_hs <- readRDS(here("data/meta-mouse-vs-human/contrast_annotation.rds"))
keys <- key_mm %>%
distinct(study = contrast, label2)
df <- readRDS(here(output_path, "chronic_mouse_deg_numbers.rds")) %>%
left_join(keys, by = "study") %>%
mutate(label2 = coalesce(label2, study)) %>%
mutate(regulation = fct_rev(str_to_title(regulation)))
num_genes <- df %>%
ggplot(aes(y = fct_reorder(label2, n, sum), x = n, fill = regulation)) +
geom_col(position = "dodge") +
labs(
x = "Number of differentially expressed genes",
y = "Chronic mouse model",
fill = "Regulation"
) +
scale_x_log10(
breaks = trans_breaks("log10", function(x) 10^x),
labels = trans_format("log10", scales::math_format(10^.x))
) +
my_theme(grid = "x", fsize = fz) +
scale_fill_manual(values = aachen_color(c("red75", "blue75"))) +
annotation_logticks(sides = "b")
num_genes
Version | Author | Date |
---|---|---|
3340593 | christianholland | 2021-02-28 |
contrast_keys_human <- key_hs %>%
distinct(contrast, label, source, phenotype) %>%
unite(contrast, source, phenotype, contrast, sep = "-")
contrast_keys_mouse <- key_mm %>%
filter(str_detect(contrast, "pure")) %>%
distinct(contrast, label)
keys <- bind_rows(contrast_keys_mouse, contrast_keys_human)
o <- readRDS(here(output_path, "cross_species_similarity.rds"))
oo <- o %>%
rename(contrast = set1) %>%
left_join(keys, by = "contrast") %>%
mutate(label = coalesce(label, contrast)) %>%
rename(set1 = label, contrast = set2, contrast_set1 = contrast) %>%
left_join(keys, by = "contrast") %>%
mutate(label = coalesce(label, contrast)) %>%
rename(set2 = label, contrast_set2 = contrast) %>%
mutate(
contrast_set1 = factor(contrast_set1, levels = levels(o$set1)),
contrast_set2 = factor(contrast_set2, levels = levels(o$set2)),
set1 = fct_reorder(set1, as.numeric(contrast_set1)),
set2 = fct_reorder(set2, as.numeric(contrast_set2))
) %>%
select(set1, set2, similarity)
gs_sim <- oo %>%
filter(!str_detect(set1, "NAFLD|NASH|PSC|PBC|HCV")) %>%
filter(!str_detect(set2, "WTD|HF|PTEN|MCD|STZ|CCl4")) %>%
ggplot(aes(
x = set1, y = set2, fill = similarity,
label = round(similarity, 3)
)) +
geom_tile() +
scale_fill_gradient(low = "white", high = aachen_color("green")) +
labs(x = NULL, y = NULL, fill = "Overlap\ncoefficient") +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
axis.line = element_blank(),
axis.ticks = element_blank()
) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
my_theme(fsize = fz, grid = "no")
gs_sim
Version | Author | Date |
---|---|---|
3340593 | christianholland | 2021-02-28 |
contrast_keys_human <- key_hs %>%
distinct(contrast, label, source) %>%
unite(contrast, source, contrast)
contrast_keys_mouse <- key_mm %>%
filter(str_detect(contrast, "pure")) %>%
distinct(contrast, label)
keys <- bind_rows(contrast_keys_mouse, contrast_keys_human)
gsea_res <- readRDS(here(output_path, "cross_species_enrichment.rds")) %>%
rename(contrast = signature) %>%
inner_join(keys, by = "contrast") %>%
select(-contrast) %>%
rename(signature = label, contrast = geneset) %>%
left_join(keys, by = "contrast") %>%
mutate(label = coalesce(label, contrast)) %>%
select(-contrast) %>%
rename(geneset = label) %>%
mutate(direction = fct_rev(str_to_title(direction)))
tile_up <- gsea_res %>%
filter(direction == "Up") %>%
mutate(
label = stars.pval(padj),
direction = fct_rev(direction)
) %>%
ggplot(aes(x = signature, y = geneset, fill = ES)) +
geom_tile() +
geom_text(aes(label = label)) +
facet_rep_wrap(~direction, scales = "free", ncol = 1) +
my_theme(grid = "no", fsize = fz) +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
axis.line = element_blank(),
axis.ticks = element_blank()
) +
scale_fill_gradient2(
low = aachen_color("blue"), mid = "white",
high = aachen_color("red"), limits = c(-1, 1)
) +
my_theme(grid = "no", fsize = fz) +
labs(x = "Signature", y = "Gene Set", fill = "ES") +
guides(fill = guide_colorbar(title = "ES"))
box_up <- gsea_res %>%
filter(direction == "Up") %>%
ggplot(aes(y = geneset, x = ES)) +
geom_boxplot() +
facet_rep_wrap(~direction, ncol = 1) +
geom_vline(xintercept = 0) +
my_theme(fsize = fz, grid = "x") +
theme(
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank()
)
tile_down <- gsea_res %>%
filter(direction == "Down") %>%
mutate(
label = stars.pval(padj),
direction = fct_rev(direction)
) %>%
ggplot(aes(x = signature, y = geneset, fill = ES)) +
geom_tile() +
geom_text(aes(label = label)) +
facet_rep_wrap(~direction, scales = "free", ncol = 1) +
my_theme(grid = "no", fsize = fz) +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
axis.line = element_blank(),
axis.ticks = element_blank()
) +
scale_fill_gradient2(
low = aachen_color("blue"), mid = "white",
high = aachen_color("red"), limits = c(-1, 1)
) +
my_theme(grid = "no", fsize = fz) +
labs(x = "Signature", y = "Gene Set", fill = "ES") +
guides(fill = guide_colorbar(title = "ES"))
box_down <- gsea_res %>%
filter(direction == "Down") %>%
ggplot(aes(y = geneset, x = ES)) +
geom_boxplot() +
facet_rep_wrap(~direction, ncol = 1) +
geom_vline(xintercept = 0) +
my_theme(fsize = fz, grid = "x") +
theme(
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.line.y = element_blank(),
axis.ticks.y = element_blank()
)
tile_up + box_up
Version | Author | Date |
---|---|---|
3340593 | christianholland | 2021-02-28 |
tile_down + box_down
Version | Author | Date |
---|---|---|
3340593 | christianholland | 2021-02-28 |
df <- readRDS(here(output_path, "etiology_gene_sets.rds"))
mat_up <- df %>%
filter(regulation == "up") %>%
select(-regulation) %>%
mutate(val = 1) %>%
spread(etiology, val, fill = 0) %>%
data.frame(row.names = 1)
pdf(file = here("figures/tmp/Fig5A1.pdf"), width = 15, height = 10, onefile = F)
upset(mat_up,
nintersects = NA, mainbar.y.label = "Common genes",
sets.x.label = "Total number of genes",
text.scale = 3, point.size = 5
)
grid.text("Up", x = 0.65, y = 0.95, gp = gpar(fontsize = fz * 4))
dev.off()
#> quartz_off_screen
#> 2
mat_down <- df %>%
filter(regulation == "down") %>%
select(-regulation) %>%
mutate(val = 1) %>%
spread(etiology, val, fill = 0) %>%
data.frame(row.names = 1)
pdf(file = here("figures/tmp/Fig5A2.pdf"), width = 15, height = 10, onefile = F)
upset(mat_down,
nintersects = NA, mainbar.y.label = "Common genes",
sets.x.label = "Total number of genes",
text.scale = 3, point.size = 5
)
grid.text("Down", x = 0.65, y = 0.95, gp = gpar(fontsize = fz * 4))
dev.off()
#> quartz_off_screen
#> 2
keys <- key_mm %>%
distinct(study = contrast, label2)
pr <- readRDS(here(output_path, "precision_recall.rds")) %>%
left_join(keys, by = "study") %>%
mutate(label2 = coalesce(label2, study)) %>%
mutate(regulation = fct_rev(str_to_title(regulation))) %>%
mutate(x = case_when(
str_detect(label2, "12 Month") ~ as.character(label2),
TRUE ~ NA_character_
)) %>%
mutate(etiology = factor(etiology, levels = c(
"NAFLD", "NASH", "HCV", "PSC",
"PBC"
))) %>%
mutate(label2 = case_when(
str_detect(label2, "HF12") ~ "High-fat diet (12 Weeks)",
str_detect(label2, "HF18") ~ "High-fat diet (18 Weeks)",
str_detect(label2, "HF30") ~ "High-fat diet (30 Weeks)",
str_detect(label2, "STZ12") ~ "Streptozocin diet (12 Weeks)",
str_detect(label2, "STZ18") ~ "Streptozocin diet (18 Weeks)",
str_detect(label2, "MCD4") ~ "Methionine- and choline-deficient diet (4 Weeks)",
str_detect(label2, "MCD8") ~ "Methionine- and choline-deficient diet (8 Weeks)",
str_detect(label2, "WTD") ~ "Western-type diet (12 Weeks)",
str_detect(label2, "PTEN") ~ "PTEN knockout mice",
TRUE ~ as.character(label2)
)) %>%
mutate(label2 = factor(label2, levels = c(
"CCl4 (2 Months)", "CCl4 (6 Months)", "CCl4 (12 Months)",
"High-fat diet (12 Weeks)", "High-fat diet (18 Weeks)",
"High-fat diet (30 Weeks)", "Streptozocin diet (12 Weeks)",
"Streptozocin diet (18 Weeks)",
"Methionine- and choline-deficient diet (4 Weeks)",
"Methionine- and choline-deficient diet (8 Weeks)",
"Western-type diet (12 Weeks)",
"PTEN knockout mice"
)))
pr_plot_mm <- pr %>%
ggplot(aes(x = recall, y = precision, label = x, color = label2)) +
geom_point() +
facet_rep_grid(regulation ~ etiology) +
# geom_text_repel(size = fz / (14 / 5), show.legend = FALSE, na.rm = TRUE) +
geom_abline(lty = "dashed") +
expand_limits(x = 0, y = 0) +
labs(x = "Recall", y = "Precision", color = "Mouse model") +
my_theme(fsize = fz) +
scale_color_viridis_d(direction = -1, option = "B") +
theme(legend.position = "top") +
guides(col = guide_legend(nrow = 4))
pr_plot_mm
keys <- key_mm %>%
distinct(study = contrast, label2)
pr <- readRDS(here(output_path, "precision_recall.rds")) %>%
left_join(keys, by = "study") %>%
mutate(label2 = coalesce(label2, study)) %>%
mutate(regulation = fct_rev(str_to_title(regulation))) %>%
mutate(x = case_when(
str_detect(label2, "12 Month") ~ as.character(label2),
TRUE ~ NA_character_
)) %>%
mutate(etiology = factor(etiology, levels = c(
"NAFLD", "NASH", "HCV", "PSC",
"PBC"
))) %>%
filter(str_detect(study, "effect|ccl")) %>%
mutate(label2 = case_when(
str_detect(study, "ccl_effect$") ~ "CCl4",
str_detect(study, "etoh_effect") ~ "EtOH",
str_detect(study, "combined_effect$") ~ "CCl4 + EtOH",
str_detect(study, "combined_effect_12w") ~ "CCl4 + WTD (12 Weeks)",
str_detect(study, "combined_effect_24w") ~ "CCl4 + WTD (24 Weeks)",
str_detect(study, "wd_effect_12w") ~ "WTD (12 Weeks)",
str_detect(study, "wd_effect_24w") ~ "WTD (24 Weeks)",
str_detect(study, "ccl_effect_12w") ~ "CCl4 (12 Weeks)",
str_detect(study, "ccl_effect_24w") ~ "CCl4 (24 Weeks)",
TRUE ~ as.character(label2)
)) %>%
mutate(label2 = factor(label2, levels = c(
"CCl4 (2 Months)", "CCl4 (6 Months)", "CCl4 (12 Months)",
"CCl4", "EtOH", "CCl4 + EtOH", "CCl4 (12 Weeks)", "WTD (12 Weeks)",
"CCl4 + WTD (12 Weeks)", "CCl4 (24 Weeks)", "WTD (24 Weeks)",
"CCl4 + WTD (24 Weeks)"
))) %>%
mutate(source = case_when(
str_detect(label2, "Months") ~ "Present study",
str_detect(label2, "Weeks") ~ "Tsuchida et al.",
TRUE ~ "Furuya et al."
))
pr_plot_mm_etoh <- pr %>%
filter(source %in% c("Present study", "Furuya et al.")) %>%
ggplot(aes(x = recall, y = precision, label = x, color = label2)) +
geom_point(aes(shape = source)) +
facet_rep_grid(regulation ~ etiology) +
geom_abline(lty = "dashed") +
expand_limits(x = 0, y = 0) +
labs(x = "Recall", y = "Precision", color = "Mouse model", shape = "Study") +
my_theme(fsize = fz) +
scale_color_viridis_d(direction = -1, option = "B") +
theme(legend.position = "top") +
guides(col = guide_legend(order = 1, nrow = 3))
pr_plot_mm_wtd <- pr %>%
filter(source == "Tsuchida et al.") %>%
ggplot(aes(x = recall, y = precision, label = x, color = label2)) +
geom_point(aes(shape = source)) +
facet_rep_grid(regulation ~ etiology) +
geom_abline(lty = "dashed") +
expand_limits(x = 0, y = 0) +
labs(x = "Recall", y = "Precision", color = "Mouse model", shape = "Study") +
my_theme(fsize = fz) +
scale_color_viridis_d(direction = -1, option = "B") +
theme(legend.position = "top") +
guides(col = guide_legend(order = 1, nrow = 3)) +
scale_x_continuous(breaks = c(0, 0.1, 0.2))
pr_plot_mm_etoh
pr_plot_mm_wtd
pr <- readRDS(here(output_path, "precision_recall_chronicity.rds")) %>%
mutate(
etiology = factor(etiology, levels = c("NAFLD", "NASH", "HCV", "PSC", "PBC")),
regulation = factor(str_to_title(regulation), levels = c("Up", "Down")),
class = case_when(
str_detect(class, "acute") ~ "Exclusive acute",
str_detect(class, "chronic") ~ "Exclusive chronic",
str_detect(class, "common") ~ "Common in chronic and acute"
),
class = factor(class, levels = c(
"Exclusive chronic",
"Exclusive acute",
"Common in chronic and acute"
))
)
set.seed(123)
pr_plot_category <- pr %>%
ggplot(aes(
x = recall, y = precision, label = class,
color = class
)) +
geom_jitter(width = 0.0015, height = 0) +
facet_rep_grid(regulation ~ etiology) +
geom_abline(lty = "dashed") +
expand_limits(x = 0, y = 0) +
labs(x = "Recall", y = "Precision", color = "Category") +
my_theme(fsize = fz) +
scale_color_manual(values = aachen_color(c("bordeaux", "orange", "petrol"))) +
theme(legend.position = "top")
pr_plot_category
Version | Author | Date |
---|---|---|
3340593 | christianholland | 2021-02-28 |
Main Figure.
upset_up <- image_ggplot(image_read_pdf(here("figures/tmp/Fig5A1.pdf")),
interpolate = TRUE
)
# file.remove(here("figures/tmp/Fig5A1.pdf"))
upset_down <- image_ggplot(image_read_pdf(here("figures/tmp/Fig5A2.pdf")),
interpolate = TRUE
)
# file.remove(here("figures/tmp/Fig5A2.pdf"))
fig6 <- (upset_up | upset_down) /
((pr_plot_mm / pr_plot_category) + plot_layout(heights = c(1, 1))) +
plot_layout(height = c(1, 3)) +
plot_annotation(tag_levels = list(c("A", "", "B", "C"))) &
theme(
plot.tag = element_text(size = fz + 3, face = "bold"),
legend.key.height = unit(11.5, "pt"),
legend.key.width = unit(12.5, "pt")
)
fig6
ggsave(here("figures/Figure 6.pdf"), fig6,
width = 21, height = 29.7, units = c("cm")
)
ggsave(here("figures/Figure 6.png"), fig6,
width = 21, height = 29.7, units = c("cm")
)
sfig6_1 <- ((num_genes | gs_sim) + plot_layout(width = c(1, 2))) +
# ((tile_up + box_up) + plot_layout(width = c(4, 1), guides = "collect")) /
# ((tile_down + box_down) + plot_layout(width = c(4, 1), guides = "collect")) +
plot_annotation(tag_levels = list(c("A", "B", "C", "", "D"))) &
theme(
plot.tag = element_text(size = fz + 3, face = "bold"),
legend.key.height = unit(11.5, "pt"),
legend.key.width = unit(12.5, "pt")
)
sfig6_1
ggsave(here("figures/Supplementary Figure 6.1.pdf"), sfig6_1,
width = 21, height = 10, units = c("cm")
)
ggsave(here("figures/Supplementary Figure 6.1.png"), sfig6_1,
width = 21, height = 10, units = c("cm")
)
sfig6_2 <- pr_plot_mm_etoh / pr_plot_mm_wtd &
plot_annotation(tag_levels = list(c("A", "B", "C", "", "D"))) &
theme(
plot.tag = element_text(size = fz + 3, face = "bold"),
legend.key.height = unit(11.5, "pt"),
legend.key.width = unit(12.5, "pt")
)
sfig6_2
ggsave(here("figures/Supplementary Figure 6.2.pdf"), sfig6_2,
width = 21, height = 21, units = c("cm")
)
ggsave(here("figures/Supplementary Figure 6.2.png"), sfig6_2,
width = 21, height = 21, units = c("cm")
)
Time spend to execute this analysis: 00:59 minutes.
sessionInfo()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Mojave 10.14.5
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] grid stats graphics grDevices datasets utils methods
#> [8] base
#>
#> other attached packages:
#> [1] gtools_3.8.2 pdftools_2.3.1 patchwork_1.1.1
#> [4] magick_2.5.2 ggrepel_0.9.0 lemon_0.4.5
#> [7] UpSetR_1.4.0 scales_1.1.1 AachenColorPalette_1.1.2
#> [10] here_1.0.1 tidylog_1.0.2 forcats_0.5.0
#> [13] stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4
#> [16] readr_1.4.0 tidyr_1.1.2 tibble_3.0.4
#> [19] ggplot2_3.3.2 tidyverse_1.3.0 workflowr_1.6.2
#>
#> loaded via a namespace (and not attached):
#> [1] httr_1.4.2 viridisLite_0.3.0 jsonlite_1.7.2 modelr_0.1.8
#> [5] assertthat_0.2.1 askpass_1.1 renv_0.12.3 cellranger_1.1.0
#> [9] yaml_2.2.1 qpdf_1.1 pillar_1.4.7 backports_1.2.1
#> [13] lattice_0.20-41 glue_1.4.2 digest_0.6.27 promises_1.1.1
#> [17] rvest_0.3.6 colorspace_2.0-0 cowplot_1.1.0 htmltools_0.5.0
#> [21] httpuv_1.5.4 plyr_1.8.6 clisymbols_1.2.0 pkgconfig_2.0.3
#> [25] broom_0.7.3 haven_2.3.1 whisker_0.4 later_1.1.0.1
#> [29] git2r_0.27.1 farver_2.0.3 generics_0.1.0 ellipsis_0.3.1
#> [33] withr_2.3.0 cli_2.2.0 magrittr_2.0.1 crayon_1.3.4
#> [37] readxl_1.3.1 evaluate_0.14 fs_1.5.0 fansi_0.4.1
#> [41] xml2_1.3.2 tools_4.0.5 hms_0.5.3 lifecycle_0.2.0
#> [45] munsell_0.5.0 reprex_0.3.0 compiler_4.0.5 rlang_0.4.9
#> [49] rstudioapi_0.13 labeling_0.4.2 rmarkdown_2.6 codetools_0.2-18
#> [53] gtable_0.3.0 DBI_1.1.0 R6_2.5.0 gridExtra_2.3
#> [57] lubridate_1.7.9.2 knitr_1.30 rprojroot_2.0.2 stringi_1.5.3
#> [61] Rcpp_1.0.5 vctrs_0.3.6 dbplyr_2.0.0 tidyselect_1.1.0
#> [65] xfun_0.19