Last updated: 2023-12-06
Checks: 7 0
Knit directory: mi_spatialomics/
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(20230612)
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 2dcd178. 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/.DS_Store
Ignored: analysis/.Rhistory
Ignored: analysis/deprecated/.DS_Store
Ignored: analysis/molecular_cartography_python/.DS_Store
Ignored: analysis/molecular_cartography_python/figures/
Ignored: analysis/seqIF_python/.DS_Store
Ignored: data/.DS_Store
Ignored: data/140623.calcagno_et_al.seurat_object.rds
Ignored: data/Calcagno2022_int_logNorm_annot.h5Seurat
Ignored: data/mol_cart.heart_regions/
Ignored: data/pixie.cell_table_size_normalized_cell_labels.csv
Ignored: data/results_cts_100.sqm
Ignored: data/seqIF_regions_annotations/
Ignored: data/seurat/
Ignored: figures/.DS_Store
Ignored: figures/Figure_5.pathway_plot.pdf
Ignored: figures/Figure_5.pca_plot.pdf
Ignored: figures/Figure_5.pca_plot.png
Ignored: figures/Figure_5.volcano_plot.pdf
Ignored: figures/Figure_5.vwf_expression_plot.pdf
Ignored: figures/Figure_5.vwf_specificity_plot.pdf
Ignored: figures/Supplementary_figure_3.segmentation_metrics.eps
Ignored: figures/Supplementary_figure_3.segmentation_metrics.png
Ignored: figures/figures.supplementary_figure4.png
Ignored: figures/mol_cart.Figure_2.gains.pdf
Ignored: figures/mol_cart.Figure_2.misty_gains.pdf
Ignored: figures/mol_cart.Myeloid_distribution.png
Ignored: figures/mol_cart.Nppa_distribution.eps
Ignored: figures/mol_cart.Nppa_distribution.pdf
Ignored: figures/mol_cart.Nppa_distribution.png
Ignored: figures/supplementary_figure4.cell_type_distributions.eps
Ignored: figures/supplementary_figure4.cell_type_distributions.png
Ignored: omnipathr-log/
Ignored: output/.DS_Store
Ignored: output/mol_cart.harmony_object.h5Seurat
Ignored: output/mol_cart/
Ignored: output/molkart_cell_types/
Ignored: output/proteomics/
Ignored: output/seqIF/
Ignored: plots/.DS_Store
Ignored: plots/Figure1.umap_plot.pdf
Ignored: plots/Figure3.ccr2_monomacro_regions.pdf
Ignored: plots/Figure3.cell_types_overtimes.pdf
Ignored: plots/Figure3.pixel_clusters_overtimes.pdf
Ignored: plots/mol_cart.Figure_2.ct_percentage.pdf
Ignored: plots/molkart.squidpy.co_occurrence_plot.CMs_Nppa.sample_2d_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.CMs_Nppa.sample_2d_r2_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.CMs_Nppa.sample_control_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.CMs_Nppa.sample_control_r2_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Endocardial_cells.sample_2d_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Endocardial_cells.sample_2d_r2_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Endocardial_cells.sample_control_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Endocardial_cells.sample_control_r2_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Myeloid_cells.sample_2d_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Myeloid_cells.sample_2d_r2_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Myeloid_cells.sample_control_r1_s1.png
Ignored: plots/molkart.squidpy.co_occurrence_plot.Myeloid_cells.sample_control_r2_s1.png
Ignored: plots/molkart.squidpy.nhood_enrichment_plot.sample_2d_r1_s1.png
Ignored: plots/molkart.squidpy.nhood_enrichment_plot.sample_2d_r2_s1.png
Ignored: plots/molkart.squidpy.nhood_enrichment_plot.sample_control_r1_s1.png
Ignored: plots/molkart.squidpy.nhood_enrichment_plot.sample_control_r2_s1.png
Ignored: references/.DS_Store
Ignored: renv/library/
Ignored: renv/staging/
Unstaged changes:
Modified: plots/Figure1.dotplot.pdf
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/figures.Figure2.Rmd
) and
HTML (docs/figures.Figure2.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 | 2dcd178 | FloWuenne | 2023-12-06 | wflow_publish("*") |
html | 2dcd178 | FloWuenne | 2023-12-06 | wflow_publish("*") |
Rmd | 5dee03d | FloWuenne | 2023-09-04 | Latest code update. |
library(Seurat)
Loading required package: SeuratObject
Loading required package: sp
'SeuratObject' was built with package 'Matrix' 1.6.3 but the current
version is 1.6.4; it is recomended that you reinstall 'SeuratObject' as
the ABI for 'Matrix' may have changed
Attaching package: 'SeuratObject'
The following object is masked from 'package:base':
intersect
#options(Seurat.object.assay.version = 'v5')
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(scales)
Attaching package: 'scales'
The following object is masked from 'package:purrr':
discard
The following object is masked from 'package:readr':
col_factor
library(pals)
library(patchwork)
library(mistyR)
mistyR is able to run computationally intensive functions
in parallel. Please consider specifying a future::plan(). For example by running
future::plan(future::multisession) before calling mistyR functions.
library(ClusterR)
library(future)
library(ggbeeswarm)
source("./code/functions.R")
Attaching package: 'cowplot'
The following object is masked from 'package:patchwork':
align_plots
The following object is masked from 'package:lubridate':
stamp
here() starts at /Users/florian_wuennemann/1_Projects/MI_project/mi_spatialomics
## If the object has already been computed
seurat_object <- readRDS(file = "./output/mol_cart/molkart.harmony_seurat_object.rds")
metadata <- seurat_object@meta.data
cell_type_proportions_per_sample <- metadata %>%
group_by(anno_cell_type_lv2,timepoint,sample_ID) %>%
tally() %>%
ungroup() %>%
group_by(timepoint) %>%
mutate("ct_perc_time" = n / sum(n)) %>%
ungroup()
## Mean and points version
cell_type_proportions_per_sample$anno_cell_type_lv2 <- gsub("_"," ",cell_type_proportions_per_sample$anno_cell_type_lv2)
## Set order of cell types in plot from most abundant to least abundant
total_cells <- cell_type_proportions_per_sample %>%
group_by(anno_cell_type_lv2) %>%
summarise("total_cells" = sum(n)) %>%
arrange(desc(total_cells))
cell_type_proportions_per_sample$anno_cell_type_lv2 <- factor(cell_type_proportions_per_sample$anno_cell_type_lv2,
levels = total_cells$anno_cell_type_lv2)
## Set color palette for cell-types in molecular cartography data
arr <- list(x = -10, y = -15, x_len = 5, y_len = 5)
cell_types <- unique(unique(cell_type_proportions_per_sample$anno_cell_type_lv2))
colors <- cols25(n=length(cell_types))
named_colors <- colors
names(named_colors) <- cell_types
ct_time_barplot_v2 <- ggplot(cell_type_proportions_per_sample,aes(x = timepoint,y = ct_perc_time, fill = anno_cell_type_lv2)) +
stat_summary(
fun.y = mean,
geom = "bar",
width = 1,
color = "black") +
geom_beeswarm(size = 2.5, pch = 21, color = "black", fill= "white") +
facet_grid(. ~ anno_cell_type_lv2) +
theme_bw() +
theme(axis.title = element_text(face="bold")) +
theme(axis.text.x = element_text(size = 14,angle = 45, vjust = 0.5, hjust=1),
strip.text.x = element_text(size = 14, colour = "black", angle = 90, face = "bold"),
strip.background = element_blank(),
legend.position = "none") +
labs(x = "",
y = "% total cells") +
scale_fill_manual(values = named_colors)
Warning: The `fun.y` argument of `stat_summary()` is deprecated as of ggplot2 3.3.0.
ℹ Please use the `fun` argument instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
generated.
ct_time_barplot_v2
Version | Author | Date |
---|---|---|
2dcd178 | FloWuenne | 2023-12-06 |
save_plot(ct_time_barplot_v2,filename = here("./plots/mol_cart.Figure_2.ct_percentage.pdf"),
base_height = 6,
base_asp = 2)
expression_plot_list <- list()
samples <- c("sample_control_r1_s1","sample_4h_r1_s1",
"sample_2d_r2_s1","sample_4d_r1_s1")
cluster_of_int <- "Cardiomyocytes_Nppa+"
for(this_sample in samples){
pt_size <- 0.6
sample_object <- subset(seurat_object,sample_ID == this_sample)
meta <- sample_object@meta.data
time <- unique(sample_object$timepoint)
highlight_plot <- ggplot(meta,aes(Y_centroid,X_centroid)) +
geom_point(data = subset(meta,!seurat_clusters %in% cluster_of_int),color = "darkgrey", size = pt_size) +
# geom_point(data = subset(meta,seurat_clusters %in% cluster_of_int),aes(color = seurat_clusters), size = pt_size) +
geom_point(data = subset(meta,anno_cell_type_lv2 == cluster_of_int),color = "#6A33C2", size = 1) +
#theme_classic() +
labs(x = "Spatial 1",
y = "Spatial 2",
title = time) +
theme(axis.ticks = element_blank(),
axis.text = element_blank(),
legend.position = "right")
expression_plot_list[[this_sample]] <- highlight_plot
}
time_plot <- wrap_plots(expression_plot_list, nrow = 1, ncol = 4)
print(time_plot)
Version | Author | Date |
---|---|---|
2dcd178 | FloWuenne | 2023-12-06 |
time_plot
Version | Author | Date |
---|---|---|
2dcd178 | FloWuenne | 2023-12-06 |
filename <- paste("./figures/mol_cart.Nppa_distribution.png",sep = "")
save_plot(time_plot,
filename = filename,
base_height = 3,
base_asp = 2.5)
expression_plot_list <- list()
samples <- c("sample_control_r1_s1","sample_4h_r1_s1",
"sample_2d_r2_s1","sample_4d_r1_s1")
cluster_of_int <- "Myeloid_cells"
for(this_sample in samples){
pt_size <- 0.6
sample_object <- subset(seurat_object,sample_ID == this_sample)
meta <- sample_object@meta.data
time <- unique(sample_object$timepoint)
highlight_plot <- ggplot(meta,aes(Y_centroid,X_centroid)) +
geom_point(data = subset(meta,!seurat_clusters %in% cluster_of_int),color = "darkgrey", size = pt_size) +
# geom_point(data = subset(meta,seurat_clusters %in% cluster_of_int),aes(color = seurat_clusters), size = pt_size) +
geom_point(data = subset(meta,anno_cell_type_lv2 == cluster_of_int),color = "#565656", size = 1) +
#theme_classic() +
labs(x = "Spatial 1",
y = "Spatial 2",
title = time) +
theme(axis.ticks = element_blank(),
axis.text = element_blank(),
legend.position = "right")
expression_plot_list[[this_sample]] <- highlight_plot
}
time_plot <- wrap_plots(expression_plot_list, nrow = 1, ncol = 4)
print(time_plot)
Version | Author | Date |
---|---|---|
2dcd178 | FloWuenne | 2023-12-06 |
time_plot
Version | Author | Date |
---|---|---|
2dcd178 | FloWuenne | 2023-12-06 |
filename <- paste("./figures/mol_cart.Myeloid_distribution.png",sep = "")
save_plot(time_plot,
filename = filename,
base_height = 3,
base_asp = 2.5)
sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.1.2
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] RColorBrewer_1.1-3 here_1.0.1 ggsci_3.0.0 cowplot_1.1.1
[5] ggbeeswarm_0.7.2 future_1.33.0 ClusterR_1.3.2 mistyR_1.10.0
[9] patchwork_1.1.3 pals_1.8 scales_1.3.0 lubridate_1.9.3
[13] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
[17] readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.4
[21] tidyverse_2.0.0 Seurat_5.0.1 SeuratObject_5.0.1 sp_2.1-2
[25] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] rstudioapi_0.15.0 jsonlite_1.8.8 magrittr_2.0.3
[4] spatstat.utils_3.0-4 farver_2.1.1 rmarkdown_2.25
[7] ragg_1.2.6 fs_1.6.3 vctrs_0.6.5
[10] ROCR_1.0-11 spatstat.explore_3.2-5 htmltools_0.5.7
[13] sass_0.4.7 sctransform_0.4.1 parallelly_1.36.0
[16] KernSmooth_2.23-22 bslib_0.6.1 htmlwidgets_1.6.3
[19] ica_1.0-3 plyr_1.8.9 plotly_4.10.3
[22] zoo_1.8-12 cachem_1.0.8 whisker_0.4.1
[25] igraph_1.5.1 mime_0.12 lifecycle_1.0.4
[28] pkgconfig_2.0.3 Matrix_1.6-4 R6_2.5.1
[31] fastmap_1.1.1 fitdistrplus_1.1-11 shiny_1.8.0
[34] digest_0.6.33 colorspace_2.1-0 ps_1.7.5
[37] rprojroot_2.0.4 tensor_1.5 RSpectra_0.16-1
[40] irlba_2.3.5.1 textshaping_0.3.7 labeling_0.4.3
[43] progressr_0.14.0 timechange_0.2.0 fansi_1.0.5
[46] spatstat.sparse_3.0-3 httr_1.4.7 polyclip_1.10-6
[49] abind_1.4-5 compiler_4.3.1 withr_2.5.2
[52] fastDummies_1.7.3 highr_0.10 maps_3.4.1.1
[55] MASS_7.3-60 tools_4.3.1 vipor_0.4.5
[58] lmtest_0.9-40 beeswarm_0.4.0 httpuv_1.6.12
[61] future.apply_1.11.0 goftest_1.2-3 glue_1.6.2
[64] callr_3.7.3 nlme_3.1-164 promises_1.2.1
[67] grid_4.3.1 Rtsne_0.16 getPass_0.2-2
[70] cluster_2.1.6 reshape2_1.4.4 generics_0.1.3
[73] gtable_0.3.4 spatstat.data_3.0-3 tzdb_0.4.0
[76] hms_1.1.3 data.table_1.14.8 utf8_1.2.4
[79] spatstat.geom_3.2-7 RcppAnnoy_0.0.21 ggrepel_0.9.4
[82] RANN_2.6.1 pillar_1.9.0 spam_2.10-0
[85] RcppHNSW_0.5.0 later_1.3.1 splines_4.3.1
[88] lattice_0.22-5 gmp_0.7-3 renv_1.0.3
[91] survival_3.5-7 deldir_2.0-2 tidyselect_1.2.0
[94] miniUI_0.1.1.1 pbapply_1.7-2 knitr_1.45
[97] git2r_0.33.0 gridExtra_2.3 scattermore_1.2
[100] xfun_0.41 matrixStats_1.1.0 stringi_1.8.2
[103] lazyeval_0.2.2 yaml_2.3.7 evaluate_0.23
[106] codetools_0.2-19 BiocManager_1.30.22 cli_3.6.1
[109] uwot_0.1.16 systemfonts_1.0.5 xtable_1.8-4
[112] reticulate_1.34.0 munsell_0.5.0 processx_3.8.2
[115] jquerylib_0.1.4 dichromat_2.0-0.1 Rcpp_1.0.11
[118] globals_0.16.2 spatstat.random_3.2-2 mapproj_1.2.11
[121] png_0.1-8 parallel_4.3.1 ellipsis_0.3.2
[124] dotCall64_1.1-1 listenv_0.9.0 viridisLite_0.4.2
[127] ggridges_0.5.4 crayon_1.5.2 leiden_0.4.3.1
[130] rlang_1.1.2