Last updated: 2020-12-23

Checks: 7 0

Knit directory: meta-liver/

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 d4f78fa. 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/human-diehl-nafld_cache/
    Ignored:    analysis/human-hampe13-nash_cache/
    Ignored:    analysis/human-hampe14-misc_cache/
    Ignored:    analysis/human-hoang-nafld_cache/
    Ignored:    analysis/human-ramnath-fibrosis_cache/
    Ignored:    analysis/meta-chronic-vs-acute_cache/
    Ignored:    analysis/meta-mouse-vs-human_cache/
    Ignored:    analysis/mouse-acute-apap_cache/
    Ignored:    analysis/mouse-acute-bdl_cache/
    Ignored:    analysis/mouse-acute-ccl4_cache/
    Ignored:    analysis/mouse-acute-lps_cache/
    Ignored:    analysis/mouse-acute-ph_cache/
    Ignored:    analysis/mouse-acute-tunicamycin_cache/
    Ignored:    analysis/mouse-chronic-ccl4_cache/
    Ignored:    analysis/plot-acute-apap_cache/
    Ignored:    analysis/plot-acute-bdl_cache/
    Ignored:    analysis/plot-acute-ccl4_cache/
    Ignored:    analysis/plot-acute-ph_cache/
    Ignored:    analysis/plot-chronic-ccl4_cache/
    Ignored:    analysis/plot-chronic-vs-acute_cache/
    Ignored:    analysis/plot-precision-recall_cache/
    Ignored:    code/.DS_Store
    Ignored:    code/README.html
    Ignored:    data/.DS_Store
    Ignored:    data/README.html
    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/
    Ignored:    external_software/.DS_Store
    Ignored:    external_software/README.html
    Ignored:    external_software/stem/.DS_Store
    Ignored:    figures/
    Ignored:    output/.DS_Store
    Ignored:    output/README.html
    Ignored:    output/human-diehl-nafld/
    Ignored:    output/human-hampe13-nash/
    Ignored:    output/human-hampe14-misc/
    Ignored:    output/human-hoang-nafld/
    Ignored:    output/human-ramnath-fibrosis/
    Ignored:    output/meta-chronic-vs-acute/
    Ignored:    output/meta-mouse-vs-human/
    Ignored:    output/mouse-acute-apap/
    Ignored:    output/mouse-acute-bdl/
    Ignored:    output/mouse-acute-ccl4/
    Ignored:    output/mouse-acute-lps/
    Ignored:    output/mouse-acute-ph/
    Ignored:    output/mouse-acute-tunicamycin/
    Ignored:    output/mouse-chronic-ccl4/
    Ignored:    renv/library/
    Ignored:    renv/staging/

Unstaged changes:
    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/plot-study-overview.Rmd) and HTML (docs/plot-study-overview.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 d4f78fa christianholland 2020-12-23 wflow_publish("analysis/*.Rmd", delete_cache = T)
html 35ed693 christianholland 2020-12-22 Build site.
Rmd ee67260 christianholland 2020-12-22 fixed style
html 20b3ee2 christianholland 2020-12-21 Build site.
Rmd e8798d3 christianholland 2020-12-21 added plotting script

Introduction

Here we generate plots display various features of all included studies.

Libraries and sources

These libraries and sources are used for this analysis.

library(tidyverse)
library(tidylog)
library(here)
library(glue)

library(AachenColorPalette)
library(scales)
library(circlize)
library(patchwork)

source(here("code/utils-plots.R"))

Definition of global variables that are used throughout this analysis.

# graphical parameters
# fontsize
fz <- 7
# color function for heatmaps
col_fun <- colorRamp2(
  c(-4, 0, 4),
  c(aachen_color("blue"), "white", aachen_color("red"))
)

# 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"))

Studied individuals

Mouse models

df <- readRDS(here("output/meta-chronic-vs-acute/meta_data.rds")) %>%
  count(treatment, source, class, group) %>%
  mutate(label = case_when(
    treatment == "apap" ~ "APAP",
    treatment == "bdl" ~ "BDL",
    treatment == "ccl4" ~ "CCl4 (Acute)",
    treatment == "lps" ~ "LPS",
    treatment == "ph" ~ "PH",
    treatment == "tunicamycin" ~ "Tunicamycin",
    treatment == "pure_ccl4" ~ "CCl4 (Chronic)"
  )) %>%
  mutate(group = str_to_title(group))

stitle <- df %>%
  group_by(group) %>%
  tally(n) %>%
  mutate(total = sum(n)) %>%
  pivot_wider(names_from = group, values_from = n) %>%
  mutate(label = glue("Total: {total} ({Control}/{Treated})")) %>%
  pull(label)

num_mouse <- df %>%
  ggplot(aes(
    x = n, fct_reorder(label, n),
    group = group, fill = group
  )) +
  geom_col(position = "dodge") +
  labs(
    x = "Number of mice", y = "Study", subtitle = stitle,
    fill = NULL
  ) +
  my_theme(grid = "x", fsize = fz) +
  scale_fill_manual(values = aachen_color(c("blue75", "red75")))

num_mouse

Version Author Date
35ed693 christianholland 2020-12-22
20b3ee2 christianholland 2020-12-21

Patient cohorts

keys <- key_hs %>%
  distinct(source, phenotype, author2)

df <- readRDS(here("output/meta-mouse-vs-human/meta_data.rds")) %>%
  inner_join(keys) %>%
  count(author2, class) %>%
  mutate(class = str_to_title(class))

stitle <- df %>%
  group_by(class) %>%
  tally(n) %>%
  mutate(total = sum(n)) %>%
  pivot_wider(names_from = class, values_from = n) %>%
  mutate(label = glue("Total: {total} ({Control}/{Disease})")) %>%
  pull(label)

num_patient <- df %>%
  ggplot(aes(
    x = n, fct_reorder(author2, n),
    group = class, fill = class
  )) +
  geom_col(position = "dodge") +
  labs(
    x = "Number of patients", y = "Study", subtitle = stitle,
    fill = NULL
  ) +
  my_theme(grid = "x", fsize = fz) +
  scale_fill_manual(values = aachen_color(c("blue75", "red75")))

num_patient

Version Author Date
35ed693 christianholland 2020-12-22
20b3ee2 christianholland 2020-12-21

Gene coverage

Mouse models

keys <- key_mm %>%
  distinct(contrast, treatment_abbr, class)

mm <- readRDS(here("output/meta-chronic-vs-acute/limma_result.rds")) %>%
  select(-treatment, -class) %>%
  inner_join(keys, by = "contrast") %>%
  distinct(gene, treatment_abbr, class) %>%
  count(treatment_abbr, class) %>%
  mutate(group = case_when(
    str_detect(treatment_abbr, "CCl4") ~ str_c(treatment_abbr, " (", class, ")"),
    TRUE ~ as.character(treatment_abbr)
  ))

gene_coverage_mm <- mm %>%
  ggplot(aes(x = n, fct_reorder(group, n), group = class)) +
  geom_col() +
  geom_text(aes(x = n, y = fct_reorder(group, n), label = n),
    size = (fz - 2) / (14 / 5), color = "white", hjust = 1.5
  ) +
  labs(x = "Gene coverage", y = NULL) +
  my_theme(grid = "x", fsize = fz) +
  theme(
    legend.position = "top",
    axis.line = element_blank(),
    axis.ticks = element_blank()
  ) +
  scale_x_continuous(labels = label_number_si())

gene_coverage_mm

Version Author Date
35ed693 christianholland 2020-12-22
20b3ee2 christianholland 2020-12-21

Patient cohorts

keys <- key_hs %>%
  distinct(contrast, source, phenotype, author2)

hs <- readRDS(here("output/meta-mouse-vs-human/limma_result.rds")) %>%
  inner_join(keys) %>%
  distinct(gene, author2) %>%
  count(author2)

gene_coverage_hs <- hs %>%
  ggplot(aes(x = n, fct_reorder(author2, n))) +
  geom_col() +
  geom_text(aes(x = n, y = fct_reorder(author2, n), label = n),
    size = (fz - 2) / (14 / 5), color = "white", hjust = 1.5
  ) +
  labs(x = "Gene coverage", y = NULL) +
  my_theme(grid = "x", fsize = fz) +
  theme(
    legend.position = "top",
    axis.line = element_blank(),
    axis.ticks = element_blank()
  ) +
  scale_x_continuous(labels = label_number_si())

gene_coverage_hs

Version Author Date
35ed693 christianholland 2020-12-22
20b3ee2 christianholland 2020-12-21

Collage

Supplementary Figure 0.1

sfig0_1 <- (num_mouse + num_patient) /
  (gene_coverage_mm + gene_coverage_hs) +
  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")
  )

sfig0_1

Version Author Date
35ed693 christianholland 2020-12-22

ggsave(here("figures/Supplementary Figure 0.1.pdf"), sfig0_1,
  width = 21, height = 10, units = c("cm")
)
ggsave(here("figures/Supplementary Figure 0.1.png"), sfig0_1,
  width = 21, height = 10, units = c("cm")
)

Time spend to execute this analysis: 00:06 minutes.


sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> 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] stats     graphics  grDevices datasets  utils     methods   base     
#> 
#> other attached packages:
#>  [1] patchwork_1.1.1          circlize_0.4.11          scales_1.1.1            
#>  [4] AachenColorPalette_1.1.2 glue_1.4.2               here_1.0.1              
#>  [7] tidylog_1.0.2            forcats_0.5.0            stringr_1.4.0           
#> [10] dplyr_1.0.2              purrr_0.3.4              readr_1.4.0             
#> [13] tidyr_1.1.2              tibble_3.0.4             ggplot2_3.3.2           
#> [16] tidyverse_1.3.0          workflowr_1.6.2         
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.5          lubridate_1.7.9.2   clisymbols_1.2.0   
#>  [4] assertthat_0.2.1    rprojroot_2.0.2     digest_0.6.27      
#>  [7] R6_2.5.0            cellranger_1.1.0    backports_1.2.1    
#> [10] reprex_0.3.0        evaluate_0.14       httr_1.4.2         
#> [13] pillar_1.4.7        GlobalOptions_0.1.2 rlang_0.4.9        
#> [16] readxl_1.3.1        rstudioapi_0.13     whisker_0.4        
#> [19] rmarkdown_2.6       labeling_0.4.2      munsell_0.5.0      
#> [22] broom_0.7.3         compiler_4.0.2      httpuv_1.5.4       
#> [25] modelr_0.1.8        xfun_0.19           pkgconfig_2.0.3    
#> [28] shape_1.4.5         htmltools_0.5.0     tidyselect_1.1.0   
#> [31] codetools_0.2-16    fansi_0.4.1         crayon_1.3.4       
#> [34] dbplyr_2.0.0        withr_2.3.0         later_1.1.0.1      
#> [37] grid_4.0.2          jsonlite_1.7.2      gtable_0.3.0       
#> [40] lifecycle_0.2.0     DBI_1.1.0           git2r_0.27.1       
#> [43] magrittr_2.0.1      cli_2.2.0           stringi_1.5.3      
#> [46] farver_2.0.3        renv_0.12.3         fs_1.5.0           
#> [49] promises_1.1.1      xml2_1.3.2          ellipsis_0.3.1     
#> [52] generics_0.1.0      vctrs_0.3.6         cowplot_1.1.0      
#> [55] tools_4.0.2         hms_0.5.3           yaml_2.2.1         
#> [58] colorspace_2.0-0    rvest_0.3.6         knitr_1.30         
#> [61] haven_2.3.1