Last updated: 2023-06-12
Checks: 6 1
Knit directory: mi_spatialomics/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown is untracked by Git. To know which version of the R
Markdown file created these results, you’ll want to first commit it to
the Git repo. If you’re still working on the analysis, you can ignore
this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
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 e3bbd70. 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: .Rproj.user/
Ignored: references/
Ignored: renv/library/
Ignored: renv/staging/
Untracked files:
Untracked: analysis/figures.Rmd
Untracked: analysis/figures.supplementary_Figure_3.Rmd
Untracked: analysis/figures.supplementary_figure_5.Rmd
Untracked: analysis/molkart.QC_spots.Rmd
Untracked: code/params_R.R
Untracked: figures/
Untracked: output/pca_spots.tsv
Untracked: output/spots_per_tissue.tsv
Untracked: output/tx_abundances_per_slide.tsv
Unstaged changes:
Modified: analysis/_site.yml
Modified: analysis/data_analysis.Rmd
Modified: renv.lock
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.
There are no past versions. Publish this analysis with
wflow_publish()
to start tracking its development.
# Load data
qc_dir <- "/Users/florian_wuennemann/1_Projects/MI_project/data/nf_MolCart_results/QC"
files <- fs::dir_ls(path = qc_dir, glob = "*csv")
qc_data <- vroom(files)
Rows: 64 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): sample_id, segmentation_method
dbl (6): total_cells, avg_area, total_spots, spot_assign_per_cell, spot_assi...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
qc_data <- qc_data %>%
separate(sample_id,
into = c("string","time","replicate","slide","segmentation"),
remove = TRUE) %>%
mutate("sample_ID" = paste(string,time,replicate,slide,sep= "_"))
Warning: Expected 5 pieces. Additional pieces discarded in 48 rows [2, 3, 4, 6, 7, 8,
10, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 26, 27, ...].
qc_data$avg_area <- qc_data$avg_area *0.138 * 0.138
qc_data$time <- factor(qc_data$time,
levels = c("control","4h","2d","4d"))
qc_data$segmentation_method <- factor(qc_data$segmentation_method,
levels = c("ilastik_multicut","cellpose",
"mesmer_wholecell","mesmer_nuclear"
))
final_samples <- c("sample_control_r1_s1","sample_control_r2_s1",
"sample_4h_r1_s1","sample_4h_r2_s2",
"sample_2d_r1_s1","sample_2d_r2_s1",
"sample_4d_r1_s2","sample_4d_r2_s1")
qc_data <- subset(qc_data,sample_ID %in% final_samples)
qc_data <- qc_data %>%
pivot_longer(total_cells:spot_assign_percent,
names_to = "group",
values_to = "values") %>%
subset(group %in% c("avg_area","spot_assign_per_cell","spot_assign_percent","total_cells"))
qc_data$group <- gsub("avg_area","Average area (uM^2)",qc_data$group)
qc_data$group <- gsub("spot_assign_per_cell","Spots / cell",qc_data$group)
qc_data$group <- gsub("spot_assign_percent","% spots in cells ",qc_data$group)
qc_data$group <- gsub("total_cells","Total # cells ",qc_data$group)
spots_assigned <- ggplot(qc_data,aes(segmentation_method,values)) +
geom_boxplot(aes(fill = segmentation_method)) +
coord_flip() +
scale_fill_brewer(palette = "Set1") +
scale_color_brewer(palette = "Set1") +
scale_x_discrete(labels=c("ilastik_multicut" = "Ilastik Multicut",
"cellpose" = "Cellpose",
"mesmer_wholecell" = "Mesmer - Whole cell",
"mesmer_nuclear" = "Mesmer - Nuclear")) +
labs(x = "",
y = "") +
theme(legend.position = "none") +
facet_grid(. ~ group, scales = "free") +
theme(plot.background = element_rect(fill = "white")) +
geom_beeswarm(fill = "white",color= "black",pch = 21) +
panel_border()
spots_assigned
save_plot(filename = here("./figures/Supplementary_figure_5.segmentation_metrics.png"),
plot = spots_assigned,
base_height = 6)
save_plot(filename = here("./figures/Supplementary_figure_5.segmentation_metrics.eps"),
plot = spots_assigned,
base_height = 5,
base_width = 10)
sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] ggbeeswarm_0.7.2 here_1.0.1 cowplot_1.1.1 ggpubr_0.6.0
[5] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 purrr_1.0.1
[9] readr_2.1.4 tidyr_1.3.0 ggplot2_3.4.2 tidyverse_2.0.0
[13] tibble_3.2.1 dplyr_1.1.2 vroom_1.6.3 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] httr_1.4.6 sass_0.4.6 bit64_4.0.5 jsonlite_1.8.4
[5] carData_3.0-5 bslib_0.4.2 getPass_0.2-2 highr_0.10
[9] renv_0.17.3 vipor_0.4.5 yaml_2.3.7 pillar_1.9.0
[13] backports_1.4.1 glue_1.6.2 digest_0.6.31 RColorBrewer_1.1-3
[17] promises_1.2.0.1 ggsignif_0.6.4 colorspace_2.1-0 htmltools_0.5.5
[21] httpuv_1.6.11 pkgconfig_2.0.3 broom_1.0.5 scales_1.2.1
[25] processx_3.8.0 whisker_0.4.1 later_1.3.1 tzdb_0.4.0
[29] timechange_0.2.0 git2r_0.32.0 generics_0.1.3 farver_2.1.1
[33] car_3.1-2 cachem_1.0.8 withr_2.5.0 cli_3.6.1
[37] magrittr_2.0.3 crayon_1.5.2 evaluate_0.21 ps_1.7.4
[41] fs_1.6.2 fansi_1.0.4 rstatix_0.7.2 beeswarm_0.4.0
[45] textshaping_0.3.6 tools_4.2.3 hms_1.1.3 lifecycle_1.0.3
[49] munsell_0.5.0 callr_3.7.3 compiler_4.2.3 jquerylib_0.1.4
[53] systemfonts_1.0.4 rlang_1.1.1 grid_4.2.3 rstudioapi_0.14
[57] labeling_0.4.2 rmarkdown_2.21 gtable_0.3.3 abind_1.4-5
[61] R6_2.5.1 knitr_1.42 fastmap_1.1.1 bit_4.0.5
[65] utf8_1.2.3 rprojroot_2.0.3 ragg_1.2.5 stringi_1.7.12
[69] parallel_4.2.3 Rcpp_1.0.10 vctrs_0.6.2 tidyselect_1.2.0
[73] xfun_0.39