Last updated: 2024-03-21
Checks: 7 0
Knit directory: Celina/
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(20231207)
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.
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:
Untracked files:
Untracked: .Rprofile
Untracked: .gitattributes
Untracked: .gitignore
Untracked: Celina.Rproj
Untracked: README.md
Untracked: _workflowr.yml
Untracked: analysis/
Untracked: code/
Untracked: data/
Untracked: output/
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.
While this is a single cell resolution Starmap-PLUS data, state-to-art cell segmentation methods are still limited in their ability to accurately define cell boundaries. Therefore, we first performed cell type deconvolution on the segmented cells by treating them as near-cellular spots, and then applied Celina to detect ct-SVGs
The processed example data can be downloaded from here.
# load in data
load(paste0("./data/hippocampus_scRNA_reference.RData"))
# single cell reference data
load(paste0("./data/starmap_plus_data_use.RData"))
library(CELINA)
Obj = Create_Celina_Object(celltype_mat = t(data_use$celltype_proportion),
gene_expression_mat = as.matrix(data_use$count_use),
location = as.matrix(data_use$location_use),
covariates = NULL,
project = "starmap")
In this step, we preprocess the gene expression matrix by normalizing the counts and filtering genes.
filtered_cell_types = colnames(data_use$celltype_proportion)[which(colSums(data_use$celltype_proportion) > 100)]
filtered_cell_types
Obj = preprocess_input(Obj,
# Celina object
cell_types_to_test = filtered_cell_types,
# a vector of cell types to be used for testing
scRNA_count = as.matrix(sc_expr),
# a gene x cell expression matrix of reference scRNA-seq data
sc_cell_type_labels = sc_meta_in$cellType,
# a vector of cell type labels for each cell in scRNA_count
threshold = 5e-5)
print(names(Obj@genes_list))
# This dataset has 9244 locations, we use approximation kernels here:
Obj = Calculate_Kernel(Obj, approximation = TRUE,sparseKernel = TRUE,sparseKernel_tol = 1e-4)
Obj = Testing_interaction_all(Obj,celltype_to_test = filtered_cell_types, num_cores=10)
sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 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/liblapack.so.3; LAPACK version 3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/New_York
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.2
[5] xfun_0.41 stringi_1.8.3 promises_1.2.1 jsonlite_1.8.8
[9] workflowr_1.7.1 glue_1.7.0 rprojroot_2.0.4 git2r_0.33.0
[13] htmltools_0.5.7 httpuv_1.6.13 sass_0.4.8 fansi_1.0.5
[17] rmarkdown_2.25 jquerylib_0.1.4 evaluate_0.23 tibble_3.2.1
[21] fastmap_1.1.1 yaml_2.3.8 lifecycle_1.0.4 stringr_1.5.1
[25] compiler_4.3.3 fs_1.6.3 Rcpp_1.0.12 pkgconfig_2.0.3
[29] rstudioapi_0.15.0 later_1.3.2 digest_0.6.33 R6_2.5.1
[33] utf8_1.2.4 pillar_1.9.0 magrittr_2.0.3 bslib_0.6.1
[37] tools_4.3.3 cachem_1.0.8