Last updated: 2024-10-07
Checks: 7 0
Knit directory: paed-inflammation-CITEseq/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). 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(20240216)
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 6c10980. 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: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/obsolete/
Ignored: data/C133_Neeland_batch1/
Ignored: data/C133_Neeland_merged/
Ignored: renv/library/
Ignored: renv/staging/
Untracked files:
Untracked: analysis/figure/
Untracked: code/background_job.R
Untracked: code/reverse_modifier_severity_comparisons.sh
Untracked: data/Proteins_T-NK_07.10.24.csv
Untracked: data/Proteins_macs_07.10.24.csv
Unstaged changes:
Modified: .gitignore
Modified: analysis/09.0_integrate_cluster_macro_cells.Rmd
Modified: analysis/14.0_proportions_analysis_ann_level_1.Rmd
Modified: analysis/15.0_Figure_1.Rmd
Modified: code/utility.R
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/17.0_Supplementary_Figure_ADTs.Rmd
) and HTML
(docs/17.0_Supplementary_Figure_ADTs.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 | 6c10980 | Jovana Maksimovic | 2024-10-07 | wflow_publish("analysis/17.0_Supplementary_Figure_ADTs.Rmd") |
Load libraries.
suppressPackageStartupMessages({
library(SingleCellExperiment)
library(edgeR)
library(tidyverse)
library(ggplot2)
library(Seurat)
library(glmGamPoi)
library(dittoSeq)
library(here)
library(clustree)
library(patchwork)
library(AnnotationDbi)
library(org.Hs.eg.db)
library(glue)
library(speckle)
library(tidyHeatmap)
library(paletteer)
library(dsb)
library(ggh4x)
})
files <- list.files(here("data/C133_Neeland_merged"),
pattern = "C133_Neeland_full_clean.*(macrophages|t_cells|other_cells)_annotated_full.SEU.rds",
full.names = TRUE)
seuLst <- lapply(files[2:4], function(f) readRDS(f))
adt_names <- rownames(seuLst[[1]][["ADT"]]@counts)
seuLst <- lapply(seuLst, function(s){
DefaultAssay(s) <- "ADT"
if(!all(rownames(s) == adt_names)){
adt_counts <- s[["ADT"]]@counts
rownames(adt_counts) <- adt_names
CreateSeuratObject(counts = adt_counts,
assay = "ADT",
meta.data = s@meta.data)
} else {
DietSeurat(s, assays = "ADT", dimreducs = NULL)
}
})
seuADT <- merge(seuLst[[1]],
y = c(seuLst[[2]],
seuLst[[3]]))
seuADT <- seuADT[, seuADT$Batch != 0]
seuADT
An object of class Seurat
163 features across 168859 samples within 1 assay
Active assay: ADT (163 features, 0 variable features)
Visualise ADTs Make data frame of proteins, clusters, expression levels.
out <- here("data",
"C133_Neeland_merged",
glue("C133_Neeland_full_clean_all_cells_dsb.ADT.rds"))
read_csv(file = here("data",
"C133_Neeland_batch1",
"data",
"sample_sheets",
"ADT_features.csv")) -> adt_data
pattern <- "anti-human/mouse |anti-human/mouse/rat |anti-mouse/human "
adt_data$name <- gsub(pattern, "", adt_data$name)
if(!file.exists(out)){
adt_data %>%
dplyr::filter(grepl("[Ii]sotype", name)) %>%
pull(name) -> isotype_controls
# normalise ADT using DSB normalisation
adt_dsb <- ModelNegativeADTnorm(cell_protein_matrix = seuADT[["ADT"]]@counts,
denoise.counts = TRUE,
use.isotype.control = TRUE,
isotype.control.name.vec = isotype_controls)
saveRDS(adt_dsb, file = out)
} else {
adt_dsb <- readRDS(out)
}
seuADT[["ADT"]]@data <- adt_dsb
seuADT
An object of class Seurat
163 features across 168859 samples within 1 assay
Active assay: ADT (163 features, 0 variable features)
ADTs <- read_csv(file = here("data",
"Proteins_macs_22.04.22.csv"))
pattern <- "anti-human/mouse |anti-human/mouse/rat |anti-mouse/human |anti-human "
ADTs$Description <- gsub(pattern, "", ADTs$Description)
seuADT@meta.data %>%
dplyr::filter(ann_level_1 == "macrophages") %>%
dplyr::select(ann_level_3) %>%
rownames_to_column(var = "cell") %>%
inner_join(as.data.frame(t(seuADT[["ADT"]]@data)) %>%
rownames_to_column(var = "cell")) %>%
pivot_longer(c(-cell, -ann_level_3),
names_to = "ADT",
values_to = "Expression") %>%
dplyr::group_by(ann_level_3, ADT) %>%
dplyr::summarize(Expression = mean(Expression)) %>%
ungroup() %>%
dplyr::filter(ADT %in% ADTs$Description) -> dat
plot(density(dat$Expression))
dat %>%
dplyr::rename("Protein" = "ADT",
"DSB Exp." = "Expression",
"Cell type" = "ann_level_3") %>%
tidyHeatmap::heatmap(
.column = Protein,
.row = `Cell type`,
.value = `DSB Exp.`,
scale = "none",
rect_gp = grid::gpar(col = "white", lwd = 1),
show_row_names = TRUE,
cluster_rows = FALSE,
cluster_columns = FALSE,
column_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
column_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
row_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
row_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
column_title_side = "top",
palette_value = circlize::colorRamp2(seq(-0.5, 2.5, length.out = 256),
viridis::magma(256)),
heatmap_legend_param = list(direction = "vertical")) %>%
add_tile(`Cell type`, show_legend = FALSE,
show_annotation_name = FALSE,
palette = paletteer_d("ggsci::category20_d3",
length(unique(dat$ann_level_3)))) %>%
as_ComplexHeatmap() -> sf1a
sf1a
ADTs <- read_csv(file = here("data",
"Proteins_T-NK_22.04.22.csv"))
pattern <- "anti-human/mouse |anti-human/mouse/rat |anti-mouse/human |anti-human "
ADTs$Description <- gsub(pattern, "", ADTs$Description)
seuADT@meta.data %>%
dplyr::filter(ann_level_1 %in% unique(seuLst[[2]]$ann_level_1)) %>%
dplyr::select(ann_level_3) %>%
rownames_to_column(var = "cell") %>%
inner_join(as.data.frame(t(seuADT[["ADT"]]@data)) %>%
rownames_to_column(var = "cell")) %>%
pivot_longer(c(-cell, -ann_level_3),
names_to = "ADT",
values_to = "Expression") %>%
dplyr::group_by(ann_level_3, ADT) %>%
dplyr::summarize(Expression = mean(Expression)) %>%
ungroup() %>%
dplyr::filter(ADT %in% ADTs$Description) -> dat
plot(density(dat$Expression))
dat %>%
dplyr::rename("Protein" = "ADT",
"DSB Exp." = "Expression",
"Cell type" = "ann_level_3") %>%
tidyHeatmap::heatmap(
.column = Protein,
.row = `Cell type`,
.value = `DSB Exp.`,
scale = "none",
rect_gp = grid::gpar(col = "white", lwd = 1),
show_row_names = TRUE,
cluster_rows = FALSE,
cluster_columns = FALSE,
column_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
column_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
row_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
row_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
column_title_side = "top",
palette_value = circlize::colorRamp2(seq(-0, 1.5, length.out = 256),
viridis::magma(256)),
heatmap_legend_param = list(direction = "vertical")) %>%
add_tile(`Cell type`, show_legend = FALSE,
show_annotation_name = FALSE,
palette = paletteer_d("ggsci::category20b_d3",
length(unique(dat$ann_level_3)))) %>%
as_ComplexHeatmap() -> sf1b
sf1b
ADTs <- read_csv(file = here("data",
"Proteins_other_22.04.22.csv"))
pattern <- "anti-human/mouse |anti-human/mouse/rat |anti-mouse/human |anti-human "
ADTs$Description <- gsub(pattern, "", ADTs$Description)
seuADT@meta.data %>%
dplyr::filter(ann_level_1 %in% unique(seuLst[[1]]$ann_level_1)) %>%
dplyr::select(ann_level_3) %>%
rownames_to_column(var = "cell") %>%
inner_join(as.data.frame(t(seuADT[["ADT"]]@data)) %>%
rownames_to_column(var = "cell")) %>%
pivot_longer(c(-cell, -ann_level_3),
names_to = "ADT",
values_to = "Expression") %>%
dplyr::group_by(ann_level_3, ADT) %>%
dplyr::summarize(Expression = mean(Expression)) %>%
ungroup() %>%
dplyr::filter(ADT %in% ADTs$Description) -> dat
plot(density(dat$Expression))
dat %>%
dplyr::rename("Protein" = "ADT",
"DSB Exp." = "Expression",
"Cell type" = "ann_level_3") %>%
tidyHeatmap::heatmap(
.column = Protein,
.row = `Cell type`,
.value = `DSB Exp.`,
scale = "none",
rect_gp = grid::gpar(col = "white", lwd = 1),
show_row_names = TRUE,
cluster_rows = FALSE,
cluster_columns = FALSE,
column_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
column_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
row_names_gp = grid::gpar(fontsize = 8, fontfamily = "arial"),
row_title_gp = grid::gpar(fontsize = 10, fontfamily = "arial"),
column_title_side = "top",
palette_value = circlize::colorRamp2(seq(-0.1, 2, length.out = 256),
viridis::magma(256)),
heatmap_legend_param = list(direction = "vertical")) %>%
add_tile(`Cell type`, show_legend = FALSE,
show_annotation_name = FALSE,
palette = paletteer_d("ggsci::category20c_d3",
length(unique(dat$ann_level_3)))) %>%
as_ComplexHeatmap() -> sf1c
sf1c
layout = "
A
B
C
"
(wrap_plots(list(sf1a %>%
ComplexHeatmap::draw(heatmap_legend_side = "right") %>%
grid::grid.grabExpr())) +
wrap_plots(list(sf1b %>%
ComplexHeatmap::draw(heatmap_legend_side = "right") %>%
grid::grid.grabExpr())) +
wrap_plots(list(sf1c %>%
ComplexHeatmap::draw(heatmap_legend_side = "right") %>%
grid::grid.grabExpr()))) +
plot_layout(design = layout) +
plot_annotation(tag_levels = list(c("A","B","C"))) &
theme(plot.tag = element_text(size = 16,
face = "bold",
family = "arial"))
sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
time zone: Etc/UTC
tzcode source: system (glibc)
attached base packages:
[1] stats4 stats graphics grDevices datasets utils methods
[8] base
other attached packages:
[1] ggh4x_0.2.8 dsb_1.0.3
[3] paletteer_1.6.0 tidyHeatmap_1.8.1
[5] speckle_1.2.0 glue_1.7.0
[7] org.Hs.eg.db_3.18.0 AnnotationDbi_1.64.1
[9] patchwork_1.2.0 clustree_0.5.1
[11] ggraph_2.2.0 here_1.0.1
[13] dittoSeq_1.14.2 glmGamPoi_1.14.3
[15] SeuratObject_4.1.4 Seurat_4.4.0
[17] lubridate_1.9.3 forcats_1.0.0
[19] stringr_1.5.1 dplyr_1.1.4
[21] purrr_1.0.2 readr_2.1.5
[23] tidyr_1.3.1 tibble_3.2.1
[25] ggplot2_3.5.0 tidyverse_2.0.0
[27] edgeR_4.0.15 limma_3.58.1
[29] SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0
[31] Biobase_2.62.0 GenomicRanges_1.54.1
[33] GenomeInfoDb_1.38.6 IRanges_2.36.0
[35] S4Vectors_0.40.2 BiocGenerics_0.48.1
[37] MatrixGenerics_1.14.0 matrixStats_1.2.0
[39] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] fs_1.6.3 spatstat.sparse_3.0-3 bitops_1.0-7
[4] httr_1.4.7 RColorBrewer_1.1-3 doParallel_1.0.17
[7] tools_4.3.3 sctransform_0.4.1 utf8_1.2.4
[10] R6_2.5.1 lazyeval_0.2.2 uwot_0.1.16
[13] GetoptLong_1.0.5 withr_3.0.0 sp_2.1-3
[16] gridExtra_2.3 progressr_0.14.0 cli_3.6.2
[19] Cairo_1.6-2 spatstat.explore_3.2-6 prismatic_1.1.1
[22] sass_0.4.8 spatstat.data_3.0-4 ggridges_0.5.6
[25] pbapply_1.7-2 parallelly_1.37.0 rstudioapi_0.15.0
[28] RSQLite_2.3.5 generics_0.1.3 shape_1.4.6
[31] ica_1.0-3 spatstat.random_3.2-2 vroom_1.6.5
[34] dendextend_1.17.1 Matrix_1.6-5 fansi_1.0.6
[37] abind_1.4-5 lifecycle_1.0.4 whisker_0.4.1
[40] yaml_2.3.8 SparseArray_1.2.4 Rtsne_0.17
[43] grid_4.3.3 blob_1.2.4 promises_1.2.1
[46] crayon_1.5.2 miniUI_0.1.1.1 lattice_0.22-5
[49] cowplot_1.1.3 KEGGREST_1.42.0 pillar_1.9.0
[52] knitr_1.45 ComplexHeatmap_2.18.0 rjson_0.2.21
[55] future.apply_1.11.1 codetools_0.2-19 leiden_0.4.3.1
[58] getPass_0.2-4 data.table_1.15.0 vctrs_0.6.5
[61] png_0.1-8 gtable_0.3.4 rematch2_2.1.2
[64] cachem_1.0.8 xfun_0.42 S4Arrays_1.2.0
[67] mime_0.12 tidygraph_1.3.1 survival_3.7-0
[70] pheatmap_1.0.12 iterators_1.0.14 statmod_1.5.0
[73] ellipsis_0.3.2 fitdistrplus_1.1-11 ROCR_1.0-11
[76] nlme_3.1-164 bit64_4.0.5 RcppAnnoy_0.0.22
[79] rprojroot_2.0.4 bslib_0.6.1 irlba_2.3.5.1
[82] KernSmooth_2.23-24 colorspace_2.1-0 DBI_1.2.1
[85] tidyselect_1.2.0 processx_3.8.3 bit_4.0.5
[88] compiler_4.3.3 git2r_0.33.0 DelayedArray_0.28.0
[91] plotly_4.10.4 scales_1.3.0 lmtest_0.9-40
[94] callr_3.7.3 digest_0.6.34 goftest_1.2-3
[97] spatstat.utils_3.0-4 rmarkdown_2.25 XVector_0.42.0
[100] htmltools_0.5.7 pkgconfig_2.0.3 highr_0.10
[103] fastmap_1.1.1 rlang_1.1.3 GlobalOptions_0.1.2
[106] htmlwidgets_1.6.4 shiny_1.8.0 farver_2.1.1
[109] jquerylib_0.1.4 zoo_1.8-12 jsonlite_1.8.8
[112] mclust_6.1 RCurl_1.98-1.14 magrittr_2.0.3
[115] GenomeInfoDbData_1.2.11 munsell_0.5.0 Rcpp_1.0.12
[118] viridis_0.6.5 reticulate_1.35.0 stringi_1.8.3
[121] zlibbioc_1.48.0 MASS_7.3-60.0.1 plyr_1.8.9
[124] parallel_4.3.3 listenv_0.9.1 ggrepel_0.9.5
[127] deldir_2.0-2 Biostrings_2.70.2 graphlayouts_1.1.0
[130] splines_4.3.3 tensor_1.5 hms_1.1.3
[133] circlize_0.4.15 locfit_1.5-9.8 ps_1.7.6
[136] igraph_2.0.1.1 spatstat.geom_3.2-8 reshape2_1.4.4
[139] evaluate_0.23 renv_1.0.3 BiocManager_1.30.22
[142] tzdb_0.4.0 foreach_1.5.2 tweenr_2.0.3
[145] httpuv_1.6.14 RANN_2.6.1 polyclip_1.10-6
[148] future_1.33.1 clue_0.3-65 scattermore_1.2
[151] ggforce_0.4.2 xtable_1.8-4 later_1.3.2
[154] viridisLite_0.4.2 memoise_2.0.1 cluster_2.1.6
[157] timechange_0.3.0 globals_0.16.2