PRECAST: installation

Install the PRECAST

This vignette provides an introduction to the R package PRECAST, where the function PRECAST implements the model PRECAST, a PRobabilistic Embedding and Clustering with alignment for Spatial Transcriptomics data integration . The package can be installed with the following command from Github:

install.packages('remotes') remotes::install_github("feiyoung/PRECAST")

or install from CRAN


The package can be loaded with the command:

#> Loading required package: parallel
#> Loading required package: gtools
#> Warning: package 'gtools' was built under R version 4.2.2
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#>      (status 2 uses the sf package in place of rgdal)
#> PRECAST :  An efficient data integration method is provided for multiple spatial transcriptomics data with non-cluster-relevant effects such as the complex batch effects. It unifies spatial factor analysis simultaneously with spatial clustering and embedding alignment, requiring only partially shared cell/domain clusters across datasets. More details can be referred to Wei Liu, et al. (2023) <doi:10.1038/s41467-023-35947-w>.   Check out our Package website ( for a more complete description of the methods and analyses

Setup on Linux or MacOS system

For running big data, users can use the following system command to set the C_stack unlimited in case of R Error: C stack usage is too close to the limit.

ulimit -s unlimited