Last updated: 2022-06-07

Checks: 7 0

Knit directory: BASS-analysis/

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.


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(0) 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 6a631f8. 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:


Untracked files:
    Untracked:  code/run_giniclust3.py

Unstaged changes:
    Modified:   code/simu_utils.R
    Modified:   code/viz.R
    Modified:   data/MERFISH_Animal1.RData
    Modified:   data/starmap_mpfc.RData

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/index.Rmd) and HTML (docs/index.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 6a631f8 zhengli09 2022-06-07 Update software introduction and tutorial
html 345228b zhengli09 2022-02-27 Build site.
Rmd 9713c56 zhengli09 2022-02-27 Link workflow figure to introduction page
html 9a68511 zhengli09 2022-02-27 Build site.
Rmd 4ec8df1 zhengli09 2022-02-27 Publish the introduction, simulation analysis and STARmap analysis
html b2c476b zhengli09 2022-02-06 Build site.
html a6097f4 zhengli09 2022-02-06 Build site.
Rmd 9f8756a zhengli09 2022-02-06 Start workflowr project.

Welcome to the BASS website!

This website maintains code for reproducing simulation and real data application results described in the upcoming paper. For the software, please refer to BASS.

Introduction to BASS

BASS is a method for multi-scale and multi-sample analysis in spatial transcriptomics. BASS performs multi-scale transcriptomic analyses in the form of joint cell type clustering and spatial domain detection, with the two analytic tasks carried out simultaneously within a Bayesian hierarchical modeling framework. For both analyses, BASS properly accounts for the spatial correlation structure and seamlessly integrates gene expression information with spatial localization information to improve their performance. In addition, BASS is capable of multi-sample analysis that jointly models multiple tissue sections/samples, facilitating the integration of spatial transcriptomic data across tissue samples.

BASS workflow

BASS Model overview

BASS relies on a Bayesian hierarchical modeling framework that describes the relationship among gene expression features, cell type labels, spatial domain labels, cell type compositions in each spatial domain, and neighborhood graphs in a hierarchical fashion: \[ \boldsymbol{x}_i^{(l)} | c_i^{(l)} = c \sim MVN(\boldsymbol{\mu}_c, \boldsymbol{\Sigma}) \] \[ c_i^{(l)} | z_i^{(l)} = r \sim Cat(\boldsymbol{\pi}_r) \] \[ \boldsymbol{z}^{(l)} \sim Potts(V^{(l)}, \beta) \] Above, the first equation models the expression feature of the \(i\)th cell on section \(l\), \(\boldsymbol{x}_i^{(l)}\), as depending on its cell type label \(c_i^{(l)}\) with a multivariate normal distribution parameterized by a cell type-specific mean parameter \(\boldsymbol{\mu}_c\) and a variance-covariance matrix \(\boldsymbol{\Sigma}\) that is shared across cell types. The second equation models the probability of the \(i\)th cell belonging to the cell type \(c\) as depending on the underlying spatial domain with a categorical distribution parameterized by the \(r\) domain-specific cell type composition vector \(\boldsymbol{\pi}_r\). The third equation models the spatial domain label of all cells on the section \(l\), \(\boldsymbol{z}^{(l)}\), as a function of the neighborhood graph \(V^{(l)}\) through a homogeneous Potts model characterized by an interaction parameter \(\beta\).


sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

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       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     bslib_0.3.1      compiler_4.2.0   pillar_1.7.0    
 [5] later_1.1.0.1    git2r_0.28.0     jquerylib_0.1.4  tools_4.2.0     
 [9] getPass_0.2-2    digest_0.6.29    jsonlite_1.8.0   evaluate_0.15   
[13] tibble_3.1.6     lifecycle_1.0.1  pkgconfig_2.0.3  rlang_1.0.1     
[17] cli_3.2.0        rstudioapi_0.13  yaml_2.3.5       xfun_0.29       
[21] fastmap_1.1.0    httr_1.4.2       stringr_1.4.0    knitr_1.37      
[25] sass_0.4.1       fs_1.5.2         vctrs_0.3.8      rprojroot_2.0.2 
[29] glue_1.6.2       R6_2.5.1         processx_3.5.2   fansi_1.0.2     
[33] rmarkdown_2.12.1 callr_3.7.0      magrittr_2.0.2   whisker_0.4     
[37] ps_1.6.0         promises_1.1.1   htmltools_0.5.2  ellipsis_0.3.2  
[41] httpuv_1.5.4     utf8_1.2.2       stringi_1.7.6    crayon_1.5.0